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

Military rang & skull system

GOD Kubus

New Member
Joined
Dec 23, 2012
Messages
60
Reaction score
0
I create it... I have 1 problem if have 3 drags have skull good. If go 3 frags and die dont have skull...
Have 7 frags have next skull if 8 and log skull expiried... Etc
Code:
<?xml version = "1.0" encoding = "UTF-8"?>
<mod name = "Military Ranks" version = "1.0" author = "Teckman" enabled = "yes">
<config name = "ranks"><![CDATA[
titles = {
[2] = "Bronze Rang",
[6] = "Silver Rang",
[10] = "Gold Rang",
[13] = "Platinum Rang",
[16] = "Diamond Rang",
}
fragsStorage = 600
]]></config>
<event type = "look" name = "ranksLook" event = "script"><![CDATA[

domodlib("ranks")
function onLook(cid, thing, position, lookDistance)
if(isPlayer(thing.uid)) then
local rank = {rank = "Private", frags = 0}
for k, v in pairs(titles) do
if(math.max(0, getPlayerStorageValue(thing.uid, fragsStorage) or 0) > k - 1) then
if(k - 1 > rank.frags) then
rank.rank, rank.frags = v, k - 1
end
end
end
if (getPlayerStorageValue(thing.uid, fragsStorage)+1)==0 then
doPlayerSetSpecialDescription(thing.uid, "\n Military rank: " .. rank.rank .. " Frags: 0")
else
doPlayerSetSpecialDescription(thing.uid, "\n Military rank: " .. rank.rank .. " Frags: " ..getPlayerStorageValue(thing.uid, fragsStorage)+1)
end



end
return true


end
]]></event>
<event type = "kill" name = "ranksKill" event = "script"><![CDATA[
domodlib("ranks")
function onKill(cid, target)
if(isPlayer(target)) then
setPlayerStorageValue(cid, fragsStorage, math.max(0, (getPlayerStorageValue(cid, fragsStorage) or 0)) + 1)
if(titles[getPlayerStorageValue(cid, fragsStorage)]) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You advanced to military rank: " .. titles[getPlayerStorageValue(cid, fragsStorage)] .. ". Congratulations " .. titles[getPlayerStorageValue(cid, fragsStorage)] .. "!")
if(titles[getPlayerStorageValue(cid, fragsStorage)]== "Bronze Rang") then
doCreatureSetSkullType(cid, 1)
end
if(titles[getPlayerStorageValue(cid, fragsStorage)]== "Silver Rang") then
doCreatureSetSkullType(cid, 2)
end
if(titles[getPlayerStorageValue(cid, fragsStorage)]== "Gold Rang") then
doCreatureSetSkullType(cid, 3)
end
if(titles[getPlayerStorageValue(cid, fragsStorage)]== "Platinum Rang") then
doCreatureSetSkullType(cid, 4)
end
if(titles[getPlayerStorageValue(cid, fragsStorage)]== "Diamond Rang") then
doCreatureSetSkullType(cid, 5)
end
end
end
return true
end
]]></event>

<event type = "login" name = "ranksLogin" event = "script"><![CDATA[
function onLogin(cid)
registerCreatureEvent(cid, "ranksKill")
registerCreatureEvent(cid, "ranksLook")
if(titles[getPlayerStorageValue(cid, fragsStorage)]== "Bronze Rang") then
doCreatureSetSkullType(cid, 1)
end
if(titles[getPlayerStorageValue(cid, fragsStorage)]== "Silver Rang") then
doCreatureSetSkullType(cid, 2)
end
if(titles[getPlayerStorageValue(cid, fragsStorage)]== "Gold Rang") then
doCreatureSetSkullType(cid, 3)
end
if(titles[getPlayerStorageValue(cid, fragsStorage)]== "Platinum Rang") then
doCreatureSetSkullType(cid, 4)
end
if(titles[getPlayerStorageValue(cid, fragsStorage)]== "Diamond Rang") then
doCreatureSetSkullType(cid, 5)
end
return true
end

]]></event>

