• Unable To Select Weapons After Giving Players Them
    4 replies, posted
Title says it all. I spawn with the weapons, but I cannot select any other weapon OTHER then the one I spawned equipped with. [lua]function Assault( ply ) ply:Give( "weapon_smg1" ) ply:GiveAmmo( 60, "smg1" ) ply:Give( "weapon_ar2" ) ply:GiveAmmo( 60, "ar2" ) ply:Give( "weapon_357" ) ply:GiveAmmo( 15, "357" ) end concommand.Add( "class_assault", Assault ) function HeavyWeps( ply ) ply:Give( "weapon_shotgun" ) ply:GiveAmmo( 30, "Buckshot" ) ply:Give( "weapon_frag" ) ply:GiveAmmo( 5, "Grenade" ) ply:Give( "weapon_rpg" ) ply:GiveAmmo( 7, "RPG_Round" ) end concommand.Add( "class_heavy", HeavyWeps ) function Sniper( ply ) ply:Give( "weapon_crossbow" ) ply:GiveAmmo( 20, "XBowBolt" ) ply:Give( "weapon_pistol" ) ply:GiveAmmo( 30, "pistol" ) ply:Give( "weapon_slam" ) ply:GiveAmmo( 10, "slam" ) end concommand.Add( "class_sniper", Sniper ) function SpecOps( ply ) ply:Give( "weapon_smg1" ) ply:GiveAmmo( 100, "smg1" ) ply:Give( "weapon_pistol" ) ply:GiveAmmo( 30, "pistol" ) end concommand.Add( "class_SpecOps", SpecOps )[/lua] This is the code I am using to give player weapons. First of all, I run the console command to spawn the player, then create a timer of about 1 second to let them spawn, THEN I run these dependant on which classes they chose. So they spawn, 1 second later, they get their weapons. It DOES work, just it won't let me switch between the weapons. I'm stumped as to why this is happening. Also, whilst we are on the topic of bugs and errors, I have another one, my new gamemode works fine in SinglePlayer, but when i create a game in multiplayer, the movement of the player become jerky and weird. Again, stumped as to why this is happening. Any help would be appreciated.
The jerky and weird player movement might have to do with listen server predictions. On a side note, I would like to tell you that this is a horrible way of giving players weapons as any person reading this post now knows that they can spawn class_sniper or class_heavy to get any weapons they want. You need to set a variable on the 'ply' so that they cannot spam these console commands. Alternatively, you can simply add these to the team-selection itself.
Class selection is clientsided in a derma menu, and seeing as Give and GiveAmmo are both serverside, I can't call them unless I create concommands like I did above.
You wouldnt have happened to overridden the SWEP.Holster hook to false? If you do that, then you cant put away the weapon. On that same note, if you overwrote SWEP.Deploy and didnt return True, then you cant take them out.
I didnt override either, all I did was give the player the weapons. These are not custom SWEPS, they are default HL2 ones, also, I was told a few other people were getting jerky movements due to one of the updates.
Sorry, you need to Log In to post a reply to this thread.