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