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

Solved save skulls from removing

MaR0

Banned User
Joined
Apr 16, 2018
Messages
272
Solutions
3
Reaction score
29
if it possible to save the skulls from removing if you losses pz or you logout don't lose the skulls like this
i just edited the sources at c++ to To make the server suitable for war from this thread Feature - Every changes you need to a Hardcore/War Server

ud0KX.png

also i'm using this script
Lua:
local storage = 4321
function onKill(cid, target)
    local frags = getPlayerStorageValue(cid, storage)
    if(isPlayer(target)) then
        setPlayerStorageValue(cid, storage, frags+1)
        if(frags < 1) then
            doCreatureSetSkullType(cid, SKULL_GREEN)
        elseif(frags < 2) then
            doCreatureSetSkullType(cid, SKULL_WHITE)
        elseif(frags < 10) then
            doCreatureSetSkullType(cid, SKULL_RED)
        elseif(frags > 18) then
            doCreatureSetSkullType(cid, SKULL_BLACK)
        end
    end
    return true
end

thanks
 
Solution
The issue with the frags not counting is managed within your frag script. This, and the script we communicated about on Discord is solely to reward skulls according to fragcount.

A green skull is always rewarded if the player has 0 or 1 kills (onLogin), which would mean that everyone has a default green skull.
The code 'rewarding' is working, but the script counting the frags is either not being fired or the storage value is not being upped.
Setting a skull is different as obtaining one from attacking a player (thus getting pz-locked). I have some system similar to yours, which shows a skull specific to your K/D ratio (instead of only kills).

The way I have done it, is by disabling the skull system in general and then checking for the KDR onLogin and onKill. Both kills and deaths are stored as storage value, like you are doing.
This way you won't get skulled from opening a fight and instead you'll be rewarded with one when killing someone or relogging.

-- Update; working code, tested by TS
Lua:
local function checkSkull(cid)
    -- Default skull is green
    local skull = SKULL_GREEN
    -- Get the frag count
    local frags = getPlayerStorageValue(cid, 4321)
    if frags >= 2 and frags < 10 then
        -- 2 frags or more, below 10
        skull = SKULL_WHITE
    elseif frags >= 10 and frags < 18 then
        -- 10 frags or more, below 18
        skull = SKULL_RED
    elseif frags >= 18 then
        -- 18 frags or more
        skull = SKULL_BLACK
    end
    -- Set the pre-determined skull
    doCreatureSetSkullType(cid, skull)
    return true
end

function onKill(cid, target)
    return checkSkull(cid)
end

function onLogin(cid)
    return checkSkull(cid)
end
 
Last edited:
Setting a skull is different as obtaining one from attacking a player (thus getting pz-locked). I have some system similar to yours, which shows a skull specific to your K/D ratio (instead of only kills).

The way I have done it, is by disabling the skull system in general and then checking for the KDR onLogin and onKill. Both kills and deaths are stored as storage value, like you are doing.
This way you won't get skulled from opening a fight and instead you'll be rewarded with one when killing someone or relogging.

-- Update; working code, tested by TS
Lua:
local function checkSkull(cid)
    -- Default skull is green
    local skull = SKULL_GREEN
    -- Get the frag count
    local frags = getPlayerStorageValue(cid, 4321)
    if frags >= 2 and frags < 10 then
        -- 2 frags or more, below 10
        skull = SKULL_WHITE
    elseif frags >= 10 and frags < 18 then
        -- 10 frags or more, below 18
        skull = SKULL_RED
    elseif frags >= 18 then
        -- 18 frags or more
        skull = SKULL_BLACK
    end
    -- Set the pre-determined skull
    doCreatureSetSkullType(cid, skull)
    return true
end

function onKill(cid, target)
    return checkSkull(cid)
end

function onLogin(cid)
    return checkSkull(cid)
end
well this is worked When you kill someone i take battle when the battle gone also skull gone i want make it stable if battle removed
The only thing that works is the green skull without any pz
Capture.png
 
did you have that issue before or did it only appear after making that edit? It shouldn't affect frags
 
The issue with the frags not counting is managed within your frag script. This, and the script we communicated about on Discord is solely to reward skulls according to fragcount.

A green skull is always rewarded if the player has 0 or 1 kills (onLogin), which would mean that everyone has a default green skull.
The code 'rewarding' is working, but the script counting the frags is either not being fired or the storage value is not being upped.
 
Solution
The issue with the frags not counting is managed within your frag script. This, and the script we communicated about on Discord is solely to reward skulls according to fragcount.

A green skull is always rewarded if the player has 0 or 1 kills (onLogin), which would mean that everyone has a default green skull.
The code 'rewarding' is working, but the script counting the frags is either not being fired or the storage value is not being upped.
what exactly i will do dude, i did you what you told me to do but this not worked
 
Setting a skull is different as obtaining one from attacking a player (thus getting pz-locked). I have some system similar to yours, which shows a skull specific to your K/D ratio (instead of only kills).

The way I have done it, is by disabling the skull system in general and then checking for the KDR onLogin and onKill. Both kills and deaths are stored as storage value, like you are doing.
This way you won't get skulled from opening a fight and instead you'll be rewarded with one when killing someone or relogging.

-- Update; working code, tested by TS
Lua:
local function checkSkull(cid)
    -- Default skull is green
    local skull = SKULL_GREEN
    -- Get the frag count
    local frags = getPlayerStorageValue(cid, 4321)
    if frags >= 2 and frags < 10 then
        -- 2 frags or more, below 10
        skull = SKULL_WHITE
    elseif frags >= 10 and frags < 18 then
        -- 10 frags or more, below 18
        skull = SKULL_RED
    elseif frags >= 18 then
        -- 18 frags or more
        skull = SKULL_BLACK
    end
    -- Set the pre-determined skull
    doCreatureSetSkullType(cid, skull)
    return true
end

function onKill(cid, target)
    return checkSkull(cid)
end

function onLogin(cid)
    return checkSkull(cid)
end
how do i register this? onkill, onlogin?
Post automatically merged:

How exactly did you solve it? I have same problem and unable to solve it.

Edit :
Fixed already thanks
how you solved it? at least in tfs 1.5 the players are begining with green skull if they kill players they don't gain white, yellow or any skull
Lua:
    <event type="login" name="war_skull" script="war_skull.lua" />
    <event type="death" name="war_skulls" script="war_skull.lua" />
Code:
local function checkSkull(cid)
    -- Default skull is green
    local skull = SKULL_GREEN
    -- Get the frag count
    local frags = getPlayerStorageValue(cid, 4321)
    if frags >= 1 and frags < 3 then
        -- 2 frags or more, below 10
        skull = SKULL_WHITE
    elseif frags >= 3 and frags < 5 then
        -- 10 frags or more, below 18
        skull = SKULL_RED
    end
    -- Set the pre-determined skull
    doCreatureSetSkullType(cid, skull)
    return true
end

function onDeath(cid, target)
    return checkSkull(cid)
end

function onLogin(cid)
    return checkSkull(cid)
end
there are no errors in console
 
Last edited:
Back
Top