Ir para conteúdo

Featured Replies

Postado
-- <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 `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 sid = result.getNumber(resultId, "sid")
				db.storeQuery("DELETE FROM `player_items` WHERE `sid` = ".. sid)
				print("deleted!")
			end
		until not result.next(resultId)
	end
	return false
end

 

Editado por luanluciano93 (veja o histórico de edições)

  • 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
  • Autor
9 minutos atrás, luanluciano93 disse:

-- <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 `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 sid = result.getNumber(resultId, "sid")
            	db.storeQuery("DELETE FROM `player_items` WHERE `sid` = ".. sid)
				print("deleted!")
			end
		until not result.next(resultId)
	end
	return false
end

 

 

image.png

 

only delete if the player is not connected

Postado
-- <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.storeQuery("DELETE FROM `player_items` WHERE `player_id`=".. player_id .." AND `sid` = ".. sid)
				print("deleted!")
			end
		until not result.next(resultId)
	end
	return false
end

 

Postado
  • Autor
10 minutos atrás, 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.storeQuery("DELETE FROM `player_items` WHERE `player_id`=".. player_id .." AND `sid` = ".. sid)
				print("deleted!")
			end
		until not result.next(resultId)
	end
	return false
end

 

same result only delete for players not connected

 

image.png

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

 

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