--your code
local function storage(cid)
setplayerstoragevalue(cid, 1000, -1) -- or 0
return true
end
addevent(storage, 10000) -- 1000 = 1 sec
return true
end -- writed in browser.
No it wont cuz function wont get an argument, that will work.
LUA:addEvent(setPlayerStorageValue, 1000, cid, 1000, -1) -- calback to function, delay (in ms), callback fun arguments...
No it won't.my post will work...
exhaustion.set(cid, storage, time)
exhaustion.check(cid, storage)
exhaustion.set(cid, 12345, 60)
if exhaustion.check(cid, 12345) then
...etc
if not exhaustion.check(cid, 12345) then
...etc
setPlayerStorageValue(cid, 1031, 1)
addEvent(storage,60000*3,cid) -- 3 min
function storage(cid)
setPlayerStorageValue(cid, 1031, 0)
end
addEvent(db.executeQuery, 60000*3, "UPDATE `player_storage` SET `key` = 1031, `value` = -1 WHERE `player_id` = " .. guid .. " LIMIT 1;")
------Functions------------
local storage = 1033333
local function storage(cid)
setPlayerStorageValue(cid, storage, -1) -- or 0
return true
end
----------Script-----------------
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = getCreaturePostion(cid)
if getPlayerStorageValue(cid, storage) == -1 then
doCreatureAddHealth(cid, math.random(10,30))
setPlayerStorageValue(cid, storage, 1)
doSendMagicEffect(pos, 12)
addEvent(storage, 10000, cid)
else
doPlayerSendCancel(cid, "Wait 10 sec...")
end
return true
end
------Functions------------
local storage = 103333
function deleteStorage(cid)
return isPlayer(cid) and doPlayerSetStorageValue(cid, storage, -1)
end
----------Script-----------------
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, storage) == -1 then
doCreatureAddHealth(cid, math.random(10,30), 65535, 256, true)
doPlayerSetStorageValue(cid, storage, 1)
doSendMagicEffect(fromPosition, 12)
addEvent(deleteStorage, 10000, cid)
else
doPlayerSendCancel(cid, 'Wait 10 sec...')
end
return 1
end