---
title: "AddPlayerClassEx | open.mp"
description: "This function is exactly the same as the AddPlayerClass function, with the addition of a team parameter."
canonical: https://omp.itsneufox.com/th/docs/scripting/functions/AddPlayerClassEx
language: th
---

# AddPlayerClassEx

## คำอธิบาย

This function is exactly the same as the AddPlayerClass function, with the addition of a team parameter.

| Name | Description |
| --- | --- |
| teamid | The team you want the player to spawn in. |
| modelid | The skin which the player will spawn with. |
| Float:spawn\_x | The X coordinate of the class' spawn position. |
| Float:spawn\_y | The Y coordinate of the class' spawn position. |
| Float:spawn\_z | The Z coordinate of the class' spawn position. |
| Float:z\_angle | The direction in which the player will face after spawning. |
| weapon1 | The first spawn-weapon for the player. |
| weapon1\_ammo | The amount of ammunition for the first spawn weapon. |
| weapon2 | The second spawn-weapon for the player. |
| weapon2\_ammo | The amount of ammunition for the second spawn weapon. |
| weapon3 | The third spawn-weapon for the player. |
| weapon3\_ammo | The amount of ammunition for the third spawn weapon. |

## ส่งคืน

The ID of the class which was just added.

319 if the class limit (320) was reached. The highest possible class ID is 319.

## ตัวอย่าง

```c
public OnGameModeInit()
{
    // Players can spawn as either:
    // CJ Skin (ID 0) in team 1.
    // The Truth skin (ID 1) in team 2.
    AddPlayerClassEx(1, 0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0); // CJ
    AddPlayerClassEx(2, 1, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0); // The Truth
    return 1;
}
```

## บันทึก

หมายเหตุ

The maximum class ID is 319 (starting from 0, so a total of 320 classes). When this limit is reached, any more classes that are added will replace ID 319.

## ฟังก์ชั่นที่เกี่ยวข้องกัน

-   [AddPlayerClass](https://omp.itsneufox.com/th/docs/scripting/functions/AddPlayerClass): Add a class.
-   [SetSpawnInfo](https://omp.itsneufox.com/th/docs/scripting/functions/SetSpawnInfo): Set the spawn setting for a player.
-   [SetPlayerTeam](https://omp.itsneufox.com/th/docs/scripting/functions/SetPlayerTeam): Set a player's team.
-   [SetPlayerSkin](https://omp.itsneufox.com/th/docs/scripting/functions/SetPlayerSkin): Set a player's skin.
