• 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!

Lua Crash

hasbro

Member
Joined
Feb 15, 2009
Messages
287
Reaction score
6
Hello, i create one script to training my skills and this script after a say !vipteste , connection lost with the server...i dont know why..
Lua:
function onSay(cid, words, param, channel)
level = getPlayerLevel(cid)
sto = 399710
lvmin = 100
vip = 1
local Info = db.getResult("SELECT `vipteste` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
if(Info:getID() ~= -1) then
while(true) do
if level >= lvmin then
doPlayerAddPremiumDays(cid, 1)
db.executeQuery("UPDATE  `otserv`.`accounts` SET  `vipteste` =  '1' WHERE  `accounts`.`id` =" .. getPlayerAccountId(cid) .. ";")
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce ganhou 1 dia de VIP para TEST, Aproveite!!.")
setPlayerStorageValue(cid,sto,1)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
else
doPlayerSendCancel(cid, "Voce precisa de level ".. lvmin .." para testar a VIP.")
end
end
end
end
 
You got an endless loop executing db queries.. Why?
Also, the result is not freed if the result ID is ~= -1.
Lua:
Info:free()
 

Similar threads

Back
Top