[Tutorial] Newbie - Learn to make a help command [Explained]
#1

Quote:
Includes you will need

#include <zcmd>
Firstly, Go into your Gamemode and press 'ctrl & F' then search for
Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
After
Код:
    return 1;
}
Paste this code

Код:
CMD:help(playerid, params[])
{
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	SendClientMessage(playerid, COLOR_GREEN, "HELP TEXT HERE");
	SendClientMessage(playerid, COLOR_YELLOW, "HELP TEXT HERE");
	SendClientMessage(playerid, COLOR_YELLOW, "HELP TEXT HERE");
	SendClientMessage(playerid, COLOR_YELLOW, "HELP TEXT HERE");
	SendClientMessage(playerid, COLOR_YELLOW, "HELP TEXT HERE");
	SendClientMessage(playerid, COLOR_YELLOW, "HELP TEXT HERE");
	SendClientMessage(playerid, COLOR_YELLOW, "HELP TEXT HERE");
	SendClientMessage(playerid, COLOR_YELLOW, "HELP TEXT HERE");
	SendClientMessage(playerid, COLOR_YELLOW, "HELP TEXT HERE");
	SendClientMessage(playerid, COLOR_YELLOW, "HELP TEXT HERE");
	SendClientMessage(playerid, COLOR_YELLOW, "HELP TEXT HERE");
	return 1;
}
Now lets break it down

Код:
CMD:help(playerid, params[])
Basically what this means is if the command help is executed it will find which player entered it by finding their playerid

Quote:
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");

This will check if the player is currently logged in, If the player is not then it will send them a message "You need to login first before using any command."

Else if the player is logged in it will send a message to the client with the playerid who executed the command
Код:
SendClientMessage(playerid, COLOR_GREEN, "HELP TEXT HERE");
In this case, If the player is logged in, They will receive a message like this.

HELP TEXT HERE
HELP TEXT HERE
HELP TEXT HERE
HELP TEXT HERE
HELP TEXT HERE
HELP TEXT HERE
HELP TEXT HERE
HELP TEXT HERE
HELP TEXT HERE
HELP TEXT HERE
HELP TEXT HERE


zcmd include - Thanks to Zeex

My first tutorial, sorry if anything is missing please pm me or leave a reply, Hope it helps you new scripters like me.
Reply
#2

- ZCMD is from Zeex, not ******.

- IsPlayerLoggedIn is a variable that probably your script uses and it's not a function by a_samp. So, it will give errors to players that they are new to Pawn.

- OnPlayerCommandPerformed is not a callback that there is on a "new" file, and you have to add it by yourself into the gamemode/filterscript.
Reply
#3

Quote:
Originally Posted by Dwane
Посмотреть сообщение
- ZCMD is from Zeex, not ******.

- IsPlayerLoggedIn is a variable that probably your script uses and it's not a function by a_samp. So, it will give errors to players that they are new to Pawn.

- OnPlayerCommandPerformed is not a callback that there is on a "new" file, and you have to add it by yourself into the gamemode/filterscript.
Georgia say it short lol . This tutorial is not good , even for begginers !
Reply
#4

Dwane summed it up pretty much. ZCMD commands may also appear anywhere within the script; they don't have to be placed after this particular callback.

Bro tip:
[pawn][/pawn] tags will save you lots of work.
Reply
#5

Also, anyone wanting to get a nice command list depending on the user access levels without having to modifying the help command all the time should maybe look into YCMD by ******. It should have a feature for the command list as far as I know.
Reply
#6

Wow, what an explenation!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)