toxicsmoke11 Posted August 21, 2014 Share Posted August 21, 2014 (edited) client side script triggerServerEvent("onColtRequest",localPlayer) server script function coltSend(thePlayer) giveWeapon(thePlayer,22,200) end addEvent("onColtRequest",true) addEventHandler("onColtRequest",root,coltSend) how do i fix this stupid problem? oh and yeah i just want this to send weapon to one player,not everyone but i have no idea how to fukin do this because everything is too hard Edited August 21, 2014 by Guest Link to comment
Castillo Posted August 21, 2014 Share Posted August 21, 2014 function coltSend(client) Remove 'client' from there. Link to comment
toxicsmoke11 Posted August 21, 2014 Author Share Posted August 21, 2014 ok thanks but is this gonna give colt 45 to every single player or just the one who triggered event?(while using client as player element) Link to comment
Castillo Posted August 21, 2014 Share Posted August 21, 2014 Just the one who triggered the event. Link to comment
Et-win Posted August 21, 2014 Share Posted August 21, 2014 For no one it will work, because 'thePlayer' is not defined. Change it to 'source' to give only the player who triggered a weapon: function coltSend() giveWeapon(source,22,200) end addEvent("onColtRequest",true) addEventHandler("onColtRequest",root,coltSend) Link to comment
Castillo Posted August 21, 2014 Share Posted August 21, 2014 Ah, he edited the script, the original was using 'client' which is also a pre-defined variable like 'source' when triggering events. Link to comment
Et-win Posted August 21, 2014 Share Posted August 21, 2014 Ah, he edited the script, the original was using 'client' which is also a pre-defined variable like 'source' when triggering events. Yes, I understood out of the Wiki that 'client' has to be used instead of 'source' because it's safer? Link to comment
Castillo Posted August 21, 2014 Share Posted August 21, 2014 That's what I read aswell, so I guess is safer. Link to comment
toxicsmoke11 Posted August 22, 2014 Author Share Posted August 22, 2014 i forgot to re-re-edit my topic,sorry i was using client and it worked out but i was confused whether it would give the gun to everybody or just that 1 player who triggered event because of: The client class represents any client that is connected to the server. anyway thanks guys it works 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