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

Exhaust action

thetabi171

New Member
Joined
Jan 26, 2013
Messages
91
Reaction score
2
Witam. Mam do was pytanie posiadam taki skrypt:

function onUse(cid, item, fromPosition, itemEx, toPosition)
if doPlayerRemoveMoney(cid, 100) then
doPlayerAddItem(cid, 2789, 5)
doCreatureSay(cid, "Otrzymales 5 brown mushrooms za 100 gp", 19)
else
doCreatureSay(cid, "Potrzebujesz 100 gp!!", 19)
end
return true
end




I chciałbym aby dało się kliknąć tylko raz na minute w tabliczkę, moze mnie ktoś nakierować jak to zrobić ?
 
LIB:
function checkExhausted(cid, storage, seconds)
local v = exhaustion.get(cid, storage)
if(not v) then
exhaustion.set(cid, storage, seconds)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Please wait " .. v .. " seconds and trying again.")
return false
end

return true
end


function onUse(cid, item, fromPosition, itemEx, toPosition)
if(not checkExhausted(cid, 103, 60000)) then
return true
end
if doPlayerRemoveMoney(cid, 100) then
doPlayerAddItem(cid, 2789, 5)
doCreatureSay(cid, "Otrzymales 5 brown mushrooms za 100 gp", 19)
else
doCreatureSay(cid, "Potrzebujesz 100 gp!!", 19)
end
return true
end
 
Code:
local exhaust = 140 -- sekundy ;)
local exhausted_storagevalue = 1913 -- storage
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
        doPlayerSendCancel(cid, "Kamienie mozesz kupic raz na "..exhaust.." sekund.")
    else
        if doPlayerRemoveMoney(cid, 100) then
            doPlayerAddItem(cid, 1294, 15)
            doCreatureSay(cid, "Otrzymales 15 Smal Stone za 50 gp", 19)
            setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhaust)
        else
            setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhaust)
            doCreatureSay(cid, "Potrzebujesz 100 gp!!", 19)
        end
    end
return true
end



Zrobiłem to w ten sposób już dawno też chyba dobrze jest.
 
Back
Top