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

Compiling Help Skull System 0.4

tanii

Empire-war.com
Joined
Jan 16, 2015
Messages
383
Solutions
1
Reaction score
12
Hello Otlanders.

i have problem with my skull system i am compailing skull system on tfs 0.4

the skull system works fine but the problem is when i attack to player and then i loss the pz the skull algo loss at loss pz.

what i need to do for no loss the skull.

thanks!
 
you need:

Code:
local storage = 9000
 
function onKill(cid, target, lastHit)
    if isPlayer(target) and cid ~= target then
        local frags = math.max(0, getCreatureStorage(cid, storage)) + 1
        setPlayerStorageValue(cid, storage, frags)
        if frags >= 50 then
            doCreatureSetSkullType(cid, SKULL_GREEN)
        elseif frags >= 100 then
            doCreatureSetSkullType(cid, SKULL_WHITE)
        elseif frags >= 200 then
            doCreatureSetSkullType(cid, SKULL_YELLOW)
        elseif frags >= 400 then
            doCreatureSetSkullType(cid, SKULL_RED)
        elseif frags >= 500 then
            doCreatureSetSkullType(cid, SKULL_BLACK)
        end
    end
    return true
end

and need create other onLogin.


Code:
local storage = 9000
 
function onLogin(cid)
        local frags = math.max(0, getCreatureStorage(cid, storage))
        setPlayerStorageValue(cid, storage, frags)
        if frags >= 50 then
            doCreatureSetSkullType(cid, SKULL_GREEN)
        elseif frags >= 100 then
            doCreatureSetSkullType(cid, SKULL_WHITE)
        elseif frags >= 200 then
            doCreatureSetSkullType(cid, SKULL_YELLOW)
        elseif frags >= 400 then
            doCreatureSetSkullType(cid, SKULL_RED)
        elseif frags >= 500 then
            doCreatureSetSkullType(cid, SKULL_BLACK)
        end
    end
    return true
end
 
you need:

Code:
local storage = 9000
 
function onKill(cid, target, lastHit)
    if isPlayer(target) and cid ~= target then
        local frags = math.max(0, getCreatureStorage(cid, storage)) + 1
        setPlayerStorageValue(cid, storage, frags)
        if frags >= 50 then
            doCreatureSetSkullType(cid, SKULL_GREEN)
        elseif frags >= 100 then
            doCreatureSetSkullType(cid, SKULL_WHITE)
        elseif frags >= 200 then
            doCreatureSetSkullType(cid, SKULL_YELLOW)
        elseif frags >= 400 then
            doCreatureSetSkullType(cid, SKULL_RED)
        elseif frags >= 500 then
            doCreatureSetSkullType(cid, SKULL_BLACK)
        end
    end
    return true
end

and need create other onLogin.


Code:
local storage = 9000
 
function onLogin(cid)
        local frags = math.max(0, getCreatureStorage(cid, storage))
        setPlayerStorageValue(cid, storage, frags)
        if frags >= 50 then
            doCreatureSetSkullType(cid, SKULL_GREEN)
        elseif frags >= 100 then
            doCreatureSetSkullType(cid, SKULL_WHITE)
        elseif frags >= 200 then
            doCreatureSetSkullType(cid, SKULL_YELLOW)
        elseif frags >= 400 then
            doCreatureSetSkullType(cid, SKULL_RED)
        elseif frags >= 500 then
            doCreatureSetSkullType(cid, SKULL_BLACK)
        end
    end
    return true
end
should be going from 500 -> 50
if the player has 500 frags and it's >=50 the first if statement the player will get a green skull.
 
you need:

Code:
local storage = 9000
 
function onKill(cid, target, lastHit)
    if isPlayer(target) and cid ~= target then
        local frags = math.max(0, getCreatureStorage(cid, storage)) + 1
        setPlayerStorageValue(cid, storage, frags)
        if frags >= 50 then
            doCreatureSetSkullType(cid, SKULL_GREEN)
        elseif frags >= 100 then
            doCreatureSetSkullType(cid, SKULL_WHITE)
        elseif frags >= 200 then
            doCreatureSetSkullType(cid, SKULL_YELLOW)
        elseif frags >= 400 then
            doCreatureSetSkullType(cid, SKULL_RED)
        elseif frags >= 500 then
            doCreatureSetSkullType(cid, SKULL_BLACK)
        end
    end
    return true
end

and need create other onLogin.


Code:
local storage = 9000
 
function onLogin(cid)
        local frags = math.max(0, getCreatureStorage(cid, storage))
        setPlayerStorageValue(cid, storage, frags)
        if frags >= 50 then
            doCreatureSetSkullType(cid, SKULL_GREEN)
        elseif frags >= 100 then
            doCreatureSetSkullType(cid, SKULL_WHITE)
        elseif frags >= 200 then
            doCreatureSetSkullType(cid, SKULL_YELLOW)
        elseif frags >= 400 then
            doCreatureSetSkullType(cid, SKULL_RED)
        elseif frags >= 500 then
            doCreatureSetSkullType(cid, SKULL_BLACK)
        end
    end
    return true
end


im trying to solve an issue im using these script, player gain skulls when kill player, but when they LOG OUT...not when he lost pz WHEN PLAYER LOG OUT ,the player lost the skull i have added the script in creature script and login.lua too

what more i need to do? help
 
Last edited:
look up I already posted the solution
thanks mate but maybe you miss understood me. I already have edited/compiled the sources skulls war system is working properly.

