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

TFS 1.0 Event script onlook show frags

vingo

Active Member
Joined
Oct 27, 2012
Messages
464
Reaction score
43
Like the title says can someone make me a script that shows how many frags I have and deaths and the same when I look at other people?


Thanks
 
Code:
<?xml version = "1.0" encoding = "UTF-8"?>
<mod name = "Military Ranks" version = "1.0" author = "Teckman" enabled = "yes">
<config name = "ranks"><![CDATA[
titles = {
[1] = "1",
[2] = "2",
[3] = "3",
[4] = "4",
[5] = "5",
[6] = "6",
[7] = "7",
[8] = "8",
[9] = "9",
[10] = "10",
[11] = "11",
[12] = "12",
[13] = "13",
[14] = "14",
[15] = "15",
[16] = "16",
[17] = "17",
[18] = "18",
[19] = "19",
[20] = "20",
[21] = "21",
[22] = "22"
}
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 = "0", frags = 0}
for k, v in pairs(titles) do
if(math.max(0, getPlayerStorageValue(thing.uid, fragsStorage)) > k - 1) then
if(k - 1 > rank.frags) then
rank.rank, rank.frags = v, k - 1
end
end
end
doPlayerSetSpecialDescription(thing.uid, "\n Frags: " .. rank.rank)
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) + 1))
if(titles[getPlayerStorageValue(cid, fragsStorage)]) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, " You now have: " .. titles[getPlayerStorageValue(cid, fragsStorage)] .. " frags!")
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>

I just edited some text to show frags instead of ranks , if you want to show more frags just add more lines.
(i'm sure this can be done in other way but I don't know how to script)

official thread is here: http://otland.net/threads/teckmans-military-ranks.140087/
 
He is asking for one for tfs 1.0.
1.0 Doesn't have mods...
And onLook isn't in creaturescripts anymore either now its in events.... I would like to see someone who has this done in 1.0 also so I can see how its done....
 
Back
Top