Death Bug..
When you die dont appears the corpse and give that errors on console.
Errors.
PlayerDeath Script.
Creature scripts.
Login script.
Please Help Me.
:/
When you die dont appears the corpse and give that errors on console.
Errors.
Code:
[22/06/2010 16:12:30] [Error - CreatureScript Interface]
[22/06/2010 16:12:30] data/creaturescripts/scripts/playerdeath.lua:onDeath
[22/06/2010 16:12:30] Description:
[22/06/2010 16:12:30] (luaGetCreatureName) Creature not found
[22/06/2010 16:12:30] mysql_real_query(): INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (3, 1277233950, 180, '', ''); - MYSQL ERROR: Unknown column 'time' in 'field list' (1054)
[22/06/2010 16:12:30] mysql_real_query(): DELETE FROM `player_deaths` WHERE `player_id` = 3 ORDER BY `time` LIMIT 10; - MYSQL ERROR: Unknown column 'time' in 'order clause' (1054)
[22/06/2010 16:12:30] Doritos Pop has logged out.
[22/06/2010 16:12:31] Doritos Pop has logged in.
PlayerDeath Script.
Code:
local config = {
deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')),
sqlType = getConfigInfo('sqlType'),
maxDeathRecords = getConfigInfo('maxDeathRecords')
}
config.sqlType = config.sqlType == "sqlite" and DATABASE_ENGINE_SQLITE or DATABASE_ENGINE_MYSQL
function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
if(config.deathListEnabled ~= TRUE) then
return
end
local hitKillerName = "field item"
local damageKillerName = ""
if(lastHitKiller ~= FALSE) then
if(isPlayer(lastHitKiller) == TRUE) then
hitKillerName = getPlayerGUID(lastHitKiller)
else
hitKillerName = getCreatureName(lastHitKiller)
end
if(mostDamageKiller ~= FALSE and mostDamageKiller ~= lastHitKiller and getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then
if(isPlayer(mostDamageKiller) == TRUE) then
damageKillerName = getPlayerGUID(mostDamageKiller)
else
damageKillerName = getCreatureName(mostDamageKiller)
end
end
end
db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(damageKillerName) .. ");")
local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
if(rows:getID() ~= -1) then
local amount = rows:getRows(true) - config.maxDeathRecords
if(amount > 0) then
if(config.sqlType == DATABASE_ENGINE_SQLITE) then
for i = 1, amount do
db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);")
end
else
db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT " .. amount .. ";")
end
end
end
end
Creature scripts.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
<event type="login" name="PlayerLogin" event="script" value="login.lua"/>
<event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/>
<event type="think" name="Idle" event="script" value="idle.lua"/>
<event type="reportbug" name="SaveReportBug" script="reportbug.lua"/>
<event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/>
<event type="advance" name="AdvanceSave" script="advancesave.lua"/>
<event type="login" name="FimVip" event="script" value="vip2.lua"/>
<event type="login" name="FirstItems" event="script" value="firstitems.lua"/>
<event type="kill" name="InquisitionBosses" event="script" value="inquistion.lua"/>
<event type="death" name="Pythius the rottenTeleport" script="Pythius the rotten_teleport.lua"/>
<event type="death" name="inquisitionPortals" script="inquisitionPortals.lua"/>
<event type="login" name="PlayerLogin" event="script" value="anti magebomb.lua"/>
</creaturescripts>
Login script.
Code:
local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandle r'))
}
function onLogin(cid)
local loss = getConfigValue('deathLostPercent')
if(loss ~= nil) then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
end
local accountManager = getPlayerAccountManager(cid)
if(accountManager == MANAGER_NONE) then
local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
if(lastLogin > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
str = str .. " Please choose your outfit."
doPlayerSendOutfitWindow(cid)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
elseif(accountManager == MANAGER_NAMELOCK) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
elseif(accountManager == MANAGER_ACCOUNT) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
end
if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
registerCreatureEvent(cid, "InquisitionBosses")
registerCreatureEvent(cid, "Pythius the rottenTeleport")
registerCreatureEvent(cid, "Mail")
registerCreatureEvent(cid, "AdvanceSave")
registerCreatureEvent(cid, "GuildMotd")
registerCreatureEvent(cid, "inquisitionPortals")
registerCreatureEvent(cid, "Idle")
registerCreatureEvent(cid, "SkullCheck")
registerCreatureEvent(cid, "SaveReportBug")
return true
end
Please Help Me.
:/
Last edited: