Color help
#1

Hi guys.... I have a cops and robbers server and i want to know how can i make : if player is wanted level 1,2,3,4 is yellow and if he is 5,6 he is orange....
Reply
#2

Define the colors at the top.

Create a variable at the top.

EXAMPLE
pawn Код:
new WantedLevel[MAX_PLAYERS];
UnderOnPlayerDeath - Only if you want this to happen when the player kills someone.

pawn Код:
WantedLevel[killerid] += 1;
Now you can either do it under on player death, or w/e you want, but make some if statements, and else ifs.

pawn Код:
if(WantedLevel[killerid] == 1)
{
SetPlayerColor(killerid, /*COLOR*/);
return 1;
}
else if(WantedLevel[killerid] == 2)
{
SetPlayerColor(killerid, /*COLOR*/);
return 1;
}

/*So on*/
Reply
#3

Realy thank you man!!!!!! One more question.... 1 Star= 4 wanted levels??
Reply
#4

SetPlayerWantedLevel Under Each one.

pawn Код:
If(WantedLevel[killerid] == 1)
{
/* Things above */
SetPlayerWantedLevel(killerid, 1);
return 1;
}
if(WantedLevel[killerid] == 2)
{
/* Things above */
SetPlayerWantedLevel(killerid, 2);
return 1;
}
/* That will put the literal stars on there screen */
Reply
#5

Quote:
Originally Posted by Nikos12
1 Star= 4 wanted levels??
No.
1 Star= 1 Wanted level *-*
Reply
#6

ok guys thank you
Reply
#7

Please delete this post
Reply
#8

You could use switch here, instead of if, else if and else:

pawn Код:
switch (WantedLevel[killerid])
{
    case 1:
    {
        //code from if(WantedLevel[killerid] == 1)
    }
    case 2:
    {
        //code from else if(WantedLevel[killerid] == 2)
    }
    default:
    {
        //code from else
    }
}
Maybe useful to know for some other time.

https://sampwiki.blast.hk/wiki/Control_Structures#switch_2
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)