Help with Wanted Colors
#1

Help with Wanted Colors
When someone has stars and is Wanted for arrest, for the color of their name to change, Yellow if they have one or more stars and less then 3 their name to change to Yellow indicating they require a ticket, anything higher then three stars name changes to Orange, Indicating they are to be arrested

just like in crazybobs server, if anyone has played that one

How can i do this?
Reply
#2

Add this under OnPlayerDeath
pawn Код:
if(IsPlayerConnected(killerid))
{
    new wanted;
    wanted = GetPlayerWantedLevel(killerid);
    SetPlayerWantedLevel(killerid,wanted + 1);
    if(GetPlayerWantedLevel(killerid) <=3)
    {
        SetPlayerColor(killerid,0xDABB3EAA);
    }
    else if(GetPlayerWantedLevel(killerid) > 3)
    {
        SetPlayerColor(killerid,0xFF9900AA);
    }
}
You can remove these lines if you already have them
pawn Код:
new wanted;
wanted = GetPlayerWantedLevel(killerid);
SetPlayerWantedLevel(killerid,wanted + 1);
Reply
#3

Just some forwards, put them wherever.
Код:
forward SetPlayerWantedLevel_Ex(iPlayer, iLevel);
forward OnPlayerWantedLevelChanged(iPlayer, iLevel);
SetPlayerWantedLevel_Ex()
Код:
public SetPlayerWantedLevel_Ex(iPlayer, iLevel){
	if (IsPlayerConnected(iPlayer) && (iLevel >= 0 || iLevel <= 6)){
		SetPlayerWantedLevel(iPlayer, iLevel);		
		OnPlayerWantedLevelChanged(iPlayer, iLevel); // Fire the callback.
	}
}
Add anything else to it, use this function instead of the native one.

OnPlayerWantedLevelChanged() - Called by SetPlayerWantedLevel_Ex() if all goes well.
Код:
public OnPlayerWantedLevelChanged(iPlayer, iLevel){
	// Do whatever you want with the player here.

	if (iLevel == 0)
		SetPlayerColor(iPlayer, 0xFFFFFFFF);
	else if (iLevel >= 0 && iLevel <= 3)
		SetPlayerColor(iPlayer, 0xE6E615FF);
	else if (iLevel >= 4)
		SetPlayerColor(iPlayer, 0xE0914CFF);
}
Reply
#4

Quote:
Originally Posted by Vlad64
Посмотреть сообщение
Add this under OnPlayerDeath
pawn Код:
if(IsPlayerConnected(killerid))
{
    new wanted;
    wanted = GetPlayerWantedLevel(killerid);
    SetPlayerWantedLevel(killerid,wanted + 1);
    if(GetPlayerWantedLevel(killerid) <=3)
    {
        SetPlayerColor(killerid,0xDABB3EAA);
    }
    else if(GetPlayerWantedLevel(killerid) > 3)
    {
        SetPlayerColor(killerid,0xFF9900AA);
    }
}
You can remove these lines if you already have them
pawn Код:
new wanted;
wanted = GetPlayerWantedLevel(killerid);
SetPlayerWantedLevel(killerid,wanted + 1);

Hey, this is what mine looks like public OnPlayerDeath(playerid, killerid, reason)
{
new msg[128],reasonMsg[32], pname[MAX_PLAYER_NAME], string[128], deathreason[20];
SendDeathMessage(killerid,playerid,reason);
GameTextForPlayer(playerid,"~r~~h~OWNED",10000,1);
GetPlayerName(playerid, pname, sizeof(pname));
GetWeaponName(reason, deathreason, 20);
new pstring[128]; //player message
new killer[MAX_PLAYER_NAME];
GetPlayerName(killerid, killer, sizeof(killer));

if(InDM[playerid]==1) InDM[playerid]=0;
SetPlayerWorldBounds(playerid,20000.0000,-20000.0000,20000.0000,-20000.0000); //Reset world to player

:O
Reply
#5

I am trying to get the same thing, but you said if its = 0 stars, then the player color white, but what about if you have class 1 is set as yellow, this would keep it as white

- I tried the code, but it didn't work, no error, just nothing happens.
Reply
#6

bump
Reply
#7

Does anyone know?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)