Jump to content

Cancelar triggeEvent


Recommended Posts

Gente como faço para cancelar um trigger client? Esse script vai fazer com que quando o jogador entre no veículo apareça a mensagem que eu fiz no client, QUAL o script para quando ele sair do veículo eu cancelo esse trigger?

function entrouv (thePlayer, seat, jacked)
    triggerClientEvent(thePlayer, "PCinto", thePlayer)
end
addEventHandler ( "onVehicleEnter", getRootElement(), entrouv )

(QUERO O SCRIPT PARA CANCELAR ESSE TRIGGER OU ME ENCINAREM, por favor.

Link to comment

Client-Side:

function Dxcinto()
        dxDrawText("Oi", screenW * 0.3873, screenH * 0.8060, screenW * 0.6186, screenH * 0.8503, tocolor(254, 209, 0, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false)
    end

function Pcinto ()
    if getElementData(client, "Cinto") == false then
    addEventHandler("onClientRender", root, Dxcinto)
elseif getElementData(client,"Cinto") == true then
    removeEventHandler("onClientRender", root, Dxcinto)
end
end
addEvent("PCinto", true)
addEventHandler("PCinto", root, Pcinto)

Fiz assim e não funcionou, oq falta?+

Link to comment

client é uma variável predefinida que só é usada no lado server.

Tente isto:

function Dxcinto()
	dxDrawText("Oi", screenW * 0.3873, screenH * 0.8060, screenW * 0.6186, screenH * 0.8503, tocolor(254, 209, 0, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false)
end

function Pcinto (bool)
	if bool and getElementData(source, "Cinto") == false then
		if dxVisivle ~= true then
			addEventHandler("onClientRender", root, Dxcinto)
			dxVisivle = true
		end
	elseif bool ~= true and getElementData(source,"Cinto") then
		if dxVisivle then
			removeEventHandler("onClientRender", root, Dxcinto)
			dxVisivle = false
		end
	end
end
addEvent("PCinto", true)
addEventHandler("PCinto", root, Pcinto)

Server:

function entrouv (thePlayer, seat, jacked)
	triggerClientEvent(thePlayer, "PCinto", thePlayer, eventName == "onVehicleEnter")
end
addEventHandler ( "onVehicleEnter", getRootElement(), entrouv )
addEventHandler ( "onVehicleExit", getRootElement(), entrouv )

 

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