Joriku
Working in the mines, need something?
Trying to rescript an old "Frag Reward" script and running into an error I cannot solve so far.
I changed the storage codes into
the script
I changed the storage codes into
Lua:
p:getStorageValue
the script
Lua:
-- ver. 1.1 2011-12-09
-- author tfs, otland.net/members/andypsylon
local c = {
item = 9020, -- reward itemid
store = 6000, -- storage for Current frags like in login script
tstore = 7000, -- Total Storage value for kills
dstore = 8000, -- Total Storage value for deaths
table = {
{"Smashed!", 189, 1},
{"Dead!", 190, 2},
{"Owned!", 18, 3},
{"Pwnt!", 215, 4}
}
}
function onKill(cid, target)
if(not isPlayer(target)) then return true end
local getStor = p:getStorageValue(cid, c.store)
local rand = math.random(1, #c.table)
local name = getCreatureName(cid)
doCreatureSetStorage(cid, c.store, (getStor + 1))
doCreatureSetStorage(cid, c.tstore, (p:getStorageValue(cid, c.tstore) +1))
doCreatureSetStorage(target, c.dstore, (p:getStorageValue(cid, c.dstore) + 1))
doSendAnimatedText(getThingPosition(target), c.table[rand][1], c.table[rand][2])
doPlayerAddItem(cid, c.item, c.table[rand][3])
if(getStor == 5) then
doBroadcastMessage(name .. " is on killing spree! He killed 5 players!")
elseif(getStor == 10) then
doBroadcastMessage(name .. " is dominating! He killed 10 players!")
elseif(getStor == 25) then
doBroadcastMessage(name .. " is CRAZY! He killed 25 players!")
elseif(getStor == 50) then
doBroadcastMessage(name .. " is UNSTOPPABLE!! He killed 50 players! DO SOMETHING!")
elseif(getStor == 100) then
doBroadcastMessage("Bow down to your new god "..name.." has 100 frags!")
end
return true
end