30.10.2012, 00:32
I need help guys with creating teams colors.I am trying to make a zombie server.I have 2 teams humans and zombies.
if(gTeam[playerid] == Team_Humans)
{
SetPlayerColor(playerid, White);
}
else if(gTeam[playerid] == Team_Zombies)
{
SetPlayerColor(playerid, Zombie_Color); //change the Color to your liking
}
#define COLOR_GROVE FF000 // color code
#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; } }
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; } } |
// 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");
}
I got errors for this
// 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"); } |
#include a_samp
#define COPS_TEAM 0
#define SWAT_TEAM 1
public OnGameModeInit(){
AddPlayerClassEx( COPS_TEAM, 100, 1958.3783, 1343.1572, 15.3746, 0.0, 0, 0, 0, 0, 0, 0); // Classid 0
AddPlayerClassEx( SWAT_TEAM, 0 , 2199.6531, 1393.3678, 10.8203, 0.0, 0, 0, 0, 0, 0, 0); // Classid 1
return true;
}
public OnPlayerRequestClass(playerid, classid){
switch(classid){
case 0: SetPlayerTeam(playerid, COPS_TEAM); // Cops team (Classid 0)
case 1: SetPlayerTeam(playerid, SWAT_TEAM); // Swat Team (classid 1)
}
SetPlayerInterior(playerid,14);
SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
SetPlayerFacingAngle(playerid, 270.0);
SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
return true;
}
public OnPlayerSpawn(playerid){
switch(GetPlayerTeam(playerid)){
case COPS_TEAM: SendClientMessage(playerid, -1, "Your team is COPS");
case SWAT_TEAM: SendClientMessage(playerid, -1, "Your team is Swat");
}
return true;
}