</mod>
 
Hmm i make it... and works well if the player clicks on each other... How change it... To work if Login
Code:
<?xml version = "1.0" encoding = "UTF-8"?>
    <mod name = "Military Ranks" version = "1.0" author = "Teckman" enabled = "yes">
        <config name = "ranks"><![CDATA[
            titles = {
                [3] = "Bronze Rang",
                [6] = "Silver Rang",
                [8] = "Gold Rang",
                [10] = "Platinum Rang",
                [11] = "Diamond Rang",
            }
            fragsStorage = 600
        ]]></config>
        <event type = "look" name = "ranksLook" event = "script"><![CDATA[
           
            domodlib("ranks")
            function onLook(cid, thing, position, lookDistance)
                if(isPlayer(thing.uid)) then
                    local rank = {rank = "Private", frags = 0}
                    for k, v in pairs(titles) do
                        if(math.max(0, getPlayerStorageValue(thing.uid, fragsStorage) or 0) > k - 1) then
                            if(k - 1 > rank.frags) then
                                rank.rank, rank.frags = v, k - 1
                            end
                        end
                    end
                    if (getPlayerStorageValue(thing.uid, fragsStorage)+1)==0 then
                    doPlayerSetSpecialDescription(thing.uid, "\n Military rank: " .. rank.rank .. " Frags: 0")
                    else
                    doPlayerSetSpecialDescription(thing.uid, "\n Military rank: " .. rank.rank .. " Frags: " ..getPlayerStorageValue(thing.uid, fragsStorage)+1)
                    end
                    if(rank.rank== "Bronze Rang") then
                            doCreatureSetSkullType(cid, 1)
                            end
                        if(rank.rank== "Silver Rang") then
                            doCreatureSetSkullType(cid, 2)
                            end
                        if(rank.rank== "Gold Rang") then
                            doCreatureSetSkullType(cid, 3)
                            end
                        if(rank.rank== "Platinum Rang") then
                            doCreatureSetSkullType(cid, 4)
                            end
                        if(rank.rank== "Diamond Rang") then
                            doCreatureSetSkullType(cid, 5)
                            end
                   
                   
                end
                return true


            end
        ]]></event>
        <event type = "kill" name = "ranksKill" event = "script"><![CDATA[
            domodlib("ranks")
            function onKill(cid, target)
                if(isPlayer(target)) then
                    setPlayerStorageValue(cid, fragsStorage, math.max(0, (getPlayerStorageValue(cid, fragsStorage) or 0)) + 1)
                    if(titles[getPlayerStorageValue(cid, fragsStorage)]) then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You advanced to military rank: " .. titles[getPlayerStorageValue(cid, fragsStorage)] .. ". Congratulations " .. titles[getPlayerStorageValue(cid, fragsStorage)] .. "!")
                        if(titles[getPlayerStorageValue(cid, fragsStorage)]== "Bronze Rang") then
                            doCreatureSetSkullType(cid, 1)
                            end
                        if(titles[getPlayerStorageValue(cid, fragsStorage)]== "Silver Rang") then
                            doCreatureSetSkullType(cid, 2)
                            end
                        if(titles[getPlayerStorageValue(cid, fragsStorage)]== "Gold Rang") then
                            doCreatureSetSkullType(cid, 3)
                            end
                        if(titles[getPlayerStorageValue(cid, fragsStorage)]== "Platinum Rang") then
                            doCreatureSetSkullType(cid, 4)
                            end
                        if(titles[getPlayerStorageValue(cid, fragsStorage)]== "Diamond Rang") then
                            doCreatureSetSkullType(cid, 5)
                            end
                    end
                end
                return true
            end
        ]]></event>

        <event type = "login" name = "ranksLogin" event = "script"><![CDATA[
            function onLogin(cid)
                registerCreatureEvent(cid, "ranksKill")
                registerCreatureEvent(cid, "ranksLook")
               
                return true
            end
           
        ]]></event>
       
    </mod>
 
Last edited:
Back
Top