Does not show wanted level on player...
#1

I have script rob system and now... When i rob any player there are 2 or 3-4 stairs, but i can't get new color as wanted level.... what is problem?

Код:
CMD:rob(playerid, params[])
{
	new id, string[126];
   	if(Ulogiran[playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "Nisi ovlascen da koristis ovu komandu");
  	if(gTeam[playerid] == TEAM_COP) return SendClientMessage(playerid, 0xFF0000FF, "Nisi ovlascen da koristis ovu komandu");
    if(gTeam[playerid] == TEAM_ARMY) return SendClientMessage(playerid, 0xFF0000FF, "Nisi ovlascen da koristis ovu komandu");
    if(gTeam[playerid] == TEAM_SWAT) return SendClientMessage(playerid, 0xFF0000FF, "Nisi ovlascen da koristis ovu komandu");
    if(gTeam[playerid] == TEAM_FBI) return SendClientMessage(playerid, 0xFF0000FF, "Nisi ovlascen da koristis ovu komandu");
    if(cuffed[playerid] == 1) return SCMF(playerid, 0xFF0000FF, "Ti posjedujes lisice na sebi i ne mozes koristiti ovu komandu");
	if(sscanf(params, "ui", id)) return SCM(playerid, 0xFF0000FF, "Koristi: /rob [id]");
	if(!IsPlayerConnected(id)) return SCM(playerid, 0xFF0000FF, "ID igraca koji ste unijeli nije online.");
 	if(IsPlayerInAnyVehicle(id)) return SCMF(playerid, 0xFF0000FF, "Igrac %s(%d) je u vozilu i nemozes njega opljackati",GetName(id),id);
 	if(IsPlayerInAnyVehicle(playerid)) return SCMF(playerid, 0xFF0000FF, "Ne mozes opljackati %s(%d) jer si u vozilu, napusti vozilo i pokusaj opet da ga opljackas",GetName(id),id);
 	if(GetDistanceBetweenPlayers(playerid,id) > 3) return SCMF(playerid, 0xFF0000FF, "Igrac %s(%d) je suvise daleko od tebe, probaj mu se pribliziti i opljackati",GetName(id),id);
    if(Ulogiran[id] == 0) return SCMF(playerid,  0xFF0000FF, "Igrac %s(%d) je mrtav, nemozes ga opljackati",GetName(id),id);
    if(cuffed[id] == 1) return SCMF(playerid, 0xFF0000FF, "Igrac %s(%d) posjeduje lisice na sebi i nemozes ga opljackati",GetName(id),id);
    if(GetPlayerMoney(id) <= 100) return SCMF(playerid, 0xFF0000FF, "Igrac %s(%d) ne posjeduje dovoljno novca da bi ga mogao opljackati",GetName(id),id);
    if(beenrobbedrecently[id] >= 1) return SCMF(playerid, 0xFF0000FF, "Igrac %s(%d) je nedavno opljackan. Pricekaj pa pokusaj ponovo",GetName(id),id);
    new rname[24];
    new vname[24];
    GetPlayerName(playerid,rname, 24);
	GetPlayerName(id, vname, 24);
    new pcash = random(GetPlayerMoney(id));
    format(string, sizeof(string), "%s(%d) Has robbed $%d from %s(%d)",rname,playerid,pcash,vname,id);
	printf("%s", string);
    GivePlayerMoney(playerid,pcash);
    GivePlayerMoney(id, -pcash);
    SendClientMessage(id, 0xA9A9A9AA, "|_Robbery Victim_|");
    format(string, sizeof(string), "%s(%d) Has robbed $%d from you", rname,playerid,pcash);
    SendClientMessage(id, 0xD2691EAA, string);
    SendClientMessage(playerid, 0xA9A9A9AA, "|_Robbery Complete_|");
    format(string, sizeof(string), "You have robbed $%d from %s(%d)", pcash,vname,id);
    SendClientMessage(playerid, 0x00C7FFAA, string);
    format(string, sizeof(string), "~w~Robbed by ~n~%s(%d)~n~$%d lost",rname,playerid,pcash);
    GameTextForPlayer(id,string,5000,3);
    oscore = GetPlayerScore(playerid);
	SetPlayerScore(playerid, oscore +1);
    format(string, sizeof(string), "~w~Robbed %s(%d)~n~$%d stolen",vname,id,pcash);
    GameTextForPlayer(playerid,string,5000,3);
    RobbedPlyRecent[playerid] =1;
    beenrobbedrecently[id] =120;
    new current_zone;
    current_zone = player_zone[playerid];
    format(string, sizeof(string), "DISPATCH: (ROBBERY) Suspect: %s(%d) has robbed %s(%d) Location: %s",rname,playerid,vname,id,zones[current_zone][zone_name]);
    HITMANSCM(-1, string);
    if(gTeam[id] == TEAM_COP || gTeam[id] == TEAM_ARMY) {
    new plwl = GetPlayerWantedLevel(playerid);
    SetPlayerWantedLevel(playerid, plwl +4 );
    }
    else{
    new plwl = GetPlayerWantedLevel(playerid);
    SetPlayerWantedLevel(playerid, plwl +2 );
    }
    new pcol = GetPlayerColor(playerid);
	new plwl = GetPlayerWantedLevel(playerid);
	SendClientMessage(playerid, 0xA9A9A9AA, "|_Crime Commited_|");
	format(string, sizeof(string), "(ROBBERY) Wanted Level %d",plwl);
	SendClientMessage(playerid,pcol,string);
	GetPlayerWantedLevel(playerid, pcol);

    return 1;
    }
and down..

Код:
public WantedYellow()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
	{
      if(Ulogiran[i] == 1)
	  {
        if(GetPlayerWantedLevel(i) >= 1 && GetPlayerWantedLevel(i) <= 3)
	    {
          SetPlayerColor(i, COLOR_YELLOW);
       }
    }
  }
}
//------------------------------------------------------------------------------
public WantedOrange()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
	{
	  if(Ulogiran[i] == 1)
	   {
        if(GetPlayerWantedLevel(i) >= 4 && GetPlayerWantedLevel(i) <= 9)
	    {
          SetPlayerColor(i, 0xFFA500AA);
       }
    }
  }
}
//------------------------------------------------------------------------------
public WantedRed()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
	{
     if(Ulogiran[i] == 1)
	  {
        if(GetPlayerWantedLevel(i) >= 10)
	    {
          SetPlayerColor(i, COLOR_RED);
       }
    }
  }
}
Can any good scripter fix this problem please?
Reply
#2

