Jump to content

bad argument giveweapon


Recommended Posts

Posted (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 by Guest
Posted

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) 
  

Posted
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?

Posted

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

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