Ateo
New Member
- Joined
- Apr 8, 2011
- Messages
- 43
- Reaction score
- 0
onPrepareDeath file:
Death file:
I have The Forgotten Server - Version 0.2.12 (Mystic Spirit).
Thanks so much
- - - Updated - - -
the first code works fine, the problem is when trying to connect to the database (the console does not throw error)
LUA:
function onPrepareDeath(cid)
if getPlayerLevel(cid) < 31 and getPlayerTown(cid) ~= 24 then
doPlayerSetTown(cid, 24) --Rookgaard ID.
for i = 1, 10 do --Drop Items.
local slotItem = getPlayerSlotItem(cid, i)
if slotItem.itemid > 0 then
doRemoveItem(slotItem.uid)
end
end
setPlayerStorageValue(cid, 30001, -1) --First Items.
setPlayerStorageValue(cid, 9999999, 1) --Rook2.
end
return TRUE
end
Death file:
LUA:
dofile("./config.lua")
function onDeath(cid)
if getPlayerStorageValue(cid,9999999) == 1 then
if sqlType == "mysql" then
env = luasql.mysql()
sql = env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort)
else -- sqlite
env = luasql.sqlite3()
sql = env:connect(sqliteDatabase)
end
sql:execute("UPDATE `players` SET `level` = '20', `experience` = '98800', `health` = '185', `healthmax` = '185', `mana` = '35', `manamax` = '35', `maglevel` = '0', `manaspent` = '0' WHERE `id` = " .. getPlayerGUID(cid) .. " LIMIT 1;")
sql:close()
env:close()
setPlayerStorageValue(cid, 9999999, -1)
end
end
I have The Forgotten Server - Version 0.2.12 (Mystic Spirit).
Thanks so much
- - - Updated - - -
the first code works fine, the problem is when trying to connect to the database (the console does not throw error)