Jump to content

[RESOLVED] triggerServerEvent


Tommy.

Recommended Posts

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

Posted
2 minutes ago, <~KaMiKaZe~> said:

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

the same error continued

Posted
10 minutes ago, Tommy. said:

the same error continued

you put a variable for everything? If you don´t show all the code, we can´t help you

Posted
Just now, <~KaMiKaZe~> said:

you put a variable for everything? If you don´t show all the code, we can´t help you

I had put the wrong code, This one I put is the current one.

RESOLVED


Posted
6 minutes ago, <~KaMiKaZe~> said:

 

I recommend removing the "or" and doing it in different functions because sometimes the "if" does not detect it

OK I will do it.
Thank you bro!

Posted
1 hour ago, <~KaMiKaZe~> said:

 

I recommend removing the "or" and doing it in different functions because sometimes the "if" does not detect it

In what situation would it not detect it? I can't think of a single case where it happens.

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