buimp!
Reply
#3

make it in 1 function why 3 separate.
pawn Код:
stock UpdateWantedColor()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
      if(Ulogiran[i] == 1)
        {
            if(GetPlayerWantedLevel(i) > 0 && GetPlayerWantedLevel(i) <= 3) {SetPlayerColor(i, COLOR_YELLOW);
            }else if(GetPlayerWantedLevel(i) > 0 && GetPlayerWantedLevel(i) <= 9) {SetPlayerColor(i, 0xFFA500AA);}
            }else if(GetPlayerWantedLevel(i) > 0 && GetPlayerWantedLevel(i) >= 10) {SetPlayerColor(i, COLOR_RED);}
        }
    }
}
and there is no code to actually update them ?
or its running somewhere else.
Reply
#4

Still my name's color is the same... If i choose civil and /rob any player, write color stay same... no as here... whats problem here, i don't know
Reply
#5

how do you Set the player color, how is the function called ?
Reply
#6

like up in cmd

Код:
  if(gTeam[id] == TEAM_COP || gTeam[id] == TEAM_ARMY) {
    new plwl = GetPlayerWantedLevel(playerid);
    SetPlayerWantedLevel(playerid, plwl +4 );
    }
    else{
    new plwl = GetPlayerWantedLevel(playerid);
    SetPlayerWantedLevel(playerid, plwl +2 );
    }
    new pcol = GetPlayerColor(playerid);
	new plwl = GetPlayerWantedLevel(playerid);
	SendClientMessage(playerid, 0xA9A9A9AA, "|_Crime Commited_|");
	format(string, sizeof(string), "(ROBBERY) Wanted Level %d",plwl);
	SendClientMessage(playerid,pcol,string);
	GetPlayerWantedLevel(playerid, pcol);
do you this mean?
Reply
#7

ok no, at the end of the "ROB" command just put
pawn Код:
UpdateWantedColor();
the function i wrote
Reply
#8

Thanks :P It good work now
Reply
#9

But when get wantd lvl and color, and after i death or lost wanted lvl, the wanted color still stay... i on playerspawn have for everyskin, for example: cop - blue, medic - pink, civil - write... and after i rob anyone i get wanted color and when i lost wanted lvl, color still stay the same, how can i bring back the colors which i get on playerspawn?
Reply
#10

bump!!!!!!!!!!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)