I need to spend a replacement weapon when a player picks it up with weapon_NAME to weapone_NAME1.
How to do it?
Why? What are you trying to do?
Surely it should be possible for you to simply rename NAME1 weapon to NAME?
[QUOTE=Robotboy655;47316085]Why? What are you trying to do?
Surely it should be possible for you to simply rename NAME1 weapon to NAME?[/QUOTE]
You got me wrong. I need to take away their arms and give him another.
so change the model?
[editline]13th March 2015[/editline]
or when player picks up weapon_NAME hes given weapon_NAME1
[QUOTE=giraff163;47316095]You got me wrong. I need to take away their arms and give him another.[/QUOTE]
I think I understand what you need :v:
[url]http://wiki.garrysmod.com/page/GM/PlayerCanPickupWeapon[/url]
or
[url]http://wiki.garrysmod.com/page/GM/WeaponEquip[/url]
and
[url]http://wiki.garrysmod.com/page/Entity/GetClass[/url]
[QUOTE=Hoffa1337;47316209]I think I understand what you need :v:
[url]http://wiki.garrysmod.com/page/GM/PlayerCanPickupWeapon[/url]
or
[url]http://wiki.garrysmod.com/page/GM/WeaponEquip[/url]
and
[url]http://wiki.garrysmod.com/page/Entity/GetClass[/url][/QUOTE]
I do not understand how to determine whether he had a weapon
[QUOTE=Hoffa1337;47316802][url]http://wiki.garrysmod.com/page/Player/GetActiveWeapon[/url][/QUOTE]
[lua]
concommand.Add("weapon", function( ply )
if ply:GetActiveWeapon("weapon_weapon1"):GetClass() then
ply:StripWeapons("weapon_weapon1")
ply:Give("weapon_weapon2")
end
end)[/lua]
[ERROR] lua/autorun/client/weapon.lua:3: attempt to call method 'StripWeapons' (a nil value)
1. unknown - lua/autorun/client/weapon.lua:3
2. unknown - lua/includes/modules/concommand.lua:54
That function can only be ran on the server. It appears you're trying to run it on the client.
[QUOTE=Jeezy;47322192]That function can only be ran on the server. It appears you're trying to run it on the client.[/QUOTE]
This.
And to run serverside code on a client you must use networking. Its on the wiki if you need it.
Sorry, you need to Log In to post a reply to this thread.