21.08.2012, 11:36
Let's say you have
Now for an example, let's say you want classid 0 and 3 to be 'Civilians':
Or alternatively, you could use:
And change your function like so:
You will need to have:
At the top of your script, in the respective position.
pawn Код:
AddPlayerClass(2, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); //classid 0
AddPlayerClass(265, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(287, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(294, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); //classid 3
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
Class[playerid] = classid;
SetPlayerInterior(playerid,3);
SetPlayerPos(playerid,944.99,-41.64,1001.77);
SetPlayerFacingAngle(playerid,180.0);
SetPlayerCameraPos(playerid,944.69,-47.54,1001.12);
SetPlayerCameraLookAt(playerid,944.99,-41.64,1001.77);
if(classid == 0 || classid == 3)
{
SetPlayerTeamFromClass(playerid, classid);
GameTextForPlayer(playerid,"~w~CIVILIAN",1000,4);
}
if(classid == 1)
{
SetPlayerTeamFromClass(playerid, classid);
GameTextForPlayer(playerid,"~b~COP",1000,4);
}
if(classid == 2)
{
SetPlayerTeamFromClass(playerid, classid);
GameTextForPlayer(playerid,"~g~ARMY",1000,4);
}
return 1;
}
pawn Код:
switch(classid)
{
case 0, 3:
{
GameTextForPlayer(playerid,"~w~CIVILIAN",1000,4);
}
case 1:
{
GameTextForPlayer(playerid,"~b~COP",1000,4);
}
case 2:
{
GameTextForPlayer(playerid,"~g~ARMY",1000,4);
}
}
SetPlayerTeamFromClass(playerid, classid);
pawn Код:
stock SetPlayerTeamFromClass(playerid, classid)
{
switch(classid)
{
case 0, 3:
{
gTeam[playerid] = TEAM_CIV; //Considering the fact if you have defines at the top.
}
case 1:
{
gTeam[playerid] = TEAM_COP;
}
case 2:
{
gTeam[playerid] = TEAM_ARMY;
}
}
return 1;
}
pawn Код:
new gTeam[MAX_PLAYERS];
#define TEAM_CIV 0
#define TEAM_COP 1
#define TEAM_ARMY 2