SA-MP Forums Archive
In-game Colors? - 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: In-game Colors? (/showthread.php?tid=272518)



In-game name Colors? - phil_lendon - 28.07.2011

Right so i dont know how to do this (this is the whole point of learning) but this is what i want
people with 6 stars = Red Name
People with 0 stars = white name
class id 2 (team whatever) = blue
how can i do this?


Re: In-game Colors? - Mean - 28.07.2011

pawn Код:
public OnPlayerRequestClass( playerid, classid ) {
    if( classid == 2 ) SetPlayerColor( playerid, 0x0000BBAA );
    return 1;
}

public OnPlayerUpdate( playerid ) {
    if( GetPlayerWantedLevel( playerid ) >= 0 && GetPlayerWantedLevel( playerid ) <= 5 ) SetPlayerColor( playerid, 0xFFFFFFAA );
    else if( GetPlayerWantedLevel( playerid ) > 5 ) SetPlayerColor( playerid, 0x800000AA );
    return 1;
}



Re: In-game Colors? - phil_lendon - 28.07.2011

cop dont work as they have no stars? anyway around this?


Re: In-game Colors? - phil_lendon - 28.07.2011

bump.


Re: In-game Colors? - Amit_B - 28.07.2011

pawn Код:
public OnPlayerUpdate( playerid ) {
    if(GetPlayerSkin(playerid) != COPSKINID)
    {
        if( GetPlayerWantedLevel( playerid ) >= 0 && GetPlayerWantedLevel( playerid ) <= 5 ) SetPlayerColor( playerid, 0xFFFFFFAA );
        else if( GetPlayerWantedLevel( playerid ) > 5 ) SetPlayerColor( playerid, 0x800000AA );
    }
    return 1;
}
Replace the COPSKINID with the skin (not the class) id of cops (280?)


Re: In-game Colors? - Kaperstone - 28.07.2011

pawn Код:
public OnPlayerUpdate( playerid ) {
    if(GetPlayerSkin(playerid) != 265 && GetPlayerSkin(playerid) != 266 && GetPlayerSkin(playerid) != 267 && GetPlayerSkin(playerid) != 280 && GetPlayerSkin(playerid) != 281)
            {
            // checks if player wanted level is bigger then 6
            if(GetPlayerWantedLevel(playerid) >= 6)
                   {
                   // replace the ColorCode with your color....(0x667788 or somthing like thet..)
                   SetPlayerColor(playerid, ColorCode);
                   }
            // we still didnt close it... we want to keep with it :)
            // Check if the player wanted level is bigger then 0 and smaller then 5
            // now y 5 and not 6? caz we have ' <= ' and not just ' < '
            // <=  means then the number smaller or equal to the number, so if we will put 6 it will give as a crash or somthing like thet...
            if(GetPlayerWantedLevel(playerid) >= 0 && GetPlayerWantedLevel(playerid) <= 5)
                   {
                   // replace the ColorCode with your color....(0x667788 or somthing like thet..)
                   SetPlayerColor(playerid, ColorCode);
            }



Re: In-game name Colors? - iPLEOMAX - 28.07.2011

Quote:
Originally Posted by phil_lendon
Посмотреть сообщение
Right so i dont know how to do this (this is the whole point of learning) but this is what i want
people with 6 stars = Red Name
People with 0 stars = white name
class id 2 (team whatever) = blue
how can i do this?
pawn Код:
public OnPlayerUpdate(playerid)
{
     if (GetPlayerWantedLevel(playerid) >= 6 && GetPlayerTeam(playerid) == 1) { SetPlayerColor(playerid, 0xFF0000FF); }
     else if (GetPlayerWantedLevel(playerid) < 6 && GetPlayerTeam(playerid) == 1) { SetPlayerColor(playerid, 0xFFFFFFFF); }
     return true.
}

public OnPlayerSpawn(playerid)
{
     if (GetPlayerTeam(playerid) == 1) { SetPlayerColor(playerid, 0xFFFFFFFF); }
     else if (GetPlayerTeam(playerid) == 2) { SetPlayerColor(playerid, 0x00CCFFFF); }
     return true.
}
+I don't recommend using onplayerupdate thoug.