public OnPlayerRequestClass(playerid, classid)
{
SetPlayerTeamFromClass(playerid, classid);
SetPlayerPos(playerid, 1491.4349,-871.7689,60.0094);
SetPlayerFacingAngle(playerid,311.0488);
SetPlayerCameraPos(playerid, 1496.0518,-867.3990,60.9751);
SetPlayerCameraLookAt(playerid, 1491.4349,-871.7689,60.0094);
pClass[playerid] = classid;
switch(classid)
{
case 0,1,2,3:
{
GameTextForPlayer(playerid, "~b~POLICE OFFICER", 3000, 4);
}
case 4:
{
GameTextForPlayer(playerid, "~g~ARMY", 3000, 4);
}
case 5,6,7,8,9,10,11,12:
{
GameTextForPlayer(playerid, "~y~CIVIL", 3000, 4);
}
case 13:
{
GameTextForPlayer(playerid, "~r~TERRORIST", 3000, 4);
}
}
return 1;
}
SetPlayerTeamFromClass(playerid, classid)
{
switch(classid)
{
case 0,1,2,3:
{
gTeam[playerid] = TEAM_COP;
}
case 4:
{
gTeam[playerid] = TEAM_ARMY;
}
case 5,6,7,8,9,10,11,12:
{
gTeam[playerid] = TEAM_CIVIL;
}
case 13:
{
gTeam[playerid] = TEAM_TERRORIST;
}
}
return 1;
}
SetPlayerToTeamColor(playerid)
{
if(gTeam[playerid] == TEAM_COP)
{
SetPlayerColor(playerid,TEAM_COP_COLOR);
}
else if(gTeam[playerid] == TEAM_ARMY)
{
SetPlayerColor(playerid,TEAM_ARMY_COLOR);
}
else if(gTeam[playerid] == TEAM_CIVIL)
{
SetPlayerColor(playerid,TEAM_CIVIL_COLOR);
}
else if(gTeam[playerid] == TEAM_TERRORIST)
{
SetPlayerColor(playerid,TEAM_TERRORIST_COLOR);
}
return 1;
}
public OnPlayerSpawn(playerid)
{
if(gTeam[playerid] == TEAM_CIVIL)
{
new Random = random(sizeof(RandomSpawns));
SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
SetPlayerToTeamColor(playerid);
}
if(gTeam[playerid] == TEAM_ARMY && GetPlayerScore(playerid) <= 49)
{
SendClientMessage(playerid,-1, "My error message" );
return 0;
}
SetPlayerToTeamColor(playerid);
return 1;
}
Called when a player attempts to spawn via class selection. |
Place your score check under OnPlayerRequestSpawn and return 0 if the check fails.
|