SA-MP Forums Archive
Teams not working properly - 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 not working properly (/showthread.php?tid=409346)



Teams not working properly - Maraudeur - 21.01.2013

Sometimes you get placed in medic team, sometimes you get set as a civilian even though the same skin worked before, not sure what's wrong, please help.
Could it be thats doing this?:
pawn Код:
new CopTeamSkin,ArmyTeamSkin,CivilianTeamSkin,MedicTeamSkin,FireTeamSkin;
Teams
pawn Код:
#define CIVILIAN 0
#define POLICE 1
#define MEDIC 2
#define ARMY 3
#define FIREMEN 4
pawn Код:
new gTeam[MAX_PLAYERS];
new CopTeamSkin,ArmyTeamSkin,CivilianTeamSkin,MedicTeamSkin,FireTeamSkin;
pawn Код:
CivilianTeamSkin = AddPlayerClass(1,1979.1917,-1222.0964,25.1824,97.3597,0,0,0,0,0,0);
CivilianTeamSkin = AddPlayerClass(2,1979.1917,-1222.0964,25.1824,97.3597,0,0,0,0,0,0);
CivilianTeamSkin = AddPlayerClass(3,1979.1917,-1222.0964,25.1824,97.3597,0,0,0,0,0,0);
MedicTeamSkin = AddPlayerClass(274,1979.1917,-1222.0964,25.1824,97.3597,0,0,0,0,0,0);
MedicTeamSkin = AddPlayerClass(275,1979.1917,-1222.0964,25.1824,97.3597,0,0,0,0,0,0);
MedicTeamSkin = AddPlayerClass(276,1979.1917,-1222.0964,25.1824,97.3597,0,0,0,0,0,0);
FireTeamSkin = AddPlayerClass(277,1979.1917,-1222.0964,25.1824,97.3597,0,0,0,0,0,0);
FireTeamSkin = AddPlayerClass(278,1979.1917,-1222.0964,25.1824,97.3597,0,0,0,0,0,0);
FireTeamSkin = AddPlayerClass(279,1979.1917,-1222.0964,25.1824,97.3597,0,0,0,0,0,0);
/*      Army                */
ArmyTeamSkin = AddPlayerClass(287,2508.5671,-1673.6665,13.3793,86.2585,0,0,0,0,0,0);
/*      Police              */
CopTeamSkin = AddPlayerClass(280,2508.5671,-1673.6665,13.3793,86.2585,0,0,0,0,0,0);
CopTeamSkin = AddPlayerClass(281,1979.1917,-1222.0964,25.1824,97.3597,0,0,0,0,0,0);
CopTeamSkin = AddPlayerClass(282,1979.1917,-1222.0964,25.1824,97.3597,0,0,0,0,0,0);
CopTeamSkin = AddPlayerClass(283,1979.1917,-1222.0964,25.1824,97.3597,0,0,0,0,0,0);
CopTeamSkin = AddPlayerClass(284,1979.1917,-1222.0964,25.1824,97.3597,0,0,0,0,0,0);
CopTeamSkin = AddPlayerClass(285,1979.1917,-1222.0964,25.1824,97.3597,0,0,0,0,0,0);
CopTeamSkin = AddPlayerClass(286,1979.1917,-1222.0964,25.1824,97.3597,0,0,0,0,0,0);
CopTeamSkin = AddPlayerClass(288,1979.1917,-1222.0964,25.1824,97.3597,0,0,0,0,0,0);
CopTeamSkin = AddPlayerClass(265,1979.1917,-1222.0964,25.1824,97.3597,0,0,0,0,0,0);
CopTeamSkin = AddPlayerClass(266,1979.1917,-1222.0964,25.1824,97.3597,0,0,0,0,0,0);
pawn Код:
forward SetPlayerTeamFromClass(playerid, classid);
   public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid);
    return 1;
}
public SetPlayerTeamFromClass(playerid, classid)
{
if(classid == CivilianTeamSkin)
    {
        gTeam[playerid] = CIVILIAN;
        GameTextForPlayer(playerid,"~w~Civilian",3000,3);
        SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779);
        SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909);
        SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
        SetPlayerFacingAngle(playerid,122.4500);
        SetPlayerColor(playerid,0xFFFFFFAA);
        }
    else if(classid == MedicTeamSkin)
    {
        gTeam[playerid] = MEDIC;
        GameTextForPlayer(playerid,"~p~Medic",3000,3);
        SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
        SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
        SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
        SetPlayerFacingAngle(playerid,252.4717);
        SetPlayerColor(playerid,0xFFC0CBAA);
    }
    else if(classid == ArmyTeamSkin)
    {
        gTeam[playerid] = ARMY;
        GameTextForPlayer(playerid,"~p~Army",3000,3);
        SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
        SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
        SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
        SetPlayerFacingAngle(playerid,252.4717);
        SetPlayerColor(playerid,0xFF00FFAA);
    }
    else if(classid == CopTeamSkin)
    {
        gTeam[playerid] = POLICE;
        GameTextForPlayer(playerid,"~b~Police",3000,3);
        SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
        SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
        SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
        SetPlayerFacingAngle(playerid,252.4717);
        SetPlayerColor(playerid,0x0000FFAA);
    }
    else if(classid == FireTeamSkin)
    {
        gTeam[playerid] = FIREMEN;
        GameTextForPlayer(playerid,"~r~Firemen",3000,3);
        SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
        SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
        SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
        SetPlayerFacingAngle(playerid,252.4717);
        SetPlayerColor(playerid,0xAA3333AA);
    }
}
EDIT: If I go left it works, but if I browse skins to the right it gets all mixed up :S


Re: Teams not working properly - azzerking - 21.01.2013

You do relies, that you are overwriting your data for MedicTeamSkin, FiremanTeamSkin, CivilianTeamSkin CopTeamSkin.

follow this tutorial:

http://forum.sa-mp.com/showthread.ph...ighlight=Teams