SA-MP Forums Archive
COLOR - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: COLOR (/showthread.php?tid=182015)



COLOR - Thebest96 - 08.10.2010

Hey i started create my OWN GM of DM.
Its like ilegal racing.
I maked teams DM, but when i select only the first team change the color, the other team stay with the team 1 color.

HERE you have my GM:



COLOR CODES:

pawn Код:
stock SetPlayerTeamFromClass(playerid, classid)
{
    if (classid == 1)
    {
        gTeam[playerid] = TEAM_RACER;
        return 1;
    }
   
    if (classid == 2)
    {
        gTeam[playerid] = TEAM_COP;
        return 1;
    }
    return 1;
}
stock SetPlayerToTeamColor(playerid)
{
    if (gTeam[playerid] == TEAM_RACER)
    {
        SetPlayerColor(playerid, 0xAA3333AA);
        return 1;
    }
    else if (gTeam[playerid] == TEAM_COP)
    {
        SetPlayerColor(playerid, 0x33CCFFAA);
        return 1;
    }
    return 1;
}



Re: COLOR - Mauzen - 08.10.2010

Please upload giant scripts like that to pastebin.com
Or better: just post the parts that are relevant for the color change.
No one wants to work through the whole code just to find out what part to check for bugs.


Re: COLOR - Thebest96 - 08.10.2010

done sorry :S


Re: COLOR - WillyP - 08.10.2010

nice gamemode you got there

love some of the functions you made


Re: COLOR - Mauzen - 08.10.2010

No problem, looks good now
Someone correct me if Im wrong, cause ive not worked a lot in that area,
but i think classid should start at 0, so if you have two different classes, their ids will be 0 and 1, not 1 and 2. So the player wont get assigned to TEAM_COP -> his color wont be set.

so change the classid == 1/2 to 0/1

pawn Код:
stock SetPlayerTeamFromClass(playerid, classid)
{
    if (classid == 0)
    {
        gTeam[playerid] = TEAM_RACER;
        return 1;
    }
   
    if (classid == 1)
    {
        gTeam[playerid] = TEAM_COP;
        return 1;
    }
    return 1;
}



Re: COLOR - Thebest96 - 08.10.2010

don't work.... i changed and nothing


Re: COLOR - Thebest96 - 08.10.2010

bumpfdsf


Re: COLOR - Mean - 08.10.2010

Dont use this code, use this code for example

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(gTeam[playerid] == yourteamname) {
        SetPlayerInterior(playerid, 0); // team spawn interior
        SetPlayerPos(playerid, x, y, z);//Team spawn position
        GivePlayerWeapon(playerid, 26, 100); // team weapons
        GivePlayerWeapon(playerid, 29, 500);
        GivePlayerWeapon(playerid, 30, 300);
        SetPlayerTeam(playerid, 0); // team
        SetPlayerColor(playerid, COLOR_BLUE); // and a team color, dont use SetPlayerToTeamColor
        }
then at the end

pawn Код:
SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 0)
    {
        gTeam[playerid] = yourteamname;
        GameTextForPlayer(playerid,"YourTeamNameThatWillAppearInSpawnMenu for example Army",999999,6);
    }

Easiest way


Re: COLOR - Thebest96 - 09.10.2010

dont work please help


Re: COLOR - Mean - 09.10.2010

Dont use any if (classid == 0)
{
code

so use the one i gave u above, this is how it should look at the end :
pawn Код:
#define TEAM_LSPD 0
#define TEAM_ARMY 1
#define TEAM_GROVE 2
#define TEAM_BALLAS 3
#define TEAM_AZTECAS 4
#define TEAM_VAGOS 5
pawn Код:
new gTeam[MAX_PLAYERS];
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(gTeam[playerid] == TEAM_ARMY) {
        SetPlayerInterior(playerid, 0);
        SPP(playerid, 1553.3546, -1675.4446, 16.1953);
        GPW(playerid, 26, 100);
        GPW(playerid, 29, 500);
        GPW(playerid, 30, 300);
        SetPlayerTeam(playerid, 0);
        SetPlayerColor(playerid, COLOR_BLUE);
        }
    if(gTeam[playerid] == TEAM_LSPD) {
        SetPlayerInterior(playerid, 0);
        SPP(playerid, 116.6943, 1933.8201, 18.9704);
        GPW(playerid, 27, 100);
        GPW(playerid, 31, 300);
        GPW(playerid, 35, 2);
        SetPlayerTeam(playerid, 1);
        SetPlayerColor(playerid, COLOR_PURPLE);
        }
    if(gTeam[playerid] == TEAM_GROVE) {
        SetPlayerInterior(playerid, 0);
        SPP(playerid, 2495.2432,-1686.8315,13.5145);
        GPW(playerid, 26, 100);
        GPW(playerid, 29, 500);
        GPW(playerid, 30, 300);
        SetPlayerTeam(playerid, 2);
        SetPlayerColor(playerid, COLOR_GREEN);
        }
    if(gTeam[playerid] == TEAM_BALLAS) {
        SetPlayerInterior(playerid, 0);
        SPP(playerid, 1974.6564,-1221.4495,20.0234);
        GPW(playerid, 26, 100);
        GPW(playerid, 29, 500);
        GPW(playerid, 30, 300);
        SetPlayerTeam(playerid, 3);
        SetPlayerColor(playerid, COLOR_PURPLE);
        }
    if(gTeam[playerid] == TEAM_AZTECAS) {
        SetPlayerInterior(playerid, 0);
        SPP(playerid, 1774.2631,-1918.8599,13.5493);
        GPW(playerid, 26, 100);
        GPW(playerid, 29, 500);
        GPW(playerid, 30, 300);
        SetPlayerTeam(playerid, 4);
        SetPlayerColor(playerid, COLOR_TAN);
        }
    if(gTeam[playerid] == TEAM_VAGOS) {
        SetPlayerInterior(playerid, 0);
        SPP(playerid, 677.8542,-1876.9122,4.5308);
        GPW(playerid, 26, 100);
        GPW(playerid, 29, 500);
        GPW(playerid, 30, 300);
        SetPlayerTeam(playerid, 5);
        SetPlayerColor(playerid, COLOR_YELLOW);
        }
    return 1;
    }
AND put this anywhere in your script, i suggest you to put it on the end of script
pawn Код:
SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 0)
    {
        gTeam[playerid] = TEAM_ARMY;
        GameTextForPlayer(playerid,"Army",999999,6);
    }
    else if(classid == 1)
    {
        gTeam[playerid] = TEAM_LSPD;
        GameTextForPlayer(playerid,"Los santos police department",999999,6);
    }
    else if(classid == 2)
    {
        gTeam[playerid] = TEAM_GROVE;
        GameTextForPlayer(playerid,"Grove Street",999999,6);
    }
    else if(classid == 3)
    {
        gTeam[playerid] = TEAM_BALLAS;
        GameTextForPlayer(playerid,"Ballas",999999,6);
    }
    else if(classid == 4)
    {
        gTeam[playerid] = TEAM_AZTECAS;
        GameTextForPlayer(playerid,"Los Aztecas",999999,6);
    }
    else if(classid == 5)
    {
        gTeam[playerid] = TEAM_VAGOS;
        GameTextForPlayer(playerid,"Los Santos Vagos",999999,6);
    }

}
these are just team from my script, ofc you change it
AND Dont matter about GPW, SPP, and SCM code, its just my shortcut, ofc its #define GPW GivePlayerWeapon, easier lol
You can change it to full code