23.05.2012, 20:39
Hi SA-MP Community,
I made a most wanted player code. So when I have more than 1 players, I only get the first Textdraw filled with a persons name. Eg:- If I and my friends are playing and all have wanted levels, only the first Textdraw will have a name. How can I add more Textdraws to have name of 1st wanted player, 2nd wanted player.....
Here is my code:
I made a most wanted player code. So when I have more than 1 players, I only get the first Textdraw filled with a persons name. Eg:- If I and my friends are playing and all have wanted levels, only the first Textdraw will have a name. How can I add more Textdraws to have name of 1st wanted player, 2nd wanted player.....
Here is my code:
pawn Код:
new
playerWL[MAX_PLAYERS][Crime],
index
;
for(new i; i != MAX_PLAYERS; ++i) {
if(IsPlayerConnected(i) && !IsPlayerNPC(i)) {
playerWL[index][player_WantedLevel] = GetPlayerWantedLevel(i);
playerWL[index++][player_ID] = i;
}
}
GetPlayerHighestWantedLevel(playerWL, 0, index);
new
player_Name[20], string[24+MAX_PLAYER_NAME+1], player_Level[256];
for(new i; i < 5; ++i) {
if(i < index) {
GetPlayerName(playerWL[i][player_ID], player_Name, sizeof(player_Name));
format(string, sizeof(string), "~w~%s", player_Name);
format(player_Level, sizeof(player_Level), "%d", playerWL[i][player_WantedLevel]);
}
else
format(string, sizeof(string), "~r~N/A", player_Name);
}
TextDrawSetString(Textdraw38, player_Level);// level TD
TextDrawShowForPlayer(playerid, Textdraw38);
TextDrawSetString(Textdraw7, player_Name);//name TD
TextDrawShowForPlayer(playerid, Textdraw7);