Jump to content

TriggerClientEvent just for one player


TheCapn

Recommended Posts

Hello guys,

I would like to trigger an client event only for on player, but actually when I trigger it, it triggers for every one.

Here's my code

  
function loginHandler(username, password) 
... 
triggerClientEvent(getRootElement(), "onBan", getRootElement(), banauthor, banreason, bantime) 
... 
end 
  

Username and password are only strings.

Regards,

Link to comment
  • Discord Moderators

You are using getRootElement() instead of the pointer to the player. Are you calling this function from a client call or are you using the onPlayerLogin event? In the first case you should use "client" (source isn't safe enough) and in the second case you should use "source". So these are the two possibilities:

triggerClientEvent(client, "onBan", getRootElement(), banauthor, banreason, bantime) 

or

triggerClientEvent(source, "onBan", getRootElement(), banauthor, banreason, bantime) 

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