28.06.2012, 07:39
I really dont know what script that list the most wanted player in highest to lowest.
Or this??
Код HTML:
CMD:wantedlist(playerid, params[]) { new DialogString[400], WantedLevel[MAX_PLAYERS], tmpwanted, count=0; for(new i=0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { tmpwanted = GetPlayerWantedLevel(i); if(tmpwanted > 0) { WantedLevel[i] = tmpwanted; count++; } } } BubbleSort(WantedLevel, 0, MAX_PLAYERS); new name[MAX_PLAYER_NAME], string[35]; if(count != 0) { for(new i=0; i < MAX_PLAYERS; i++) { if(WantedLevel[i] > 0) { GetPlayerName(i, name, sizeof(name)); format(string, sizeof(string), "%d. %s - %d\n", i+1, name, GetPlayerWantedLevel(i)); strcat(DialogString, string, sizeof(DialogString)); } } } else format(DialogString, sizeof(DialogString), "No wanted players online."); ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Wanted List", DialogString, "Ok", ""); return 1; } stock BubbleSort(Array[], begin, end) //at least similar { new tmpslot=0, bool:swapped; do { swapped = false; for(new index=begin+1; index < end; index++) { if(Array[index-1] > Array[index]) { tmpslot = Array[index]; Array[index] = Array[index-1]; Array[index-1] = tmpslot; swapped = true; } } } while(swapped); }
Код HTML:
CMD:mwp(playerid, params[])
{
new count = 1, name[24], string[200];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
GetPlayerWantedLevel(i);
if(GetPlayerWantedLevel(i) >= 5)
{
GetPlayerName(i, name, sizeof(name));
format(string, sizeof(string), "%s%s (%d) - Wanted Level: %d\n", string, name,i,GetPlayerWantedLevel(i));
count ++;
}
}
if(count != 1)
{
ShowPlayerDialog(playerid, 26, DIALOG_STYLE_MSGBOX, "Most Wanted Players Online", string, "OK", "");
}
else ShowPlayerDialog(playerid, 26, DIALOG_STYLE_MSGBOX, "Most Wanted Players Online", "No online wanted players.", "OK", "");
return 1;
}