Two questions -
Proxus - 07.02.2019
Me again. I have two questions regarding scripting.
1. How can I get the total amount of wanted players online? I kinda know what to do but don't know how to put it into script, if that makes sense.
2. I want to display wanted players in a dialog, how would I go around doing this? I assume it's fairly similar to the above.
Thanks in advance. (:
Re: Two questions -
Lunoxx - 07.02.2019
Код:
// if you use foreach, you can use Iterators, read about that.
// if you use foreach, but you don`t want to use Iterators, you can make this:
// This will show your wanted players in a dialog.
new dialogStr[500], m, playerName[24];
foreach(new x: Player) {
if(pWantedPoints[x] > 0) {
m += 24;
GetPlayerName(x, playerName, 24);
format(dialogStr, m, "%s\n%s, dialogStr, playerName");
}
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "Wanted Players", dialogStr, "Ok", "");
}
// If you don`t use foreach, you have to replace "foreach(new x: Player)" with "for(new x = 0, y = GetPLayerPoolSize(); x != y; x++)"
+rep ?

)
Re: Two questions -
Hazon - 07.02.2019
Let's make an example with the VAR's. Once you are setting the player wanted level somewhere in your script do it like this, so you can check later what is the player wanted level.
Код:
SetPlayerWantedLevel(playerid, GetPVarInt(playerid, "WantedLevel")+1);
This would be the list of people who are wanted and their wanted level.
Код:
CMD:wantedlist(playerid)
{
new count=0, string[500];
format(string, sizeof(string), "");
foreach(new i : Player)
{
if(GetPVarInt(i, "WantedLevel") > 0)
{
format(string, sizeof(string), "%s%s Wanted Level: %d\n", string, GetPlayerName[i], GetPVarInt(i, "WantedLevel"));
count++;
}
}
if(count==0) SendClientMessage(playerid, -1, "* No players online with wanted level.");
else
ShowPlayerDialog(playerid, dialog_ID, DIALOG_STYLE_MSGBOX, "Wanted list", string, "Ok", "");
return 1;
}
Be sure to change some things in this code, this is just as an example.
Re: Two questions -
Proxus - 07.02.2019
I'll test both of your codes later and then give you the result. Also, I'll rep both of you now. Thanks!
Edit: I can only rep one of you because I repped other players. I'll rep when I can.
Re: Two questions -
MEGADETHS - 07.02.2019
There is probably a faster and easier way but this works.
This will show 20 playernames with wanted level lowest playerID ontop.
PHP код:
#define DIALOG_WANTEDPLAYERS 1
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/wantedplayers", true))
{
new TotalWantedPlayers = 0;
new PlayerCheck = 0;
new StringSlot = 1;
new NameSlot1[64];
new NameSlot2[64];
new NameSlot3[64];
new NameSlot4[64];
new NameSlot5[64];
new NameSlot6[64];
new NameSlot7[64];
new NameSlot8[64];
new NameSlot9[64];
new NameSlot10[64];
new NameSlot11[64];
new NameSlot12[64];
new NameSlot13[64];
new NameSlot14[64];
new NameSlot15[64];
new NameSlot16[64];
new NameSlot17[64];
new NameSlot18[64];
new NameSlot19[64];
new NameSlot20[64];
while(PlayerCheck<MAX_PLAYERS && StringSlot < 21)
{
if(GetPlayerWantedLevel(PlayerCheck) > 0)
{
if(StringSlot == 1)
{
GetPlayerName(playerid, NameSlot1, MAX_PLAYER_NAME+1);
}
if(StringSlot == 2)
{
GetPlayerName(playerid, NameSlot2, MAX_PLAYER_NAME+1);
}
if(StringSlot == 3)
{
GetPlayerName(playerid, NameSlot3, MAX_PLAYER_NAME+1);
}
if(StringSlot == 4)
{
GetPlayerName(playerid, NameSlot4, MAX_PLAYER_NAME+1);
}
if(StringSlot == 5)
{
GetPlayerName(playerid, NameSlot5, MAX_PLAYER_NAME+1);
}
if(StringSlot == 6)
{
GetPlayerName(playerid, NameSlot6, MAX_PLAYER_NAME+1);
}
if(StringSlot == 7)
{
GetPlayerName(playerid, NameSlot7, MAX_PLAYER_NAME+1);
}
if(StringSlot == 8)
{
GetPlayerName(playerid, NameSlot8, MAX_PLAYER_NAME+1);
}
if(StringSlot == 9)
{
GetPlayerName(playerid, NameSlot9, MAX_PLAYER_NAME+1);
}
if(StringSlot == 10)
{
GetPlayerName(playerid, NameSlot10, MAX_PLAYER_NAME+1);
}
if(StringSlot == 11)
{
GetPlayerName(playerid, NameSlot11, MAX_PLAYER_NAME+1);
}
if(StringSlot == 12)
{
GetPlayerName(playerid, NameSlot12, MAX_PLAYER_NAME+1);
}
if(StringSlot == 13)
{
GetPlayerName(playerid, NameSlot13, MAX_PLAYER_NAME+1);
}
if(StringSlot == 14)
{
GetPlayerName(playerid, NameSlot14, MAX_PLAYER_NAME+1);
}
if(StringSlot == 15)
{
GetPlayerName(playerid, NameSlot15, MAX_PLAYER_NAME+1);
}
if(StringSlot == 16)
{
GetPlayerName(playerid, NameSlot16, MAX_PLAYER_NAME+1);
}
if(StringSlot == 17)
{
GetPlayerName(playerid, NameSlot17, MAX_PLAYER_NAME+1);
}
if(StringSlot == 18)
{
GetPlayerName(playerid, NameSlot18, MAX_PLAYER_NAME+1);
}
if(StringSlot == 19)
{
GetPlayerName(playerid, NameSlot19, MAX_PLAYER_NAME+1);
}
if(StringSlot == 20)
{
GetPlayerName(playerid, NameSlot20, MAX_PLAYER_NAME+1);
}
StringSlot = StringSlot+1;
TotalWantedPlayers = TotalWantedPlayers+1;
}
PlayerCheck = PlayerCheck+1;
}
new string[256];
format(string,sizeof(string),"Total wanted players: %d", TotalWantedPlayers);
SendClientMessage(playerid,-1,string);
new TwentyNamesString[1280];
format(TwentyNamesString,sizeof TwentyNamesString,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",NameSlot1,NameSlot2,NameSlot3,NameSlot4,NameSlot5,NameSlot6,NameSlot7,NameSlot8,NameSlot9,NameSlot10,NameSlot11,NameSlot12,NameSlot13,NameSlot14,NameSlot15,NameSlot16,NameSlot17,NameSlot18,NameSlot19,NameSlot20);
ShowPlayerDialog(playerid, DIALOG_WANTEDPLAYERS, DIALOG_STYLE_MSGBOX, "Wanted Players", TwentyNamesString, "Close", "");
return 1;
}
return 0;
}
Re: Two questions -
Bolex_ - 07.02.2019
Quote:
Originally Posted by MEGADETHS
There is probably a faster and easier way but this works.
This will show 20 playernames with wanted level lowest playerID ontop.
PHP код:
#define DIALOG_WANTEDPLAYERS 1
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/wantedplayers", true))
{
new TotalWantedPlayers = 0;
new PlayerCheck = 0;
new StringSlot = 1;
new NameSlot1[64];
new NameSlot2[64];
new NameSlot3[64];
new NameSlot4[64];
new NameSlot5[64];
new NameSlot6[64];
new NameSlot7[64];
new NameSlot8[64];
new NameSlot9[64];
new NameSlot10[64];
new NameSlot11[64];
new NameSlot12[64];
new NameSlot13[64];
new NameSlot14[64];
new NameSlot15[64];
new NameSlot16[64];
new NameSlot17[64];
new NameSlot18[64];
new NameSlot19[64];
new NameSlot20[64];
while(PlayerCheck<MAX_PLAYERS && StringSlot < 21)
{
if(GetPlayerWantedLevel(PlayerCheck) > 0)
{
if(StringSlot == 1)
{
GetPlayerName(playerid, NameSlot1, MAX_PLAYER_NAME+1);
}
if(StringSlot == 2)
{
GetPlayerName(playerid, NameSlot2, MAX_PLAYER_NAME+1);
}
if(StringSlot == 3)
{
GetPlayerName(playerid, NameSlot3, MAX_PLAYER_NAME+1);
}
if(StringSlot == 4)
{
GetPlayerName(playerid, NameSlot4, MAX_PLAYER_NAME+1);
}
if(StringSlot == 5)
{
GetPlayerName(playerid, NameSlot5, MAX_PLAYER_NAME+1);
}
if(StringSlot == 6)
{
GetPlayerName(playerid, NameSlot6, MAX_PLAYER_NAME+1);
}
if(StringSlot == 7)
{
GetPlayerName(playerid, NameSlot7, MAX_PLAYER_NAME+1);
}
if(StringSlot == 8)
{
GetPlayerName(playerid, NameSlot8, MAX_PLAYER_NAME+1);
}
if(StringSlot == 9)
{
GetPlayerName(playerid, NameSlot9, MAX_PLAYER_NAME+1);
}
if(StringSlot == 10)
{
GetPlayerName(playerid, NameSlot10, MAX_PLAYER_NAME+1);
}
if(StringSlot == 11)
{
GetPlayerName(playerid, NameSlot11, MAX_PLAYER_NAME+1);
}
if(StringSlot == 12)
{
GetPlayerName(playerid, NameSlot12, MAX_PLAYER_NAME+1);
}
if(StringSlot == 13)
{
GetPlayerName(playerid, NameSlot13, MAX_PLAYER_NAME+1);
}
if(StringSlot == 14)
{
GetPlayerName(playerid, NameSlot14, MAX_PLAYER_NAME+1);
}
if(StringSlot == 15)
{
GetPlayerName(playerid, NameSlot15, MAX_PLAYER_NAME+1);
}
if(StringSlot == 16)
{
GetPlayerName(playerid, NameSlot16, MAX_PLAYER_NAME+1);
}
if(StringSlot == 17)
{
GetPlayerName(playerid, NameSlot17, MAX_PLAYER_NAME+1);
}
if(StringSlot == 18)
{
GetPlayerName(playerid, NameSlot18, MAX_PLAYER_NAME+1);
}
if(StringSlot == 19)
{
GetPlayerName(playerid, NameSlot19, MAX_PLAYER_NAME+1);
}
if(StringSlot == 20)
{
GetPlayerName(playerid, NameSlot20, MAX_PLAYER_NAME+1);
}
StringSlot = StringSlot+1;
TotalWantedPlayers = TotalWantedPlayers+1;
}
PlayerCheck = PlayerCheck+1;
}
new string[256];
format(string,sizeof(string),"Total wanted players: %d", TotalWantedPlayers);
SendClientMessage(playerid,-1,string);
new TwentyNamesString[1280];
format(TwentyNamesString,sizeof TwentyNamesString,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",NameSlot1,NameSlot2,NameSlot3,NameSlot4,NameSlot5,NameSlot6,NameSlot7,NameSlot8,NameSlot9,NameSlot10,NameSlot11,NameSlot12,NameSlot13,NameSlot14,NameSlot15,NameSlot16,NameSlot17,NameSlot18,NameSlot19,NameSlot20);
ShowPlayerDialog(playerid, DIALOG_WANTEDPLAYERS, DIALOG_STYLE_MSGBOX, "Wanted Players", TwentyNamesString, "Close", "");
return 1;
}
return 0;
}
|
'Faster and Easier' ?
Take a knife and stab yourself, something like this isn't even for a half-star.
Re: Two questions -
Dayrion - 07.02.2019
Quote:
Originally Posted by Bolex_
'Faster and Easier' ?
Take a knife and stab yourself, something like this isn't even for a half-star.
|
And the way you answered him is worse than everything. Moderate your language, please.
Re: Two questions -
Hazon - 07.02.2019
Quote:
Originally Posted by Dayrion
And the way you answered him is worse than everything. Moderate your language, please.
|
Speaking of how to behave @Dayrion, your history is 'very clear'.

