Jump to content

passing a player in triggerServerEvent


eSPeZet

Recommended Posts

Hello,

I want to pass the Client-player with the function triggerServerEvent (for example to trigger an event and ONLY the client triggered the event so that ONLY HE would receive a message) and this is how i would do it:

triggerServerEvent("blabla", localPlayer, bla)

But MTA-wiki says the following sentence: Warning: You should use the global variable client serverside instead of passing the localPlayer by parameter or source. Otherwise event faking (passing another player instead of the localPlayer) would be possible. 

So I assume, that I shouldn't do it the way I just posted above, but I have no clue what they mean by this sentence and how else I should do it then..

Could anyone explain this WITH an example?

Edited by eSPeZet
Link to comment

ohhh wow that was simple :D thank you very much :)

I didn't get it cause in the example script it said "the predefined variable 'client' points to the player who triggered the event and should be used due to security issues"

And this made me wonder about how to "predefine" it :D

 

Another question:    HOW can anyone fake an event (in case we passed localPlayer)? How does this work?

Edited by eSPeZet
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...