SA-MP Forums Archive
Need help ( /news ) - 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: Need help ( /news ) (/showthread.php?tid=568855)



Need help ( /news ) - Wassimo - 25.03.2015

Hi, i need a command, it's /news, it's shows all update for the server ect..


Re: Need help ( /news ) - JaydenJason - 25.03.2015

Post some code here if you've made an attempt

Simply use dialogs to show your news or whatever, text draw, gametext, dialogs


Re : Need help ( /news ) - Wassimo - 25.03.2015

Код:
// This command displays the rules of the server
COMMAND:news(playerid, params[])
{
	// Setup local variables
	new Msg[2000];

	// Send the command to all admins so they can see it
	SendAdminText(playerid, "/news", params);

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Construct the rules
		format(Msg, 2000, "%s1.----------------------------- Mise а jour V1.1 ----------------------------- .\n", Msg);
		format(Msg, 2000, "%s2. Ajout d'une nouvelle commande pour respawn son vйhicule, /resveh.\n", Msg);
		format(Msg, 2000, "%s3. Le mot de passe est maintenant invisible quand vous le tapez.\n", Msg);
		format(Msg, 2000, "%s4. Ajouts de quelque missions pour les camionneurs.\n", Msg);
		format(Msg, 2000, "%s5. Ajout d'un ferry reliant entre Los Island et California island (initbrain).\n", Msg);
		format(Msg, 2000, "%s6. Un anti-spam pour le chat.\n", Msg);
		format(Msg, 2000, "%s7. Ajout d'un anti-ping, il kick les joueurs ayant un ping plus de 500.\n", Msg);
		format(Msg, 2000, "%s8. Ajout d'un Regulateur de vitesse.\n", Msg);
	    // Show a dialog that shows the rules
		ShowPlayerDialog(playerid, DialogRules, DIALOG_STYLE_MSGBOX, "Les news du serveur:", Msg, "Sortire", TXT_DialogButtonCancel);
	}
	else
	    return 0;
		// Let the server know that this was a valid command
	return 1;
}
is it good ?


Re: Need help ( /news ) - fuckingcruse - 26.03.2015

Dude remove everything from else , let the return 1 be...


Re: Need help ( /news ) - CalvinC - 26.03.2015

Quote:
Originally Posted by fuckingcruse
Посмотреть сообщение
Dude remove everything from else , let the return 1 be...
He's probably doing return 0 to give the unknown command-message if the player isn't an administrator.
But yeah it all seems fine.


Re: Need help ( /news ) - fuckingcruse - 26.03.2015

Wow dude he want the cmd to be used to all not only admin..


Re: Need help ( /news ) - CalvinC - 26.03.2015

Sorry i mean if the player isn't logged in.


Re : Re: Need help ( /news ) - Wassimo - 26.03.2015

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
Sorry i mean if the player isn't logged in.
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)

All player's can see the cmd.


Re: Re : Re: Need help ( /news ) - CalvinC - 26.03.2015

Quote:
Originally Posted by Wassimo
Посмотреть сообщение
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)

All player's can see the cmd.
I know that
pawn Код:
else
    return 0;
But you have a return 0 if he's not logged in, giving the unknown-command message which is fine to use if you want.