[Tutorial] Simple /help Command
#1

Very simple. First of all, what you should always, and always do, is define a_samp into your script. This will determine that the script is going to be made for San Andreas Multiplayer. So at the very top add this:

pawn Код:
#include <a_samp>
Next, you will make a define for the text color, which will be the text that comes up on chat, once you activate the command. So now, put this under your #include's, and above your public's.

pawn Код:
#define COLOR_WHITE 0xFFFFFFFF
Next you must make it a command, under your OnPlayerCommandText.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/help", cmdtext, true, 5) == 0)
        {
            SendClientMessage(playerid, COLOR_WHITE,"Enter Your Text Here!");
        }
    return 0;
}
That's pretty much it, nothing to it!
REMEMBER: To change the Enter Your Text Here. DO NOT REMOVE THE QUOTATION MARKS!
Reply
#2

Nice tutorial

But wrong selection buddy..

Should be in "Scripting Tutorials"
Reply
#3

seriously u see the other kid mess up his help command u make one? fail. you should atleast post zcmd and dcmd for other players to
Reply
#4

ZCMD:

U need this
pawn Код:
#include <zcmd>
You have to delete OnPlayerCommandText
pawn Код:
COMMAND:help(playerid, params[])
{
    SendClientMessage(playerid,0xFFFAAA,"Enter ur message here");
    return 1;
}
Reply
#5

also
//top of script
#include <dcmd>


//anywhere but not under onplayercommandtext
pawn Код:
CMD_help(playerid, params[])
{
    SendClientMessage(playerid,0xFFFAAA,"Enter ur message here");
    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(help,4,cmdtext);
return 0;
}
Reply
#6

Will, You guys just stop this i'm sure some of you've failed on a script right?
Reply
#7

Uhhh... Also, remember to return 1 at every strcmp command.
pawn Код:
if (strcmp("/help", cmdtext, true, 5) == 0)
{
   SendClientMessage(playerid, COLOR_WHITE,"Enter Your Text Here!");
   return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)