Dialog for all players
#1

Uh how do I make so when the admin type a command it will show a dialog for all players? I mean.. how do I define playerersid as all players so I can use that to show the dialog.
Reply
#2

loop through all players
Reply
#3

Oh right, thanks.
Reply
#4

Код:
CMD:credits(playerid, params[])
{
	new creditt;
    for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(PlayerInfo[i][pAdministrator] == 0)
		{
			SendClientMessage(i, -1, "Multumesc ca ati jucat pe server, Andrei.");
			strcat(creditt, "Serverul a scapat de sub control si a devenit un total Deathmatch.\n");
			strcat(creditt, "Am incerc sa il schimb in bine dar se pare ca nu se poate.\n");
			strcat(creditt, "Si se pare ca la administratori le place sa dea arme la playeri.\n");
			strcat(creditt, "Credits: Andrei - Scripting (Skype: andreiwow2).\n");
			strcat(creditt, "Credits: Dom - Mapping.\n");
			strcat(creditt, "Credits: Predator69 - Host.\n");
			strcat(creditt, "Credits: Werty. - Host forum .\n");
			strcat(creditt, "Credits: PiNNgu - A ajutat cu privirea\n");
			ShowPlayerDialog(playerid, 20312, DIALOG_STYLE_MSGBOX, "Credits", creditt, "LOVE", "");
		}
		else
		{
			SendClientMessage(i, -1, "Multumesc ca ati jucat pe server, Andrei.);
			strcat(creditt, "Serverul a scapat de sub control si a devenit un total Deathmatch.\n");
			strcat(creditt, "Am incerc sa il schimb in bine dar se pare ca nu se poate.\n");
			strcat(creditt, "Si se pare ca la administratori le place sa dea arme la playeri.\n");
			strcat(creditt, "Credits: Andrei - Scripting (Skype: andreiwow2).\n");
			strcat(creditt, "Credits: Dom - Mapping.\n");
			strcat(creditt, "Credits: Predator69 - Host.\n");
			strcat(creditt, "Credits: Werty. - Host forum .\n");
			strcat(creditt, "Credits: PiNNgu - A ajutat cu privirea\n");
			ShowPlayerDialog(playerid, 20312, DIALOG_STYLE_MSGBOX, "Credits", creditt, "LOVE", "");
		}
	}
	return 1;
}
I get errors, why? type mismatch
Reply
#5

Quote:

new creditt[500];

Change to that.

also, you might want to change:
PHP код:
ShowPlayerDialog(playerid 
to
PHP код:
ShowPlayerDialog(
Reply
#6

I wouldn't want a dialog to suddenly appear in my screen displaying the credits if I was a player, honestly. If someone was interested, they could just execute the command anytime they want.

As for the code, there's no difference so far. If the text is the same no matter if a player is admin or not, then use strcat before the loop.

In the else statement, you forgot a quotation mark too:
Код:
SendClientMessage(i, -1, "Multumesc ca ati jucat pe server, Andrei.");
Reply
#7

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
I wouldn't want a dialog to suddenly appear in my screen displaying the credits if I was a player, honestly. If someone was interested, they could just execute the command anytime they want.

As for the code, there's no difference so far. If the text is the same no matter if a player is admin or not, then use strcat before the loop.

In the else statement, you forgot a quotation mark too:
Код:
SendClientMessage(i, -1, "Multumesc ca ati jucat pe server, Andrei.");
It is for a server that I scripted for and didn't reward me with anything and are ignoring me so I want to show credits.
Reply
#8

under the 'else' statement last line, you put 'playerid' instead of 'i'
Код:
ShowPlayerDialog(i, 20312, DIALOG_STYLE_MSGBOX, "Credits", creditt, "LOVE", "");
Reply
#9

Quote:
Originally Posted by xTURBOx
Посмотреть сообщение
under the 'else' statement last line, you put 'playerid' instead of 'i'
Код:
ShowPlayerDialog(i, 20312, DIALOG_STYLE_MSGBOX, "Credits", creditt, "LOVE", "");
Yep, noticed and fixed, thank you
Reply
#10

Код:
for(new i = 0; i < MAX_PLAYERS; i++)
Don't do that. GetPlayerPoolSize exists.
Код:
for (new i, j = GetPlayerPoolSize(); i <= j; i++) if (IsPlayerConnected(i))
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)