12.07.2010, 07:59
Here's a better way.
pawn Код:
#define TEAM_COP 0
#define TEAM_MECHANIC 1
public OnGameModeInit()
{
AddPlayerClass(0,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1); // ClassID 0 Aka Cop
AddPlayerClass(0,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1); // ClassID 1 Aka Mechanic
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
switch(classid)
{
case 0: // ClassID 0 aka Cop
{
GameTextForPlayer(playerid, "~b~Police", 4000, 3);
SetPlayerTeam(playerid,TEAM_COP); // Dosent matter that it goes here, it stops a variable like gTeam and its going to change if you switch classes.
}
case 1: // ClassID 1 aka Mech
{
GameTextForPlayer(playerid, "~r~Mechanic", 4000, 3);
SetPlayerTeam(playerid,TEAM_MECHANIC);
}
}
return 1;
}
public OnPlayerSpawn(playerid)
{
switch(GetPlayerTeam(playerid))
{
case TEAM_COP:
{
// Code here for when cops spawn
}
case TEAM_MECHANIC:
{
// Code here for when Mechanics spawn
}
}
return 1;
}