Teams dont work (solved) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Teams dont work (solved) (
/showthread.php?tid=352159)
Teams dont work (solved) -
Ukko - 18.06.2012
The teams arent working, I do not get the clientmessage when spawning and I still have the DEADCONNECT color.
If there's any better way of doing this then please show me, I'm not a expert at this kind of stuff.
Код:
new gTeam[MAX_PLAYERS];
//Teams
#define Team_Police 0
#define Team_Medic 1
#define Team_Civilian 2
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerColor(playerid, COLOR_DEADCONNECT);
SetPlayerPos(playerid, 359.3477, -2077.1821, 8.9575);
SetPlayerInterior(playerid, 0);
SetPlayerFacingAngle(playerid, 178.0051);
SetPlayerCameraPos(playerid, 358.9874,-2084.0168,7.8359);
SetPlayerCameraLookAt(playerid, 359.3477, -2077.1821, 8.9575);
SetPlayerTeamFromClass(playerid, classid);
switch(classid)
{
case 0..281:
{
GameTextForPlayer(playerid, "~w~CIVILIAN", 3000, 3);
}
case 282..287:
{
GameTextForPlayer(playerid, "~b~~h~MEDIC", 3000, 3);
}
case 288..299:
{
GameTextForPlayer(playerid, "~b~POLICE", 3000, 3);
}
}
return 1;
}
SetPlayerTeamFromClass(playerid, classid)
{
if(classid >= 288 && classid <= 299)
{
gTeam[playerid] = Team_Police;
}
else if(classid >= 282 && classid <= 287)
{
gTeam[playerid] = Team_Medic;
}
else if(classid >= 0 && classid <= 281)
{
gTeam[playerid] = Team_Civilian;
}
}
forward public SetPlayerToTeamColor(playerid);
public SetPlayerToTeamColor(playerid)
{
if(gTeam[playerid] == Team_Police)
{
SetPlayerColor(playerid, COLOR_BLUE);
}
if(gTeam[playerid] == Team_Medic)
{
SetPlayerColor(playerid, COLOR_PINK);
}
if(gTeam[playerid] == Team_Civilian)
{
SetPlayerColor(playerid, COLOR_WHITE);
}
return 1;
}
Re: Teams dont work -
MadeMan - 18.06.2012
Show your OnPlayerSpawn.
Re: Teams dont work -
Mimic - 18.06.2012
You aren't setting the team on Request Class?
an example
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
switch(classid)
{
case 0:
{
SetPlayerTeam(playerid, TEAM); // replace TEAM
}
case 1:
{
SetPlayerTeam(playerid, TEAM); // replace TEAM again...
}
}
return 1;
}
I think you get the point. Your just setting the GameTextForPlayer and not giving the player a chance to set their team.