Ir para conteúdo

Featured Replies

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

image.png

He should have eliminated those 3 items, but they are not deleted

  • Respostas 23
  • Visualizações 1.6k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • luanluciano93
    luanluciano93

    -- <talkaction words="!test" script="teste.lua" /> function onSay(player, words, param) local resultId = db.storeQuery("SELECT `player_id`,`pid`,`sid`,CONVERT(`attributes` USING latin1) AS `at

  • luanluciano93
    luanluciano93

    -- <talkaction words="!test" script="teste.lua" /> function onSay(player, words, param) local resultId = db.storeQuery("SELECT `player_id`,`pid`,`sid`,CONVERT(`attributes` USING latin1) AS `at

  • luanluciano93
    luanluciano93

    -- <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` F

Postado
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

 

Postado
  • 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 por BennyDz (veja o histórico de edições)

Postado

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 por luanluciano93 (veja o histórico de edições)

Postado
  • Autor
  Em 17/11/2017 em 20:05, luanluciano93 disse:

Change: print(os.time() .." >= .. "timerOnExp)
for:  print(os.time() .." >= ".. timerOnExp)

image.png

 

 

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 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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo