21.12.2012, 18:43
Hello.
I have made this script , and when a player spawns, he doesnt spawn with the right color.
Here is the code I'm havign trouble with:
I have made this script , and when a player spawns, he doesnt spawn with the right color.
Here is the code I'm havign trouble with:
Код:
//====[TEAMS]====//
new gTeam[MAX_PLAYERS];
//===============//
#define TEAM_CIVILIANS 1
#define TEAM_GYPSIES 2
#define TEAM_FIREMAN 3
#define TEAM_MEDIC 4
#define TEAM_POLICE 5
#define TEAM_SWAT 6
#define TEAM_FBI 7
//==[TEAMCOLOR]==//
#define TEAM_CIVILIANS_COLOR 0xFFFFFFFF
#define TEAM_GYPSIES_COLOR 0xD9C555FF
#define TEAM_FIREMAN_COLOR 0xBA5A5AFF
#define TEAM_MEDIC_COLOR 0x4078D5FF
#define TEAM_POLICE_COLOR 0x2CD162FF
#define TEAM_SWAT_COLOR 0xB13A94FF
#define TEAM_FBI_COLOR 0x509C85FF
//=========[SETPLAYERTEAMFROMCLASS]=========//
SetPlayerTeamFromClass(playerid, classid)
{
if (classid == 7 || classid == 12 || classid == 18 || classid == 19 || classid == 20
|| classid == 21 || classid == 22 || classid == 23 || classid == 29 || classid == 30
|| classid == 40 || classid == 41 || classid == 47 || classid == 90 || classid == 169
|| classid == 170 || classid == 188 || classid == 193 || classid == 223)
{
gTeam[playerid] = TEAM_CIVILIANS;
}
if (classid == 35 || classid == 78 || classid == 79 || classid == 131 || classid == 132
|| classid == 133 || classid == 134 || classid == 135 || classid == 136 || classid == 137
|| classid == 158 || classid == 159 || classid == 160 || classid == 161 || classid == 162)
{
gTeam[playerid] = TEAM_GYPSIES;
}
if (classid == 277 || classid == 278 || classid == 279)
{
gTeam[playerid] = TEAM_FIREMAN;
}
if (classid == 280 || classid == 281 || classid == 282 || classid == 283 || classid == 288)
{
gTeam[playerid] = TEAM_POLICE;
}
if (classid == 274 || classid == 275 || classid == 276)
{
gTeam[playerid] = TEAM_MEDIC;
}
if (classid == 284 || classid == 285)
{
gTeam[playerid] = TEAM_SWAT;
}
if (classid == 286)
{
gTeam[playerid] = TEAM_FBI;
}
}
//=========[SETPLAYERTOTEAMCOLOR]=========//
SetPlayerToTeamColor(playerid)
{
if (gTeam[playerid] == TEAM_CIVILIANS)
{
SetPlayerColor(playerid, TEAM_CIVILIANS_COLOR);
}
if (gTeam[playerid] == TEAM_GYPSIES)
{
SetPlayerColor(playerid, TEAM_GYPSIES_COLOR);
}
if (gTeam[playerid] == TEAM_FIREMAN)
{
SetPlayerColor(playerid, TEAM_FIREMAN_COLOR);
}
if (gTeam[playerid] == TEAM_POLICE)
{
SetPlayerColor(playerid, TEAM_POLICE_COLOR);
}
if (gTeam[playerid] == TEAM_MEDIC)
{
SetPlayerColor(playerid, TEAM_MEDIC_COLOR);
}
if (gTeam[playerid] == TEAM_SWAT)
{
SetPlayerColor(playerid, TEAM_SWAT_COLOR);
}
if (gTeam[playerid] == TEAM_FBI)
{
SetPlayerColor(playerid, TEAM_FBI_COLOR);
}
}
Код:
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, -1825.3901, 540.6253, 150.8125);
SetPlayerCameraPos(playerid, -1828.2405, 538.8458, 153.3919);
SetPlayerCameraLookAt(playerid, -1825.3901, 540.6253, 150.8125);
SetPlayerFacingAngle(playerid, 117.5598);
SetPlayerTeamFromClass(playerid, classid);
return 1;
}
Код:
public OnPlayerSpawn(playerid)
{
//================[TEAMS]================//
SetPlayerToTeamColor(playerid);
}

