local t = {
temple = {x= , y= , z= },
prize = 2160, -- item id
prizeN = "", -- name of prize
amount = 1, -- how many
storage = 5890,
gStorage = 10050,
count = 0
}
function onStepIn(cid, item, position, fromPosition)
local v = t.tiles[item.uid]
if getPlayerStorageValue(cid, t.storage) == 1 and getGlobalStorageValue(cid, t.gStorage) ~= 5 then
t.count++
setPlayerStorageValue(cid, t.storage, 2)
setGlobalStorageValue(cid, t.gStorage, 5)
doPlayerSendTextMessage(cid, 19, "Congratulations! Youve won the race! Youve been awarded with "..t.amount.." "..t.prizeN.."!")
doPlayerAddItem(cid, t.prize, t.amount)
doTeleportThing(cid, t.temple)
else
t.count++
doPlayerSendTextMessage(cid, 19, "Sorry you lost the race")
doTeleportThing(cid, t.temple)
end
if count >= 5 then
setGlobalStorageValue(cid, t.gStorage, 0)
end
return true
end