Postado Novembro 17, 2017 7 anos Autor Em 17/11/2017 em 19:35, luanluciano93 disse: -- <talkaction words="!test" script="teste.lua" /> function onSay(player, words, param) local resultId = db.storeQuery("SELECT `player_id`,`sid`, CONVERT(`attributes` USING latin1) AS `attr` FROM `player_items` WHERE CONVERT(`attributes` USING latin1) LIKE '%timerOnExp%'") if resultId then repeat local attr = result.getStream(resultId, "attr") local timerOnExp = tonumber(string.sub(attr, 25, 34)) if os.time() >= timerOnExp then local player_id = result.getNumber(resultId, "player_id") local sid = result.getNumber(resultId, "sid") db.query("DELETE FROM `player_items` WHERE `player_id`=".. player_id .." AND `sid` = ".. sid) print("deleted!") end until not result.next(resultId) end return false end now dont have error in console but dont delete items He should have eliminated those 3 items, but they are not deleted
Postado Novembro 17, 2017 7 anos function onSay(player, words, param) local resultId = db.storeQuery("SELECT `player_id`,`sid`, CONVERT(`attributes` USING latin1) AS `attr` FROM `player_items` WHERE CONVERT(`attributes` USING latin1) LIKE '%timerOnExp%'") if resultId then repeat local attr = result.getStream(resultId, "attr") local timerOnExp = tonumber(string.sub(attr, 25, 34)) if timerOnExp then if os.time() >= timerOnExp then print(os.time() .." >= .. "timerOnExp) local player_id = result.getNumber(resultId, "player_id") local sid = result.getNumber(resultId, "sid") db.query("DELETE FROM `player_items` WHERE `player_id`=".. player_id .." AND `sid` = ".. sid) end end until not result.next(resultId) end return false end STYLLER OT 2022
Postado Novembro 17, 2017 7 anos Autor Em 17/11/2017 em 19:51, luanluciano93 disse: function onSay(player, words, param) local resultId = db.storeQuery("SELECT `player_id`,`sid`, CONVERT(`attributes` USING latin1) AS `attr` FROM `player_items` WHERE CONVERT(`attributes` USING latin1) LIKE '%timerOnExp%'") if resultId then repeat local attr = result.getStream(resultId, "attr") local timerOnExp = tonumber(string.sub(attr, 25, 34)) if timerOnExp then if os.time() >= timerOnExp then print(os.time() .." >= .. "timerOnExp) local player_id = result.getNumber(resultId, "player_id") local sid = result.getNumber(resultId, "sid") db.query("DELETE FROM `player_items` WHERE `player_id`=".. player_id .." AND `sid` = ".. sid) end end until not result.next(resultId) end return false end Can not load script: lua:9 ')' expected near 'timerOnExp' try to execute the following command directly in the database with the online player: DELETE FROM `player_items` WHERE `player_id`=196 AND `sid` = 107 and it is not eliminated. I think the same thing happens as when you try to change a player's value, if it is online there is no effect. Can you think of an idea? Editado Novembro 17, 2017 7 anos por BennyDz (veja o histórico de edições)
Postado Novembro 17, 2017 7 anos Change: print(os.time() .." >= .. "timerOnExp) for: print(os.time() .." >= ".. timerOnExp) Em 17/11/2017 em 19:58, BennyDz disse: try to execute the following command directly in the database with the online player: DELETE FROM `player_items` WHERE `player_id`=196 AND `sid` = 107 and it is not eliminated. I think the same thing happens as when you try to change a player's value, if it is online there is no effect. Can you think of an idea? Are you going to use this script? onLogin? I think if this is it, the player will be offline on verification. Editado Novembro 17, 2017 7 anos por luanluciano93 (veja o histórico de edições) STYLLER OT 2022
Postado Novembro 17, 2017 7 anos Autor Em 17/11/2017 em 20:05, luanluciano93 disse: Change: print(os.time() .." >= .. "timerOnExp) for: print(os.time() .." >= ".. timerOnExp) Are you going to use this script? onLogin? I think if this is it, the player will be offline on verification. R= I had thought to use it in a globalevent. I think the best option would be to use it in OnStartUp, and create another onlogin script, that verifies items on players online, with addEvent (checkitems, 2000) to check the slots and the items inside the backpack Editado Novembro 17, 2017 7 anos por BennyDz (veja o histórico de edições)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.