SA-MP Forums Archive
How to make command, with one word argument? - 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: How to make command, with one word argument? (/showthread.php?tid=456520)



How to make command, with one word argument? - Micius - 06.08.2013

How to make command, with one word argument?
for example:
if /test test1 do something
if /test test2 do something


Re: How to make command, with one word argument? - McLuhan - 06.08.2013

body command:

if(!strcmp(argument, "test1"))
{

}
else if(!strcmp(argument, "test2"))
{

}


Re: How to make command, with one word argument? - Konstantinos - 06.08.2013

pawn Код:
CMD:test(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /test <test1/test2>");
    if(!strcmp(params, "test1", true))
    {
        // Do something;
    }
    else if(!strcmp(params, "test2", true))
    {
        // Do something;
    }
    else SendClientMessage(playerid, -1, "Usage: /test <test1/test2>");
    return 1;
}