sircurse
Curseria RTG - TFS 1.1
I think its possible, and I really need it urgent, I made a server with rookguard, and the players get lvl 8, make a sorcerer, then die until lvl 1 and uplvl again getting more mana than normal...
It's a problem for me. My server dont work with rooksystem, so I think its a nice way make a update on player deat file, so when player get lvl 7 his char is rooked back to the first vocation with hp and mana correspodent....
This is my script, I tried but it is not saving the new info on players when die.
It's a problem for me. My server dont work with rooksystem, so I think its a nice way make a update on player deat file, so when player get lvl 7 his char is rooked back to the first vocation with hp and mana correspodent....
This is my script, I tried but it is not saving the new info on players when die.
PHP:
function onDeath(cid, corpse, killer)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You are dead.")
dofile("./config.lua")
if sqlType == "mysql" then
env = assert(luasql.mysql())
con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
else -- sqlite
env = assert(luasql.sqlite3())
con = assert(env:connect(sqliteDatabase))
end
local level = assert(con:execute("SELECT `level` FROM `players` WHERE `name` = " .. getPlayerGUIDByName(getCreatureName(cid)) .. ";"))
local rookLevel = level:numrows()
if rookLevel == 7 then
query = assert(con:execute("UPDATE `players` SET (`vocation`, `healthmax`, `manamax`, `cap`, `town_id`, `posx`, `posy`, `posz`) VALUES (0, 180, 30, 475, 9, 349, 930, 7) WHERE `name` = " .. getPlayerGUIDByName(getCreatureName(cid)) .. ""));
end
query = assert(con:execute("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`) VALUES (" .. getPlayerGUIDByName(getCreatureName(cid)) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", '" .. getCreatureName(killer) .. "', " .. isPlayer(killer) .. ");"))
local cursor = assert(con:execute("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUIDByName(getCreatureName(cid)) .. ";"))
local deathRecords = cursor:numrows()
while deathRecords > maxDeathRecords do
delete = assert(con:execute("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUIDByName(getCreatureName(cid)) .. " ORDER BY `time` LIMIT 1;"))
deathRecords = deathRecords - 1
end
con:close()
env:close()
end