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

[Need a fix] (internalGetPlayerInfo) Player not found when requesting player info #18

Majster12

Member
Joined
Feb 20, 2009
Messages
134
Solutions
1
Reaction score
16
Script:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Skull System" version="1.0" author="Vomar" contact="massa-war.com" enabled="yes">
<config name="SkullC_func"><![CDATA[
function setSkullColor(cid)
local t = {
[{5,19}] = 1,
[{20,39}] = 2,
[{40,59}] = 3,
[{60,99}] = 4,
[{100,math.huge}] = 5
}
for var, ret in pairs(t) do
if getPlayerFrags(cid) >= var[1] and getPlayerFrags(cid) <= var[2] then
doCreatureSetSkullType(cid, ret)
end
end
end
function getPlayerFrags(cid)
local time = os.time()
local times = {today = (time - 86400),}
local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
if(result:getID() ~= -1) then
repeat
local content = {date = result:getDataInt("date")}
if(content.date > times.today) then
table.insert(contents.day, content)
end
until not result:next()
result:free()
end
local size = {day = table.maxn(contents.day)}
return size.day
end
]]></config>
<event type="login" name="SkullLogin" event="script"><![CDATA[
domodlib('SkullC_func')
function onLogin(cid)
registerCreatureEvent(cid, "ColorKill")
setSkullColor(cid)
return true
end]]></event>
<event type="kill" name="ColorKill" event="script"><![CDATA[
domodlib('SkullC_func')
function onKill(cid, target, lastHit)
if isPlayer(target) then
doCreatureSetSkullType(target, 0)
addEvent(setSkullColor, 1, cid)
end
return true
end]]></event>
</mod>


Error:
LxWejxd.png
 
Try of changing this line:
Code:
addEvent(setSkullColor, 1, cid)
just with it:
Code:
setSkullColor(target)

If this will not work - you don't need to use onKill, you can use onDeath. This script is changed to use onDeath instead of onKill (not tested - remember to change correspond line on creaturescripts.xml):
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Skull System" version="1.0" author="Vomar" contact="massa-war.com" enabled="yes">
   <config name="SkullC_func"><![CDATA[
     function setSkullColor(cid)
       local t = {
         [{5,19}] = 1,
         [{20,39}] = 2,
         [{40,59}] = 3,
         [{60,99}] = 4,
         [{100,math.huge}] = 5
       }
       for var, ret in pairs(t) do
         if getPlayerFrags(cid) >= var[1] and getPlayerFrags(cid) <= var[2] then
           doCreatureSetSkullType(cid, ret)
           break
         end
       end
     end
     function getPlayerFrags(cid)
       local time = os.time()
       local times = {today = (time - 86400),}
       local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
       if(result:getID() ~= -1) then
         repeat
           local content = {date = result:getDataInt("date")}
           if(content.date > times.today) then
             table.insert(contents.day, content)
           end
         until not result:next()
         result:free()
       end
       local size = {day = table.maxn(contents.day)}
       return size.day
     end
   ]]></config>

   <event type="login" name="SkullLogin" event="script"><![CDATA[
     domodlib('SkullC_func')
     function onLogin(cid)
       registerCreatureEvent(cid, "ColorKill")
       setSkullColor(cid)
       return true
     end
   ]]></event>
   <event type="death" name="ColorKill" event="script"><![CDATA[
     domodlib('SkullC_func')
     function onDeath(cid, target, deathList)
       -- doCreatureSetSkullType(cid, 0) -- seems like we don't need it because setSkullColor is using this function anyway`
       setSkullColor(cid)
       return true
     end
   ]]></event>
</mod>
 
Back
Top