• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Update script to TFS 1.2

president vankk

Web Developer & AuraOT Owner
Joined
Jul 10, 2009
Messages
5,719
Solutions
9
Reaction score
339
Hello, I was trying update a script to TFS 1.2 but doesn't have any success.
The main idea is if was a configure monster from position X, Y, Z to X, Y, Z then will remove the gates at position.
If doesn't have the configured monster then nothing will happens; if someone can edit the code for after 15 minutes, the gates will be created again. That's all.

Code:
removals = {
   {item = 9486, pos = {x=1000, y=1000 , z=7 }},
   {item = 9486, pos = {x=1001, y=1000 , z=7 }},
   {item = 9485, pos = {x=1000,  y=1000 , z=7 }},
   {item = 9485, pos = {x=1001,  y=1000 , z=7 }}
 }
local from = {x = 1005, y = 1000, z = 6}
local to = {x = 1015, y = 1012, z = 6}
for x = from.x, to.x do
   for y = from.y, to.y do
     local v = getTopCreature({x = x, y = y, z = 1}).uid
     if isPlayer(v) or getCreatureName(v) ~= "Dragon Lord" then
       return true
     elseif isMonster(v) and getCreatureName(v) == "Dragon Lord" then   
       for i = 1, #removals do
         removals[i].pos.stackpos = 1
         doRemoveItem(getThingfromPos(removals[i].pos).uid, 1)
       end   
     end
   end
end

Thanks.
 
Hope this what you are looking for,.
Code:
removals = {
    {itemId = 9486, pos = {x=1000, y=1000 ,z=7 }},
    {itemId = 9486, pos = {x=1001, y=1000 ,z=7 }},
    {itemId = 9485, pos = {x=1000, y=1000 ,z=7 }},
    {itemId = 9485, pos = {x=1001, y=1000 ,z=7 }}
}
local from = {x = 1005, y = 1000, z = 6}
local to = {x = 1015, y = 1012, z = 6}

for x = from.x, to.x do
    for y = from.y, to.y do
        local v = Tile({x = x, y = y, z = 1}):getTopCreature()  
        if isPlayer(v) or v:getName():lower() ~= 'dragon lord' then
            return true
        elseif isMonster(v) and v:getName():lower() ~= 'dragon lord' then
            for i = 1, #removals do
                Tile(removals[i].pos):getItemById(removals[i].itemId):remove()
            end
        end      
    end
end
 
Hi, @Slavi Dodo. Thanks so much, it's working! Could you help me with two others scripts too? If possible, of course.

I want transform this script to 1.2:
Code:
local function getPlayerPPoints(cid)
local Info = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
if Info:getID() ~= LUA_ERROR then
local Points= Info:getDataInt("premium_points")
Info:free()
return Points
end
return LUA_ERROR
end


local function AddPlayerPPontos(cid, points)
local Info = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
if Info:getID() ~= LUA_ERROR then
db.executeQuery("UPDATE accounts SET premium_points = " .. getPlayerPPoints(cid) + points .. " WHERE id=" .. getPlayerAccountId(cid) .. ";")
Info:free()
return 1
end
end


local function RemoverPlayerPPontos(cid, points)
local Info = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
if Info:getID() ~= LUA_ERROR then
db.executeQuery("UPDATE accounts SET premium_points = " .. getPlayerPPoints(cid) - points .. " WHERE id=" .. getPlayerAccountId(cid) .. ";")
Info:free()
return 1
end
end

function onSay(cid, words, param)

