• TTT Server weapon switching error
    2 replies, posted
Every time I try to equip a weapon on my TTT server it gives this error: [CODE]terrortown\gamemode\cl_wepswitch.lua:101 attempt to call method 'ammo1' (a nil value)(hook: HUDpaint)[/CODE] What could be causing this? I have not added anything to the server recently.
Are you using a custom weapon base? Ammo1 is called from the TTT weapon base.
On your HUDPaint, you can do something like this: [lua]// Define a short variable to contain the player, we're going to use it a bit... local _p = LocalPlayer( ); // If the player isn't valid, they're not fully loaded; stop here if ( !IsValid( _p ) ) then return; end // Lets grab the active weapon, this is nil when the player first joins and can be nil throughout local _w = _p:GetActiveWeapon( ); // So we check to make sure. If it isn't valid, or the weapon doesn't have the function Ammo1 then stop here. if ( !IsValid( _w ) || !_w.ammo1 ) then return; end // // Rest of the code goes below this // [/lua]
Sorry, you need to Log In to post a reply to this thread.