Lormateve Posted September 17, 2018 Share Posted September 17, 2018 My question is how to send a data to the server in a personal way with the client, that is, without including all the clients. Client side function AAB (pia) triggerServerEvent ("KnowAmount", getLocalPlayer(), pia ) end --====================================================================== Server Side function KnowAmountFunction (pia) outputChatBox ("AA") -- This show ALL Client, and that's what I want to avoid if (pia == 1) then PasajENP = PasajENP_a1 -- This change for all players, and it should not be like that triggerClientEvent (client, "GotoClient", resourceRoot, PasajENP ) end end addEvent( "KnowAmount", true ) addEventHandler( "KnowAmount", getRootElement(), KnowAmountFunction ) Link to comment
Gordon_G Posted September 17, 2018 Share Posted September 17, 2018 Yeah, outputChatBox is showing for every client because you have to put the player argument after the string. Take a look : outputChatBox 1 Link to comment
Lormateve Posted September 17, 2018 Author Share Posted September 17, 2018 27 minutes ago, Gordon_G said: Yeah, outputChatBox is showing for every client because you have to put the player argument after the string. Take a look : outputChatBox It's absolutely right, but it's not what I really need, what I wonder is how to make the condition only direct the player who started the trigger? That is to say that PasajENP = PasajENP_a1 is changed only to a player, do you understand? Link to comment
Simple. Posted September 17, 2018 Share Posted September 17, 2018 hmmmm maybe like this ? local PasajENP = {} function KnowAmountFunction (pia) outputChatBox ("AA") -- This show ALL Client, and that's what I want to avoid if (pia == 1) then PasajENP[client] = PasajENP_a1 triggerClientEvent (client, "GotoClient", resourceRoot, PasajENP[client] ) end end addEvent( "KnowAmount", true ) addEventHandler( "KnowAmount", getRootElement(), KnowAmountFunction ) this way you can make var for each player 1 Link to comment
JeViCo Posted September 17, 2018 Share Posted September 17, 2018 (edited) client variable = the client that called the event (wiki) source variable = the element you defined in triggerServerEvent after event name Try to use player element (source) instead of client element local PasajENP = {} function KnowAmountFunction (pia) outputChatBox ("AA",source) -- it will send to player who triggered this event if (pia == 1) then PasajENP[source] = PasajENP_a1 triggerClientEvent (source, "GotoClient", source, PasajENP[source] ) end end addEvent( "KnowAmount", true ) addEventHandler( "KnowAmount", getRootElement(), KnowAmountFunction ) @Lormateve Edited September 17, 2018 by JeViCo 2 Link to comment
Lormateve Posted September 17, 2018 Author Share Posted September 17, 2018 11 hours ago, Simple. said: hmmmm maybe like this ? local PasajENP = {} function KnowAmountFunction (pia) outputChatBox ("AA") -- This show ALL Client, and that's what I want to avoid if (pia == 1) then PasajENP[client] = PasajENP_a1 triggerClientEvent (client, "GotoClient", resourceRoot, PasajENP[client] ) end end addEvent( "KnowAmount", true ) addEventHandler( "KnowAmount", getRootElement(), KnowAmountFunction ) this way you can make var for each player From what I could see, it's working perfectly, thank you very much I ended up using the source instead of the client, thanks to everyone! 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now