local t = string.explode(param, ",")
local id = tonumber(t[1])
   if words == "!depositar" then
   local id = tonumber(t[1])
     if (id == 0) then
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Não é possível depositar 0 moedas!")
     return true
   end
     if (id == null) then
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Por favor digite um valor.")
     return true
   end    
     if getPlayerItemCount(cid, 9971) >= id then
       AddPlayerPPontos(cid, id)
       doPlayerRemoveItem(cid, 9971, id)
       doPlayerSendTextMessage(cid, 29, "Parabéns, você depositou ".. id .." barras de ouro com sucesso! Seu saldo no banco agora é de ".. getPlayerPPoints(cid) .." moedas, para sacar utilize o comando !sacar")

     else
     doPlayerSendTextMessage(cid, 29, "Você não possui a quantidade necessária para adicionar no seu saldo.")
     return TRUE
   end
   ----------------------------------------------------------------------
  elseif words == "!sacar" then
   local t = string.explode(param, ",")
   local id = tonumber(t[1])
     if (id == 0) then
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Não é possível depositar 0 moedas!")
     return true
   end
     if (id == null) then
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Por favor digite um valor.")
     return true
   end  
   if getPlayerPPoints(cid) >= id then
     doPlayerAddItem(cid, 9971, id)
     RemoverPlayerPPontos(cid, id)
     doPlayerSendTextMessage(cid, 29, "Parabéns, você sacou ".. id .." barras de ouro com sucesso! Seu saldo no banco agora é de ".. getPlayerPPoints(cid) .." moedas.")
     setPlayerStorageValue(cid,11548,os.time()+15)
   return TRUE
   else
     doPlayerSendTextMessage(cid, 29, "Você não possui a quantidade necessária para sacar.")
   end
------------------------------------------------------------------------
   elseif words == "!saldo" then
     if not param or param == "" then
       doPlayerSendTextMessage(cid, 29, "O seu saldo no shopping é de: ".. getPlayerPPoints(cid) .." moedas.")
       return true
     end
-------------------------------------------------------------------------------------
   elseif words == "!verpontos" then
     if (not t[1]) then
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Comando precisa de parametros")
       return true
     end
     if(getPlayerGroupId(cid) >= 3) then
       local player = getPlayerGUIDByName(t[1])
       if (not player) then
         doPlayerSendTextMessage(cid, 29, "Jogador não existe ou não está online")
         return true
       else
         doPlayerSendTextMessage(cid, 29, "O jogador "..getCreatureName(t[1]) .." tem ".. getPlayerPPoints(t[1]).." moedas.")
         return true
       end
     else
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não tem permição de usar esse comando")
     return true
   end
   ------------------------------------------------------------------------------------
   elseif words == "!addpontos" then
     local player = getPlayerGUIDByName(t[1])
     if (not t[1]) and (not t[2]) then
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Comando precisa de parametros")
       return true
     end
     if(getPlayerGroupId(cid) >= 3) then
       if (not player) then
         doPlayerSendTextMessage(cid, 29, "Jogador não existe ou não está online")
         return true
       else
       AddPlayerPPontos(player,t[2])
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você adicionou "..t[2].." moedas para conta de "..t[1]..".")
       return true
     end
   else
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não tem permição de usar esse comando")
     return true
   end
   ------------------------------------------------------------------------------------------------------------------------     
   elseif words == "!removerpontos" then
     local player = getPlayerGUIDByName(t[1])
     if (not t[1]) and (not t[2]) then
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Comando precisa de parametros")
     return true
     end
     if(getPlayerGroupId(cid) >= 3) then
       if (not player) then
         doPlayerSendTextMessage(cid, 29, "Jogador não existe ou não está online")
         return true
       else
         if(t[2] > getPlayerPPoints(player)) then
           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "O jogador "..t[1].." só tem ".. getPlayerPPoints(player).." moedas.")
           return true
         end
         if(t[2] < 0) then
           RemoverPlayerPPontos(player,getPlayerPPoints(player))
           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Foi removida todos as moedas do jogador "..t[1]..".")
         else
           RemoverPlayerPPontos(player,t[2])
           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Foi removido "..t[2].." moedas do jogador "..t[1]..".")
           return true
         end
       end
     else
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não tem permição de usar esse comando")
       return true
     end
   return TRUE
   end
end

Also I have a request if you could help me with that, I'll be glad!
You type the command !buy skill axe, 10 or !buy skill ml, 10 or !buy golden helmet and you'll buy theses skills/item for 100 crystal coins. It's possible? I don't know how to do that, I have a big problem with params.

I hope you or someone can help with that.

Thanks.
 
Back
Top