format dialog? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: format dialog? (
/showthread.php?tid=446271)
format dialog? -
exclide1 - 25.06.2013
Hello. I'm trying to make this command show players that currently have hit on in a dialog, but it only shows one line. It's OK, if I use SendClientMessage(), but I want to show in a dialog! Here's the code:
pawn Код:
CMD:bounties(playerid, params[])
{
new message1[170];
new bounty = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pContract] > 0)
{
format(message1,sizeof(message1), "ID: %d %s, Bounty: $%d.", i, GetName(i), PlayerInfo[i][pContract]);
bounty++;
strcat(message1, "\n");
}
}
}
if(bounty >= 1)
ShowPlayerDialog(playerid,1337,DIALOG_STYLE_LIST,"Bounties!", message1, "Ok","Close");
if(bounty == 0)
SendClientMessage(playerid, -1, "No bounties at this moment.");
return 1;
}
Any tips for the newb?
Re: format dialog? -
AdamCooper - 25.06.2013
I have the same problem, any ideas?
Re: format dialog? -
Antonio144 - 25.06.2013
pawn Код:
CMD:bounties(playerid, params[])
{
new message1[170];
new message2[170];
new bounty = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pContract] > 0)
{
format(message1,sizeof(message1), "ID: %d %s, Bounty: $%d.\n", i, GetName(i), PlayerInfo[i][pContract]);
bounty++;
strcat(message2, message1);
}
}
}
if(bounty >= 1)
ShowPlayerDialog(playerid,1337,DIALOG_STYLE_LIST,"Bounties!", message2, "Ok","Close");
if(bounty == 0)
SendClientMessage(playerid, -1, "No bounties at this moment.");
return 1;
}
Re: format dialog? -
[MG]Dimi - 25.06.2013
Also 170 size string won't help you. You need larger.
Re: format dialog? -
AdamCooper - 25.06.2013
It still wont work, even with max strings. Shows only one
Re: format dialog? -
dEcooR - 25.06.2013
try this
Код:
CMD:bounties(playerid, params[])
{
new bounty = 0,bigstring[700],string[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pContract] > 0)
{
if(!IsPlayerNPC(i))
{
format(string,sizeof(string), "ID: %d Player: %s, Bounty: $%d.\n", i, GetName(i), PlayerInfo[i][pContract]);
bounty++;
strcat(bigstring, string);
}
}
}
if(bounty > 0) ShowPlayerDialog(playerid,1337,DIALOG_STYLE_LIST,"Bounties", bigstring, "Ok","Close");
else SendClientMessage(playerid, -1, "No bounties at this moment.");
return 1;
}
Re: format dialog? -
exclide1 - 25.06.2013
Quote:
Originally Posted by dEcooR
try this
|
Thank you, it works!