i just need figure out what i can do to avoid players loss skull when LOG OUT ...
not when they lose pz.

thanks anyway and if you have the answer please let me know
 
Last edited:
thanks mate but maybe you miss understood me. I already have edited/compiled the sources skulls war system is working properly.

i just need figure out what i can do to avoid players loss skull when LOG OUT ...
not when they lose pz.

thanks anyway and if you have the answer please let me know
do a script when onlogin SetSkullType or use this mod
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Skull System" version="1.0" author="Skyforever" contact="tibiaking.com" enabled="yes">
<config name="SkullC_func"><![CDATA[
function setSkullColor(cid)
local t = {
[{5,10}] = 1,
[{11,15}] = 2,
[{16,20}] = 3,
[{21,25}] = 4,
[{26,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), week = (time - (7 * 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)
elseif(content.date > times.week) then
table.insert(contents.week, content)
else
table.insert(contents.month, content)
end
until not result:next()
result:free()
end
local size = {day = table.maxn(contents.day),week = table.maxn(contents.week),month = table.maxn(contents.month)}
return size.day + size.week + size.month
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)
if isPlayer(cid) and isPlayer(target) then
doCreatureSetSkullType(target, 0)
addEvent(setSkullColor, 100, cid)
end
return true
end]]></event>
</mod>
 
do a script when onlogin SetSkullType or use this mod
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Skull System" version="1.0" author="Skyforever" contact="tibiaking.com" enabled="yes">
<config name="SkullC_func"><![CDATA[
function setSkullColor(cid)
local t = {
[{5,10}] = 1,
[{11,15}] = 2,
[{16,20}] = 3,
[{21,25}] = 4,
[{26,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), week = (time - (7 * 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)
elseif(content.date > times.week) then
table.insert(contents.week, content)
else
table.insert(contents.month, content)
end
until not result:next()
result:free()
end
local size = {day = table.maxn(contents.day),week = table.maxn(contents.week),month = table.maxn(contents.month)}
return size.day + size.week + size.month
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)
if isPlayer(cid) and isPlayer(target) then
doCreatureSetSkullType(target, 0)
addEvent(setSkullColor, 100, cid)
end
return true
end]]></event>
</mod>

THANKS FOR TH MOD BUT WITH THIS MOD PEOPLE NEVER LOSES PK WHEN DIE WHEN LOGOUT NEVER LOSE SKULL

CAN YOU HELP ME?
im using thi one but don't works(its bugged says need end <eof> and it's with end i have edited and no succes
Code:
doCreatureSetStorage(cid, 9000)

local storage = 9000

function onDeath(cid, target, lastHit)
if cid ~= target and isPlayer(target) then
local a = (0, getCreatureStorage(cid, storage) + 1
doCreatureSetStorage(cid, storage, a)
if a == 1 then
doCreatureSetSkullType(cid, SKULL_GREEN)
elseif a == 2 then
doCreatureSetSkullType(cid, SKULL_YELLOW)
elseif a == 3 then
doCreatureSetSkullType(cid, SKULL_WHITE)
elseif a == 4 then
doCreatureSetSkullType(cid, SKULL_RED)
 end
    end
    return true
end
 
THANKS FOR TH MOD BUT WITH THIS MOD PEOPLE NEVER LOSES PK WHEN DIE WHEN LOGOUT NEVER LOSE SKULL

CAN YOU HELP ME?
im using thi one but don't works(its bugged says need end <eof> and it's with end i have edited and no succes
Code:
doCreatureSetStorage(cid, 9000)

local storage = 9000

function onDeath(cid, target, lastHit)
if cid ~= target and isPlayer(target) then
local a = (0, getCreatureStorage(cid, storage) + 1
doCreatureSetStorage(cid, storage, a)
if a == 1 then
doCreatureSetSkullType(cid, SKULL_GREEN)
elseif a == 2 then
doCreatureSetSkullType(cid, SKULL_YELLOW)
elseif a == 3 then
doCreatureSetSkullType(cid, SKULL_WHITE)
elseif a == 4 then
doCreatureSetSkullType(cid, SKULL_RED)
 end
    end
    return true
end
Code:
local storage = 9000

local skull = {
    [1] = SKULL_GREEN,
    [2] = SKULL_YELLOW,
    [3] = SKULL_WHITE,
    [4] = SKULL_RED
}

function onDeath(cid, target, lastHit)
    if cid ~= target and isPlayer(target) then
        local skullType = getCreatureStorage(cid, storage) + 1
        skullType = (skullType > 0 and skullType <= 4) and skullType or (skullType > 4 and 4 or 1)
        doCreatureSetStorage(cid, storage, skullType)
        doCreatureSetSkullType(cid, skull[skullType])
    end
    return true
end
 
Last edited:
Code:
local storage = 9000

local skull = {
    [1] = SKULL_GREEN,
    [2] = SKULL_YELLOW,
    [3] = SKULL_WHITE,
    [4] = SKULL_RED
}

function onDeath(cid, target, lastHit)
    if cid ~= target and isPlayer(target) then
        local skullType = getCreatureStorage(cid, storage) + 1
        skullType = (skullType > 0 and skullType <= 4) and skullType or (skullType > 4 and 4 or 1)
        doCreatureSetStorage(cid, storage, skullType)
        doCreatureSetSkullType(cid, skull[skullType])
    end
    return true
end
gonna test thansk mate
 
Back
Top