11.08.2011, 22:56
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/Wanted", cmdtext, true, 10) == 0) { if (GetPlayerTeam(playerid) == TEAM_GANG) { SendClientMessage(playerid, -1, "You are not part of the police"); } else if (GetPlayerTeam(playerid) == TEAM_POLICE) { new count, namestr[MAX_PLAYER_NAME], string[128];//64 is too much since the max length of a name is like ~20 for(new i; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(GetPlayerWantedLevel(i)!=0) { count++; GetPlayerName(i,namestr,MAX_PLAYER_NAME); if(!strlen(string)) { format(string,sizeof(string),"%s level: %d",namestr,GetPlayerWantedLevel(i)); format(string,sizeof(string),"\n%s level: %d",namestr,GetPlayerWantedLevel(i)); } } } } //also you'd use ShowPlayerDialog outside of the loop, just after it's finished ShowPlayerDialog(playerid,500, DIALOG_STYLE_MSGBOX, "Wanted List.",string,"Ok", "Cancel"); if(count == 0)return SendClientMessage(playerid,-1,"There are no wanted Players"); } return 1; } return 1; }