SA-MP Forums Archive
Dialog for all players - 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: Dialog for all players (/showthread.php?tid=625796)



Dialog for all players - AndreiWow - 06.01.2017

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.


Re: Dialog for all players - iLearner - 06.01.2017

loop through all players


Re: Dialog for all players - AndreiWow - 06.01.2017

Oh right, thanks.


Re: Dialog for all players - AndreiWow - 06.01.2017

Код:
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


Re: Dialog for all players - iLearner - 06.01.2017

Quote:

new creditt[500];

Change to that.

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



Re: Dialog for all players - Konstantinos - 06.01.2017

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.");



Re: Dialog for all players - AndreiWow - 06.01.2017

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.


Re: Dialog for all players - xTURBOx - 06.01.2017

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



Re: Dialog for all players - AndreiWow - 06.01.2017

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


Re: Dialog for all players - GoldenLion - 06.01.2017

Код:
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))