Jump to content

[RESOLVED] triggerServerEvent


Tommy.

Recommended Posts

2 minutes ago, Tommy. said:

I NEED URGENT HELP !!!


CLIENT-SIDE:
function dev_Giroflex (_,state)
    if var_Giroflex == true then
        if state == "down" then
            if isCursorOnElement (x*502, y*421, x*152, y*38) then
               triggerServerEvent ( "desligar_Giroflex", getLocalPlayer()) 
            end
        end
    end
end
addEventHandler ("onClientClick", root, dev_Giroflex)

SERVER-SIDE:
function removeGiroflex(thePlayer, cmd)
	local viatura = getPedOccupiedVehicle(thePlayer)
	killTimer(l_timer[viatura])
	killTimer(l_timer2[viatura])
	killTimer(l_timer3[viatura])
	killTimer(l_timer4[viatura])
	killTimer(l_timer5[viatura])

	setVehicleLightState (viatura, 0, 0)
	setVehicleLightState (viatura, 1, 0)
	setVehicleLightState (viatura, 2, 0)
	setVehicleLightState (viatura, 3, 0)

	light1[viatura] = 0
end
addEvent("desligar_Giroflex",true)
addEventHandler("desligar_Giroflex", root, removeGiroflex)

DEBUGSCRIPT:

oZtdMqG.png

Men, you can´t use "thePlayer" in serverside when you send since clientside. Change "thePlayer" for source or put a variable. ( i recommend you change for source ).

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