Re: Two questions -
TheToretto - 07.02.2019
Quote:
Originally Posted by MEGADETHS
There is probably a faster and easier way but this works.
This will show 20 playernames with wanted level lowest playerID ontop.
PHP код:
#define DIALOG_WANTEDPLAYERS 1
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/wantedplayers", true))
{
new TotalWantedPlayers = 0;
new PlayerCheck = 0;
new StringSlot = 1;
new NameSlot1[64];
new NameSlot2[64];
new NameSlot3[64];
new NameSlot4[64];
new NameSlot5[64];
new NameSlot6[64];
new NameSlot7[64];
new NameSlot8[64];
new NameSlot9[64];
new NameSlot10[64];
new NameSlot11[64];
new NameSlot12[64];
new NameSlot13[64];
new NameSlot14[64];
new NameSlot15[64];
new NameSlot16[64];
new NameSlot17[64];
new NameSlot18[64];
new NameSlot19[64];
new NameSlot20[64];
while(PlayerCheck<MAX_PLAYERS && StringSlot < 21)
{
if(GetPlayerWantedLevel(PlayerCheck) > 0)
{
if(StringSlot == 1)
{
GetPlayerName(playerid, NameSlot1, MAX_PLAYER_NAME+1);
}
if(StringSlot == 2)
{
GetPlayerName(playerid, NameSlot2, MAX_PLAYER_NAME+1);
}
if(StringSlot == 3)
{
GetPlayerName(playerid, NameSlot3, MAX_PLAYER_NAME+1);
}
if(StringSlot == 4)
{
GetPlayerName(playerid, NameSlot4, MAX_PLAYER_NAME+1);
}
if(StringSlot == 5)
{
GetPlayerName(playerid, NameSlot5, MAX_PLAYER_NAME+1);
}
if(StringSlot == 6)
{
GetPlayerName(playerid, NameSlot6, MAX_PLAYER_NAME+1);
}
if(StringSlot == 7)
{
GetPlayerName(playerid, NameSlot7, MAX_PLAYER_NAME+1);
}
if(StringSlot == 8)
{
GetPlayerName(playerid, NameSlot8, MAX_PLAYER_NAME+1);
}
if(StringSlot == 9)
{
GetPlayerName(playerid, NameSlot9, MAX_PLAYER_NAME+1);
}
if(StringSlot == 10)
{
GetPlayerName(playerid, NameSlot10, MAX_PLAYER_NAME+1);
}
if(StringSlot == 11)
{
GetPlayerName(playerid, NameSlot11, MAX_PLAYER_NAME+1);
}
if(StringSlot == 12)
{
GetPlayerName(playerid, NameSlot12, MAX_PLAYER_NAME+1);
}
if(StringSlot == 13)
{
GetPlayerName(playerid, NameSlot13, MAX_PLAYER_NAME+1);
}
if(StringSlot == 14)
{
GetPlayerName(playerid, NameSlot14, MAX_PLAYER_NAME+1);
}
if(StringSlot == 15)
{
GetPlayerName(playerid, NameSlot15, MAX_PLAYER_NAME+1);
}
if(StringSlot == 16)
{
GetPlayerName(playerid, NameSlot16, MAX_PLAYER_NAME+1);
}
if(StringSlot == 17)
{
GetPlayerName(playerid, NameSlot17, MAX_PLAYER_NAME+1);
}
if(StringSlot == 18)
{
GetPlayerName(playerid, NameSlot18, MAX_PLAYER_NAME+1);
}
if(StringSlot == 19)
{
GetPlayerName(playerid, NameSlot19, MAX_PLAYER_NAME+1);
}
if(StringSlot == 20)
{
GetPlayerName(playerid, NameSlot20, MAX_PLAYER_NAME+1);
}
StringSlot = StringSlot+1;
TotalWantedPlayers = TotalWantedPlayers+1;
}
PlayerCheck = PlayerCheck+1;
}
new string[256];
format(string,sizeof(string),"Total wanted players: %d", TotalWantedPlayers);
SendClientMessage(playerid,-1,string);
new TwentyNamesString[1280];
format(TwentyNamesString,sizeof TwentyNamesString,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",NameSlot1,NameSlot2,NameSlot3,NameSlot4,NameSlot5,NameSlot6,NameSlot7,NameSlot8,NameSlot9,NameSlot10,NameSlot11,NameSlot12,NameSlot13,NameSlot14,NameSlot15,NameSlot16,NameSlot17,NameSlot18,NameSlot19,NameSlot20);
ShowPlayerDialog(playerid, DIALOG_WANTEDPLAYERS, DIALOG_STYLE_MSGBOX, "Wanted Players", TwentyNamesString, "Close", "");
return 1;
}
return 0;
}
|
WOW YOU MADE MY DAY
Re: Two questions -
TheToretto - 07.02.2019
That's more like a whose script is better contest
Re: Two questions -
Kasichok - 07.02.2019
Quote:
Originally Posted by TheToretto
That's more like a whose script is better contest
|
Obviously this one:
Quote:
Originally Posted by MEGADETHS
There is probably a faster and easier way but this works.
This will show 20 playernames with wanted level lowest playerID ontop.
PHP код:
#define DIALOG_WANTEDPLAYERS 1
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/wantedplayers", true))
{
new TotalWantedPlayers = 0;
new PlayerCheck = 0;
new StringSlot = 1;
new NameSlot1[64];
new NameSlot2[64];
new NameSlot3[64];
new NameSlot4[64];
new NameSlot5[64];
new NameSlot6[64];
new NameSlot7[64];
new NameSlot8[64];
new NameSlot9[64];
new NameSlot10[64];
new NameSlot11[64];
new NameSlot12[64];
new NameSlot13[64];
new NameSlot14[64];
new NameSlot15[64];
new NameSlot16[64];
new NameSlot17[64];
new NameSlot18[64];
new NameSlot19[64];
new NameSlot20[64];
while(PlayerCheck<MAX_PLAYERS && StringSlot < 21)
{
if(GetPlayerWantedLevel(PlayerCheck) > 0)
{
if(StringSlot == 1)
{
GetPlayerName(playerid, NameSlot1, MAX_PLAYER_NAME+1);
}
if(StringSlot == 2)
{
GetPlayerName(playerid, NameSlot2, MAX_PLAYER_NAME+1);
}
if(StringSlot == 3)
{
GetPlayerName(playerid, NameSlot3, MAX_PLAYER_NAME+1);
}
if(StringSlot == 4)
{
GetPlayerName(playerid, NameSlot4, MAX_PLAYER_NAME+1);
}
if(StringSlot == 5)
{
GetPlayerName(playerid, NameSlot5, MAX_PLAYER_NAME+1);
}
if(StringSlot == 6)
{
GetPlayerName(playerid, NameSlot6, MAX_PLAYER_NAME+1);
}
if(StringSlot == 7)
{
GetPlayerName(playerid, NameSlot7, MAX_PLAYER_NAME+1);
}
if(StringSlot == 8)
{
GetPlayerName(playerid, NameSlot8, MAX_PLAYER_NAME+1);
}
if(StringSlot == 9)
{
GetPlayerName(playerid, NameSlot9, MAX_PLAYER_NAME+1);
}
if(StringSlot == 10)
{
GetPlayerName(playerid, NameSlot10, MAX_PLAYER_NAME+1);
}
if(StringSlot == 11)
{
GetPlayerName(playerid, NameSlot11, MAX_PLAYER_NAME+1);
}
if(StringSlot == 12)
{
GetPlayerName(playerid, NameSlot12, MAX_PLAYER_NAME+1);
}
if(StringSlot == 13)
{
GetPlayerName(playerid, NameSlot13, MAX_PLAYER_NAME+1);
}
if(StringSlot == 14)
{
GetPlayerName(playerid, NameSlot14, MAX_PLAYER_NAME+1);
}
if(StringSlot == 15)
{
GetPlayerName(playerid, NameSlot15, MAX_PLAYER_NAME+1);
}
if(StringSlot == 16)
{
GetPlayerName(playerid, NameSlot16, MAX_PLAYER_NAME+1);
}
if(StringSlot == 17)
{
GetPlayerName(playerid, NameSlot17, MAX_PLAYER_NAME+1);
}
if(StringSlot == 18)
{
GetPlayerName(playerid, NameSlot18, MAX_PLAYER_NAME+1);
}
if(StringSlot == 19)
{
GetPlayerName(playerid, NameSlot19, MAX_PLAYER_NAME+1);
}
if(StringSlot == 20)
{
GetPlayerName(playerid, NameSlot20, MAX_PLAYER_NAME+1);
}
StringSlot = StringSlot+1;
TotalWantedPlayers = TotalWantedPlayers+1;
}
PlayerCheck = PlayerCheck+1;
}
new string[256];
format(string,sizeof(string),"Total wanted players: %d", TotalWantedPlayers);
SendClientMessage(playerid,-1,string);
new TwentyNamesString[1280];
format(TwentyNamesString,sizeof TwentyNamesString,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",NameSlot1,NameSlot2,NameSlot3,NameSlot4,NameSlot5,NameSlot6,NameSlot7,NameSlot8,NameSlot9,NameSlot10,NameSlot11,NameSlot12,NameSlot13,NameSlot14,NameSlot15,NameSlot16,NameSlot17,NameSlot18,NameSlot19,NameSlot20);
ShowPlayerDialog(playerid, DIALOG_WANTEDPLAYERS, DIALOG_STYLE_MSGBOX, "Wanted Players", TwentyNamesString, "Close", "");
return 1;
}
return 0;
}
|
Re: Two questions -
MEGADETHS - 07.02.2019
Quote:
Originally Posted by Bolex_
'Faster and Easier' ?
Take a knife and stab yourself, something like this isn't even for a half-star.
|
It wasn't meant to be a 5 star answer, I also don't recall asking your opinion.
Re: Two questions -
Proxus - 07.02.2019
This turned from a question to a war real fast lol
Re: Two questions -
AhmedMohamed - 07.02.2019
Believe me this is the best answer:
Quote:
Originally Posted by Kasichok
The guys from up i dont know whats wrong with them one never heard of loops the other uses pvar for some reason instead of just checking if player is wanted
pawn Код:
CMD:wanted(playerid) { new count = 0, string[500], name[26]; format(string, 500, ""); for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++) { if(GetPlayerWantedLevel(i) < 1) continue; count ++; GetPlayerName(i, name, 24); format(name, 500, "%s\n", name); strcat(string, name); } if(count > 0) { ShowPlayerDialog(playerid, 1200, DIALOG_STYLE_LIST, "Wanted Players", string, "Ok", "Cancel"); } else { SendClientMessage(playerid, 0xFF0000FF, "No one wanted"); } return 1; }
|
Re: Two questions -
TheToretto - 07.02.2019
no megadeths
Re: Two questions -
SymonClash - 07.02.2019
Quote:
Originally Posted by MEGADETHS
There is probably a faster and easier way but this works.
This will show 20 playernames with wanted level lowest playerID ontop.
PHP код:
#define DIALOG_WANTEDPLAYERS 1
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/wantedplayers", true))
{
new TotalWantedPlayers = 0;
new PlayerCheck = 0;
new StringSlot = 1;
new NameSlot1[64];
new NameSlot2[64];
new NameSlot3[64];
new NameSlot4[64];
new NameSlot5[64];
new NameSlot6[64];
new NameSlot7[64];
new NameSlot8[64];
new NameSlot9[64];
new NameSlot10[64];
new NameSlot11[64];
new NameSlot12[64];
new NameSlot13[64];
new NameSlot14[64];
new NameSlot15[64];
new NameSlot16[64];
new NameSlot17[64];
new NameSlot18[64];
new NameSlot19[64];
new NameSlot20[64];
while(PlayerCheck<MAX_PLAYERS && StringSlot < 21)
{
if(GetPlayerWantedLevel(PlayerCheck) > 0)
{
if(StringSlot == 1)
{
GetPlayerName(playerid, NameSlot1, MAX_PLAYER_NAME+1);
}
if(StringSlot == 2)
{
GetPlayerName(playerid, NameSlot2, MAX_PLAYER_NAME+1);
}
if(StringSlot == 3)
{
GetPlayerName(playerid, NameSlot3, MAX_PLAYER_NAME+1);
}
if(StringSlot == 4)
{
GetPlayerName(playerid, NameSlot4, MAX_PLAYER_NAME+1);
}
if(StringSlot == 5)
{
GetPlayerName(playerid, NameSlot5, MAX_PLAYER_NAME+1);
}
if(StringSlot == 6)
{
GetPlayerName(playerid, NameSlot6, MAX_PLAYER_NAME+1);
}
if(StringSlot == 7)
{
GetPlayerName(playerid, NameSlot7, MAX_PLAYER_NAME+1);
}
if(StringSlot == 8)
{
GetPlayerName(playerid, NameSlot8, MAX_PLAYER_NAME+1);
}
if(StringSlot == 9)
{
GetPlayerName(playerid, NameSlot9, MAX_PLAYER_NAME+1);
}
if(StringSlot == 10)
{
GetPlayerName(playerid, NameSlot10, MAX_PLAYER_NAME+1);
}
if(StringSlot == 11)
{
GetPlayerName(playerid, NameSlot11, MAX_PLAYER_NAME+1);
}
if(StringSlot == 12)
{
GetPlayerName(playerid, NameSlot12, MAX_PLAYER_NAME+1);
}
if(StringSlot == 13)
{
GetPlayerName(playerid, NameSlot13, MAX_PLAYER_NAME+1);
}
if(StringSlot == 14)
{
GetPlayerName(playerid, NameSlot14, MAX_PLAYER_NAME+1);
}
if(StringSlot == 15)
{
GetPlayerName(playerid, NameSlot15, MAX_PLAYER_NAME+1);
}
if(StringSlot == 16)
{
GetPlayerName(playerid, NameSlot16, MAX_PLAYER_NAME+1);
}
if(StringSlot == 17)
{
GetPlayerName(playerid, NameSlot17, MAX_PLAYER_NAME+1);
}
if(StringSlot == 18)
{
GetPlayerName(playerid, NameSlot18, MAX_PLAYER_NAME+1);
}
if(StringSlot == 19)
{
GetPlayerName(playerid, NameSlot19, MAX_PLAYER_NAME+1);
}
if(StringSlot == 20)
{
GetPlayerName(playerid, NameSlot20, MAX_PLAYER_NAME+1);
}
StringSlot = StringSlot+1;
TotalWantedPlayers = TotalWantedPlayers+1;
}
PlayerCheck = PlayerCheck+1;
}
new string[256];
format(string,sizeof(string),"Total wanted players: %d", TotalWantedPlayers);
SendClientMessage(playerid,-1,string);
new TwentyNamesString[1280];
format(TwentyNamesString,sizeof TwentyNamesString,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",NameSlot1,NameSlot2,NameSlot3,NameSlot4,NameSlot5,NameSlot6,NameSlot7,NameSlot8,NameSlot9,NameSlot10,NameSlot11,NameSlot12,NameSlot13,NameSlot14,NameSlot15,NameSlot16,NameSlot17,NameSlot18,NameSlot19,NameSlot20);
ShowPlayerDialog(playerid, DIALOG_WANTEDPLAYERS, DIALOG_STYLE_MSGBOX, "Wanted Players", TwentyNamesString, "Close", "");
return 1;
}
return 0;
}
|
what did I just read
i'm not even drunk
@Kasichok: A string size of 500? Also according to Sa-Mp limits, MAX_PLAYER_NAME is 24 not 26
damn i have to print this topic
Re: Two questions -
Kasichok - 08.02.2019
Quote:
Originally Posted by SymonClash
what did I just read
i'm not even drunk
@Kasichok: A string size of 500? Also according to Sa-Mp limits, MAX_PLAYER_NAME is 24 not 26
damn i have to print this topic
|
i use new line \n with the name 24+2=26
\n%s, now string of 500 yes imagine there are 100 wanted players in the server so 26*100=260 and there could be even more.
Re: Two questions -
Proxus - 08.02.2019
Slightly puzzled what script is better. However, has anyone attempted to get the amount of wanted players and display it in a textdraw? That was the other question. Another debate? :thonk:
Re: Two questions -
TheToretto - 08.02.2019
Inside of the format add an argument which will be
Код:
GetPlayerWantedLevel(i)
To be formatted with the specifier "%i"
Feel free to add a new column to the dialog if you want, or all in one line with the player's name
Re: Two questions -
Proxus - 08.02.2019
Quote:
Originally Posted by TheToretto
Inside of the format add an argument which will be
Код:
GetPlayerWantedLevel(i)
To be formatted with the specifier "%i"
Feel free to add a new column to the dialog if you want, or all in one line with the player's name
|
Thanks but that wasn't what I was asking. I wanted to get the amount of wanted players and then change this 0 to the amount of wanted players. If there are 4 people with a wanted level, it will show 4. If there is 1 person with a wanted level, it would show 1, etc, etc.
https://imgur.com/a/40WnVL4 - image
Edit: Realised you might be talking about the other question or to someone else. Not sure though.