Class
From GMod Wiki
Go to: Fretta Articles |
Structure | |
Name | Class |
Available On: | |
Description: | |
A class structure is used by the Fretta Game Base to design classes which players can then select, or you can set, based on their team. |
Members
Type | Name | Description |
---|---|---|
Type | name | description |
String | DisplayName | This is the name of the class, for display purposes. |
Integer | WalkSpeed | This is the walk speed of the class (without shift). |
Float | CrouchWalkSpeed | This is the amount that the walk speed is multiplied by while crouching. |
Integer | RunSpeed | This is the sprinting speed of the class (with shift). |
Float | DuckSpeed | This is the speed that the class moves from standing to crouching (in seconds). |
Integer | JumpPower | This is the jump power of the class (default: 160). |
String | PlayerModel | This is the player model that is set for this class. |
Boolean | DrawTeamRing | Whether or not colored team rings are displayed under players with this class. |
Boolean | DrawViewModel | Whether or not a player's weapon appears in the first person view using this class. |
Integer | MaxHealth | This is the maximum health of a player with this class. |
Integer | StartHealth | This is how much health the player spawns with. |
Integer | StartArmor | This is the amount of armor a player spawns with. |
Boolean | DropWeaponOnDie | Whether or not a player's weapon gets dropped upon death. |
Boolean | TeammateNoCollide | Whether or not a player should be able to walk through his teammates. |
Boolean | AvoidPlayers | Push players that are able to walk through this player away. |
Boolean | Selectable | When false, this class cannot be chosen from the select class menu. |
Boolean | FullRotation | Allow the player's model to rotate completely with their view (i.e. looking 90 degrees up will rotate your player model 90 degrees). |
Boolean | DisableFootsteps | Will disable or enable footstep sounds. |
String | Base | The name of the base class to derive from. |
Function | Loadout | This is called when the player is given their equipment. |
Function | OnSpawn | This is called when the player respawns. |
Function | OnDeath | This is called when the player dies. |
Function | Think | This is called in the Think hook. |
Function | Move | This is called whenever the player moves and can be used to create a fancy movement system. |
Function | OnKeyPress | This is called when a player presses a key. |
Function | OnKeyRelease | This is called when a player releases a key. |
Function | ShouldDrawLocalPlayer | If you return true the local player will be visible, you'll see your own body. |
Function | CalcView | This is called in the CalcView hook, use it to move the view camera around. |
Function | InputMouseApply | Unknown |
Function | Footstep | You can use this to make custom footstep sounds. |
Example
Additional Notes
- Not all members need to be defined.
- You must register the class with player_class.Register