![]() ![]() Always make sure that created entities are actually created! if ( not ent: IsValid() ) then return end - Set the entity's model to the passed in model ent: SetModel( model_file ) ( if we didn't they would feel a ping delay during multiplayer ) if ( CLIENT ) then return end - Create a prop_physics entity local ent = ents. ![]() We play the sound above on the client due to prediction. If we're the client then this is as much as we want to do. Make sure the weapon is being held before trying to throw a chair if ( not owner: IsValid() ) then return end - Play the shoot sound we precached earlier! self: EmitSound( self.ShootSound ) When you call this the player will fire a chair! function SWEP: ThrowChair( model_file ) Self: ThrowChair( "models/props_c17/FurnitureChair001a.mdl" )Įnd - A custom function we added. ![]() Though the secondary fire isn't automatic - players shouldn't be able to fire too fast self: SetNextSecondaryFire( CurTime() + 0.1 ) Call 'ThrowChair' on self with this model self: ThrowChair( "models/props/cs_office/Chair_office.mdl" )Įnd - Called when the rightmouse button is pressed function SWEP: SecondaryAttack() self: SetNextPrimaryFire( CurTime() + 0.5 ) Here we set it to shoot every 0.5 seconds. This function call below defines - the rate of fire. Called when the left mouse button is pressed function SWEP: PrimaryAttack() ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |