Add Command
#1

Hello.

How can i add a new command to my script exemple: /CreateGangVeh

And more....

Thanks.

Micklo
Reply
#2

CMD:creategangveh(playerid,params[])
{
//ur code
return 1;
}
Reply
#3

There's several ways to do it, i would recommend using a command processor include like y_commands or zcmd.

Normal:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "test", true))
    {
        // Codes
        return 1;
    }
    return 0;
}
Zcmd:
pawn Код:
CMD:test(playerid, params[])
{
    // Codes
    return 1;
}
( Note: You can also use COMMAND: instead of CMD: )

Y_commands:
pawn Код:
YCMD:test(playerid, params[], help)
{
    // Codes
    return 1;
}
Reply
#4

so if i put the command will it work on my script?

Thanks.
Reply
#5

As i said, there's different ways to create commands, the 3 i listed are the most used.
It will only if you have the correct include for the command method, the "normal" command type doesn't need includes, but is slower than zcmd, y_commands and other includes.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)