Kod:
function onKill(cid, target)
local player = cid
local storageValue = getPlayerStorageValue(cid,5600001)
local hunting = getPlayerStorageValue(cid, 5600001) + 1
local huntingg = getPlayerStorageValue(cid, 5600002) + 1
-- If storageValue is nil, set it to 0
if storageValue == -1 then
getPlayerStorageValue(cid, 5600001)
storageValue = 0
end
-- Check if the target is a monster and increment the storage value by 1 if true
if isMonster(target) then
setPlayerStorageValue(cid, 5600001, hunting)
local lotto2 = math.random(0,100000)
--print (lotto2)
if lotto2 >= 99000 then
doCreateItem(2157, 1, getPlayerPosition(target))
doSendMagicEffect(getPlayerPosition(target), 30)
doSendAnimatedText(getPlayerPosition(target), "~TOKEN~", TEXTCOLOR_YELLOW)
end
--doPlayerSendTextMessage(cid,22,"Congratulations, you have killed 1 monster!")
end
-- If the player has killed 100 monsters, execute the code
if (storageValue + 1) % 250 == 0 then
-- Your code goes here
-- player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations, you have killed 250 monsters!")
local lotto = math.random(0,15)
--print(lotto)
--doPlayerSendTextMessage(cid,22,"Congratulations, you have killed 250 monsters!")
if lotto <= 0 then
doCreateItem(7141, 1, getPlayerPosition(cid))
doPlayerSendTextMessage(cid,22,"You found something during your hunt.")
setPlayerStorageValue(cid, 5600002, huntingg)
doSendMagicEffect(getPlayerPosition(cid), 27)
doSendAnimatedText(getPlayerPosition(cid), "WEAPONBOX", TEXTCOLOR_YELLOW)
end
-- reset
setPlayerStorageValue(cid, 5600001, 0)
end
return true
end
Zakładki