FAS 2.0 : Problem Having trouble switching gun with lua

Ok… so I cannot switch the gun’s using GetWeapon(), I can use getweapon on about any-other gun’s and they switch with no problem? No errors or nothing, They just refuse to switch, somtimes they give a occasional holsteranim is nil error?

Sorry if theirs a lack of infomation:/

me dp not spak ur laugagea

Lol I’m just playing. Whats your steam account? It will be easier for you to layout the problem on that.

Very legitimate answer. Lets clap it up for this guy! Haha, anyway anyone else?

Bump anyone.

Why not use _p:SelectWeapon to change via class name?

This is what I did to be able to use the function clientside:


function META_PLAYER:SelectWeapon( _w, _class )
	hook.Call( "PlayerSwitchWeapon", GAMEMODE, self, self:GetActiveWeapon( ), _w );
	networking:SendToServer( "SelectWeapon", _class );
end
	

networking system will be released soon; but it simply sends a message to the server and the server does the same call to switch weapon.


networking:AddReceiver( "SelectWeapon", function( _p, _class )
	_p:SelectWeapon( _class );
end );
	

By using : http://wiki.garrysmod.com/page/GM/PlayerSwitchWeapon on the client, it aides with prediction.

Ive already tried using SetWeapon haha:)

When SelectWeapon is called on the server using the STRING / ClassName of the weapon, ie weapon_css_aug or whatever, then the weapon should switch UNLESS something is restricting it.

Things that can be restricting it are several hooks, or SWEP:Holster function ( which if false means the player can’t put the weapon away ), etc…

http://wiki.garrysmod.com/page/GM/PlayerSwitchWeapon - can restrict weapon switching…

I’m not familiar with FAS base other that having to debug a friends server and finding it the cause of memory leaks.

I do have swep:Holster set to true, and there is no PlayerSwitchWeapon hook:/ FAS Probably has somthing in its base, but im just too dumb and probably overlook it

That would be a GM hook, not part of the SWEP code. What game-mode are you running? Do you use notepad++ or other program that supports searching all *.lua files? Search for the GM hook and see what returns.

Do ALL weapons refuse to switch ( and do they only refuse when you call the function in Lua vs using the weapon selection menu )? If so, there could be an override… For example, my SWEP system allows holstering, and also forces the weapon to be put away before pulling out the next weapon and it uses an override system to accomplish it. It sort of piggy-backs off of the GM Hook the first time around, and recursively calls itself using the override when it is time to switch / pull out the weapon. Something like that may be in place.

The gamemode is Vein, and I’ve did a search but I guess ill try again. Yes I do use notepad++, and all the weapons except fas, melee works, the old guns work etc

Just did it, and it found no matchs?

PlayerSwitchWeapon is a base hook.