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

Skull system TFS 1.2

MaR0

Banned User
Joined
Apr 16, 2018
Messages
272
Solutions
3
Reaction score
29
i want skull system working on tfs 1.2 with pvp enforced like this
Lua:
local storage = xxxx
function onKill(cid, target)
    local frags = getPlayerStorageValue(cid, storage)
    if(isPlayer(target)) then
        setPlayerStorageValue(cid, storage, frags+1)
        if(frags < 10) then
            doCreatureSetSkullType(cid, SKULL_GREEN)
        elseif(frags < 20) then
            doCreatureSetSkullType(cid, SKULL_WHITE)
        elseif(frags < 30) then
            doCreatureSetSkullType(cid, SKULL_RED)
        elseif(frags > 39) then
            doCreatureSetSkullType(cid, SKULL_BLACK)
        end
    end
    return true
end
and talkaction checker
Lua:
function onSay(cid, words, param, channel)
    if(getPlayerStorageValue(cid, xxxx) < 1) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have no frags.")
    elseif(getPlayerStorageValue(cid, xxxx) == 1) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have 1 frag.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have ".. getPlayerStorageValue(cid, xxxx) .." frags.")
    end
    return true
end
thanks
 
Last edited:
Add somewhere in data/global.lua:
Lua:
STORAGE_PVPFRAGS = xxxx
Don't forget to change "xxxx" to your free storage. Adding it in global.lua makes that you don't have to define local storage in each script where you want to use this storage.

Add in creaturescripts/scripts/pvpenfo_skulls_frags.lua:
Lua:
function onKill(creature, target)
    local player = Player(creature)
    local frags = player:getStorageValue(STORAGE_PVPFRAGS)
    if target:isPlayer() then
        player:setStorageValue(STORAGE_PVPFRAGS, frags+1)
        if(frags < 10) then
            player:setSkull(SKULL_GREEN)
        elseif(frags < 20) then
            player:setSkull(SKULL_WHITE)
        elseif(frags < 30) then
            player:setSkull(SKULL_RED)
        elseif(frags > 39) then
            player:setSkull(SKULL_BLACK)
        end
    end
    return true
end

Add in creaturescripts/creaturescripts.xml:
XML:
<event type="kill" name="PvPEnfoSkullsFrags" script="pvpenfo_skulls_frags.lua"/>

And register in creaturescripts/scripts/login.lua:
Lua:
player:registerEvent("PvPEnfoSkullsFrags") -- PvP Enfo Skulls & Frags

TALKACTIONS TIME
Add in data/talkactions/scripts/checkpvpenfofrags.lua:
Lua:
function onSay(player, words, param)
    if player:getStorageValue(STORAGE_PVPFRAGS) < 1 then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You currently have no frags.")
    elseif player:getStorageValue(STORAGE_PVPFRAGS) == 1 then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You currently have 1 frag.")
    else
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You currently have ".. player:getStorageValue(STORAGE_PVPFRAGS) .." frags.")
    end
    return true
end

Add in data/talkactions/talkactions.xml:
XML:
<talkaction words="!frags" script="checkpvpenfofrags.lua" />


And of course in config.lua you must set the WorldType to PVP-Enforced.
That's mostly all from the LUA part.

And for future LUA script making, you have almost all functions that exist in TFS'es 1.X, here:
LUA Functions List [TFS 1.0] Updated: 17/09/2014
 
Last edited:
Add somewhere in data/global.lua:
Lua:
STORAGE_PVPFRAGS = xxxx
Don't forget to change "xxxx" to your free storage. Adding it in global.lua makes that you don't have to define local storage in each script where you want to use this storage.

Add in creaturescripts/scripts/pvpenfo_skulls_frags.lua:
Lua:
function onKill(creature, target)
    local player = Player(creature)
    local frags = player:getStorageValue(STORAGE_PVPFRAGS)
    if target:isPlayer() then
        player:setStorageValue(STORAGE_PVPFRAGS, frags+1)
        if(frags < 10) then
            player:setSkull(SKULL_GREEN)
        elseif(frags < 20) then
            player:setSkull(SKULL_WHITE)
        elseif(frags < 30) then
            player:setSkull(SKULL_RED)
        elseif(frags > 39) then
            player:setSkull(SKULL_BLACK)
        end
    end
    return true
end

Add in creaturescripts/creaturescripts.xml:
XML:
<event type="kill" name="PvPEnfoSkullsFrags" script="pvpenfo_skulls_frags.lua"/>

And register in creaturescripts/scripts/login.lua:
Lua:
player:registerEvent("PvPEnfoSkullsFrags") -- PvP Enfo Skulls & Frags

TALKACTIONS TIME
Add in data/talkactions/scripts/checkpvpenfofrags.lua:
Lua:
function onSay(player, words, param)
    if player:getStorageValue(STORAGE_PVPFRAGS) < 1 then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You currently have no frags.")
    elseif player:getStorageValue(STORAGE_PVPFRAGS) == 1 then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You currently have 1 frag.")
    else
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You currently have ".. player:getStorageValue(STORAGE_PVPFRAGS) .." frags.")
    end
    return true
end

Add in data/talkactions/talkactions.xml:
XML:
<talkaction words="!frags" script="checkpvpenfofrags.lua" />


And of course in config.lua you must set the WorldType to PVP-Enforced.
That's mostly all from the LUA part.

And for future LUA script making, you have almost all functions that exist in TFS'es 1.X, here:
LUA Functions List [TFS 1.0] Updated: 17/09/2014
i killed someone no skull appeared when i used !frags
that comes
Code:
16:16 You currently have no frags.
16:16 Amr [441]: !frags
 
Back
Top