AddPlayerClass

From SA-MP Wiki

Jump to: navigation, search


Adds a class to class selection. Classes are used so players may spawn with a skin of their choice.


Parameters:
(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 spawnpoint of this class.
Float:YThe Y coordinate of the spawnpoint of this class.
Float:ZThe Z coordinate of the spawnpoint of this class.
Float:AngleThe direction in which the player should face 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.


Returns
  • The ID of the class which was just added.
  • 300 if the class limit (300) was reached. The highest possible class ID is 299.


Image:32px-Ambox_warning_orange.png Note: The maximum class ID is 299 (starting from 0, so a total of 300 classes), when that limit is reached, any more classes that are added will replace ID 299.


public OnGameModeInit()
{
    // People can spawn with either the CJ skin or The Truth skin.
    AddPlayerClass(0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0);
    AddPlayerClass(1, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0);
    return 1;
}

Related Functions

The following functions may be useful, as they are related to this function in one way or another.

Personal tools