loop with dialogue - 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: loop with dialogue (
/showthread.php?tid=581273)
loop with dialogue -
SukMathcuck - 11.07.2015
Hello! I have a problem, like the image shown below, the dialog skips a line and show what should be shown, over the first line of dialogue I get the error, how can I fix?
PHP код:
if (strcmp(cmd, "/admins", true) == 0)
{
new count = 0, dialog1[1000], adm[25];
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if (AccountData[i][pAdmin] >= 0)
{
if (ModociaAdm3000[i] == 0)
{
switch (AccountData[i][pAdmDuty])
{
case 0:
{
if (AccountData[i][pAdmin] == 0)
{
format(adm, sizeof dialog1, "Moderador: %s [Trabalhando]\n", GetPlayerNameRP(i));
strcat(dialog1, adm, sizeof dialog1);
count++;
}
else if (AccountData[i][pAdmin] >= 1)
{
format(adm, sizeof dialog1, "Admin [%d]: %s [Trabalhando]\n", AccountData[i][pAdmin], GetPlayerNameRP(i));
strcat(dialog1, adm, sizeof dialog1);
count++;
}
}
case 1:
{
if (AccountData[i][pAdmin] == 0)
{
format(adm, sizeof dialog1, "Moderador: %s [Jogando]\n", GetPlayerNameRP(i));
strcat(dialog1, adm, sizeof dialog1);
count++;
}
else if (AccountData[i][pAdmin] >= 1)
{
format(adm, sizeof dialog1, "Admin [%d]: %s [Jogando]\n", AccountData[i][pAdmin], GetPlayerNameRP(i));
strcat(dialog1, adm, sizeof dialog1);
count++;
}
}
}
}
}
if (count == 0) ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "ERRO", "Nгo hб nenhum admin/moderador online", "Fechar", "");
}
}
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "Administraзгo", dialog1, "Fechar", "");
return 1;
}
Re: loop with dialogue -
SukMathcuck - 12.07.2015
up!!!!
Re : loop with dialogue -
KillerDVX - 12.07.2015
What error you've getting ?
Re: Re : loop with dialogue -
SukMathcuck - 12.07.2015
Quote:
Originally Posted by KillerDVX
What error you've getting ?
|
Hello friend, the error is above, shows
in [Trabalho]
Re: loop with dialogue -
youssefehab500 - 12.07.2015
I don't get your problem, please illustrate more.
Re : loop with dialogue -
KillerDVX - 12.07.2015
[I]
Would you try this code ? :
PHP код:
if (strcmp(cmd, "/admins", true) == 0)
{
new count = 0, dialog1[1000], adm[25], adm1[25];
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if (AccountData[i][pAdmin] >= 0)
{
if (ModociaAdm3000[i] == 0)
{
switch (AccountData[i][pAdmDuty])
{
case 0:
{
if (AccountData[i][pAdmin] == 0)
{
format(adm, sizeof dialog1, "Moderador: %s [Trabalhando]\n", GetPlayerNameRP(i));
strcat(dialog1, adm1, sizeof dialog1);
count++;
}
else if (AccountData[i][pAdmin] >= 1)
{
format(adm, sizeof dialog1, "Admin [%d]: %s [Trabalhando]\n", AccountData[i][pAdmin], GetPlayerNameRP(i));
strcat(dialog1, adm1, sizeof dialog1);
count++;
}
}
case 1:
{
if (AccountData[i][pAdmin] == 0)
{
format(adm, sizeof dialog1, "Moderador: %s [Jogando]\n", GetPlayerNameRP(i));
strcat(dialog1, adm1, sizeof dialog1);
count++;
}
else if (AccountData[i][pAdmin] >= 1)
{
format(adm, sizeof dialog1, "Admin [%d]: %s [Jogando]\n", AccountData[i][pAdmin], GetPlayerNameRP(i));
strcat(dialog1, adm1, sizeof dialog1);
count++;
}
}
}
}
}
if (count == 0) ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "ERRO", "Nгo hб nenhum admin/moderador online", "Fechar", "");
}
}
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "Administraзгo", dialog1, "Fechar", "");
return 1;
} [/i]
Not pretty sure, but just try it ^^
KillerDVX,
Re: loop with dialogue -
liquor - 12.07.2015
So, what you're probably doing wrong is expecting his playername (up to 24 chars), and the administration rank (~ 11 chars including ':' and space ' '), + [Trabalhando] which is 14 chars including space ' '...
All of this adds up to ~50 chars, so why don't you set it to at least that
and also change
pawn Код:
format(adm, sizeof dialog1,
to
(There is no way you will need 1000 bytes in the 'adm' array)