• 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 Skull in db always == 4

DanJ93

Member
Joined
Dec 25, 2008
Messages
212
Reaction score
19
Hello!
Why in my data base always when player logout skull = 4?
I can create new character, login and logout and in my data base this character have skull 4 and skulltime 0 ?!
My accont manager show red skull near all characters because all have skull 4 ;s
 
login.lua
Code:
local config = {
   loginMessage = getConfigValue('loginMessage'),
   useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
   if (getConfigValue("accountManager") == FALSE and getCreatureName(cid) == "Account Manager") then
     return false
   end

   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, "SkullCheck")
   registerCreatureEvent(cid, "Mail")
   registerCreatureEvent(cid, "GuildMotd")
   registerCreatureEvent(cid,'SpellUp')
   registerCreatureEvent(cid, "Idle")
   registerCreatureEvent(cid, "ReportBug")
   return true
end
and creaturescripts:
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="receivemail" name="Mail" event="script" value="mail.lua"/>
   <event type="reportbug" name="SaveReportBug" script="reportbug.lua"/>
   <event type="login" name="Antimagebomb" event="script" value="Antimagebomb.lua"/>
   <event type="think" name="Idle" event="script" value="idle.lua"/>
   <event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/>

   <event type="advance" name="SpellUp" event="script" value="spellup.lua"/>
</creaturescripts>
skullCheck.lua
Code:
function onThink(cid, interval)
   if(not isCreature(cid)) then
     return
   end

   local skull, skullEnd = getCreatureSkull(cid), getPlayerSkullEnd(cid)
   if(skullEnd > 0 and skull > SKULL_WHITE and os.time() > skullEnd and not getCreatureCondition(cid, CONDITION_INFIGHT)) then
     doPlayerSetSkullEnd(cid, 0, skull)
   end
end
Mods: have only first items
 
Back
Top