zxmatzx
Advanced OT User
Hello,
I'm developing a system of daily tasks, which will reset whenever the server starts. In my onStartup I have the following code:
Can i use playerId as cid, in line 5?
To reset player task, i have onLogin check a storage value, if 1 then reset. I set this storage to 1 in line 6. If my first question is Yes the answer, what form should I use? Why?
Thanks for helping.
I'm developing a system of daily tasks, which will reset whenever the server starts. In my onStartup I have the following code:
Lua:
local resultId = db.storeQuery("SELECT * FROM `player_storage` WHERE `key` = "..DAILY_TRASH_STATUS.." AND `value` = 2") --Get all rows with Status = 2
if resultId ~= false then
repeat
local playerId = result.getDataInt(resultId, "player_id") --Get playerId
--Player(playerId):setStorageValue(DAILY_TRASH_SHOULD_RESET, 1)
db.query("UPDATE `player_storage` SET `value` = 1 WHERE `player_id` = " .. playerId .." AND `key` = "..DAILY_TRASH_SHOULD_RESET)
until not result.next(resultId)
result.free(resultId)
end
To reset player task, i have onLogin check a storage value, if 1 then reset. I set this storage to 1 in line 6. If my first question is Yes the answer, what form should I use? Why?
Thanks for helping.