Jump to content

Não está setando o Data no player


Recommended Posts

addEvent("progress", true)
addEventHandler("progress", getRootElement(), function(client)
	if (db) then
		local Drogas = getElementData(client, "Drogas") or 0
		setElementFrozen(client, true)
		setPedAnimation(client, ajuste.animation.animList, ajuste.animation.animDance, ajuste.animation.timePlant, true, false, false, false)
		outputChatBox(ajuste.texts.plant, client, 255, 255, 255, true) 
		setTimer(function()
			setElementData(client, "Drogas",getElementData(client, "Drogas") +10)
			outputChatBox(ajuste.textos.plantarEnd, client, 255, 255, 255, true)
			--dbFree(dbQuery(db, "INSERT INTO plantacao (ID, nick, marker_id) VALUES (?, ?, ?) ", getElementData(client, "ID"), getPlayerName(client), tonumber(markerTraf), 0))
		end,30000, 1)
		setTimer (setElementFrozen, 30000, 1, client, false)
	end
end)

Um script de drogas simples. Porém não da a droga ao jogador, erro no debugscript: ERROR: [DrogaSys]Server.Lua:9: attempt to perfom arithmetic on a boolean value

Link to comment
On 24/06/2020 at 17:15, Deniel said:

addEvent("progress", true)
addEventHandler("progress", getRootElement(), function(client)
	if (db) then
		local Drogas = getElementData(client, "Drogas") or 0
		setElementFrozen(client, true)
		setPedAnimation(client, ajuste.animation.animList, ajuste.animation.animDance, ajuste.animation.timePlant, true, false, false, false)
		outputChatBox(ajuste.texts.plant, client, 255, 255, 255, true) 
		setTimer(function()
			setElementData(client, "Drogas",getElementData(client, "Drogas") +10)
			outputChatBox(ajuste.textos.plantarEnd, client, 255, 255, 255, true)
			--dbFree(dbQuery(db, "INSERT INTO plantacao (ID, nick, marker_id) VALUES (?, ?, ?) ", getElementData(client, "ID"), getPlayerName(client), tonumber(markerTraf), 0))
		end,30000, 1)
		setTimer (setElementFrozen, 30000, 1, client, false)
	end
end)

Um script de drogas simples. Porém não da a droga ao jogador, erro no debugscript: ERROR: [DrogaSys]Server.Lua:9: attempt to perfom arithmetic on a boolean value

addEvent("progress", true)
addEventHandler("progress", getRootElement(), function(client)
	if (db) then
		local Drogas = getElementData(client, "Drogas") or 0
		setElementFrozen(client, true)
		setPedAnimation(client, ajuste.animation.animList, ajuste.animation.animDance, ajuste.animation.timePlant, true, false, false, false)
		outputChatBox(ajuste.texts.plant, client, 255, 255, 255, true) 
		setTimer(function()
			setElementData(client, "Drogas", Drogas+10)
			outputChatBox(ajuste.textos.plantarEnd, client, 255, 255, 255, true)
			--dbFree(dbQuery(db, "INSERT INTO plantacao (ID, nick, marker_id) VALUES (?, ?, ?) ", getElementData(client, "ID"), getPlayerName(client), tonumber(markerTraf), 0))
		end,30000, 1)
		setTimer (setElementFrozen, 30000, 1, client, false)
	end
end)

 

 

On 25/06/2020 at 23:40, DNL291 said:

Troque 'getElementData(client, "Drogas")'  por Drogas na linha 9

não vi que tinha o respondido, perdão : )

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...