31.10.2012, 02:37
Quote:
This is what I use to set Teams colours, edit it to your script.
Код:
#define TEAMA 0 #define TEAMB 1 public OnGameModeInit() { AddPlayerClassEx(0, 15, 1979.1917, -1222.0964, 25.1824, 97.3597, 0, 0, 0, 0, 0, 0); //TEAMA AddPlayerClassEx(1, 14 1979.1917, -1222.0964, 25.1824, 97.3597, 0, 0, 0, 0, 0, 0); //TEAMB return 1; } forward SetPlayerTeamFromClass(playerid, classid); public OnPlayerRequestClass(playerid, classid) { SetPlayerTeamFromClass(playerid, classid); return 1; } public SetPlayerTeamFromClass(playerid, classid) { if(classid == 0) //TEAM A { gTeam[playerid] = TEAMA; SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779); // position of the player in the class selection SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909); // Cameraposition SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);//Camera Look at position SetPlayerFacingAngle(playerid,122.4500); //Facing Angle SetPlayerColor(playerid,BLUE); // Teamcolor PlayerInfo[playerid][PlayerClass] = TEAMA; } if(classid == 1) //TEAMB { gTeam[playerid] = TEAMB; SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779); // position of the player in the class selection SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909); // Cameraposition SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779); SetPlayerFacingAngle(playerid,122.4500); SetPlayerColor(playerid,ORANGE); // Teamcolor PlayerInfo[playerid][PlayerClass] = TEAMB; } } |
Use native functions
pawn Код:
// Definitions (on top of gamemode)
#define COPS_TEAM (0)
#define SWAT_TEAM (1)
// On GameModeInit
AddPlayerClassEx( COPS_TEAM, SKIN_ID, POS_SPAWN_X, POS_SPAWN_Y, POS_SPAWN_Z, POS_ANGLE, WEAPON1, WEAPON1_AMMO, WEAPON2, WEAPON2_AMMO, WEAPON3, WEAPON3_AMMO) // Classid 0
AddPlayerClassEx( SWAT_TEAM, SKIN_ID, POS_SPAWN_X, POS_SPAWN_Y, POS_SPAWN_Z, POS_ANGLE, WEAPON1, WEAPON1_AMMO, WEAPON2, WEAPON2_AMMO, WEAPON3, WEAPON3_AMMO) // Classid 1
AddPlayerCLassEx( parameters ); // Classid 2... etc..
// On: (OnRequestClass)
switch(classid){
case 0: SetPlayerTeam(playerid, COPS_TEAM); // Cops team (Classid 0)
case 1: SetPlayerTeam(playerid, SWAT_TEAM); // Swat Team (classid 1)
}
// shows player team:
switch(GetPlayerTeam(playerid)){
case COPS_TEAM: SendClientMessage(playerid, -1, "Your team is COPS");
case SWAT_TEAM: SendClientMessage(playerid, -1, "Your team is Swat");
}