[Tutorial] Newbie - Learn to make a help command [Explained] - 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)
+---- Forum: Tutorials (
https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Newbie - Learn to make a help command [Explained] (
/showthread.php?tid=391470)
Newbie - Learn to make a help command [Explained] -
Pawnstar - 10.11.2012
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
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.
Re: Newbie - Learn to make a help command [Explained] -
Konstantinos - 10.11.2012
- 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.
Re: Newbie - Learn to make a help command [Explained] -
Private200 - 10.11.2012
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 !
Re: Newbie - Learn to make a help command [Explained] -
Vince - 10.11.2012
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.
Re: Newbie - Learn to make a help command [Explained] -
AndreT - 10.11.2012
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.
Re: Newbie - Learn to make a help command [Explained] -
KingHual - 10.11.2012
Wow, what an explenation!