AddPlayerClass

From SA-MP

Jump to: navigation, search


AddPlayerClass

In order to allow people to spawn with a specific skin using the class-selection screens, this is the function to use. At least one skin needs to be defined in your gamemode in order for it to run. If you would like to add a default team for a skin, take a look at AddPlayerClassEx.


(skin, Float:x, Float:y, Float:z, Float:Angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo)
skinThe skin which the player will spawn with.
Float:XThe X-coordinate of the class' spawn position.
Float:YThe Y-coordinate of the class' spawn position.
Float:ZThe Z-coordinate of the class' spawn position.
Float:AngleThe direction in which the player needs to be facing after spawning.
weapon1The first spawn-weapon for the player.
weapon1_ammoThe amount of ammunition for the primary spawnweapon.
weapon2The second spawn-weapon for the player.
weapon2_ammoThe amount of ammunition for the second spawnweapon.
weapon3The third spawn-weapon for the player.
weapon3_ammoThe amount of ammunition for the third spawnweapon.


ReturnsThe ID of the class which was just created.


public OnGameModeInit( )
{
    // People are only allowed to spawn using the CJ skin.
    AddPlayerClass( 0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0 );
    return 1;
}

Related Functions

The following functions might be useful as well, as they're related to this function in one way or another.

  • SetPlayerSkin: The SetPlayerSkin function allows you to change a player's appearance.
  • AddPlayerClassEx: Exactly the same as this one, but you can set a default team.
  • SetSpawnInfo: To adjust the spawn information of a specific player.
Personal tools
In other languages