SA-MP Forums Archive
Need some help with commands - 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: Need some help with commands (/showthread.php?tid=291176)



Need some help with commands - rubygta - 18.10.2011

Hello, there. I'm currently trying to script a /equip command, with instead of numbers, I'm trying to use text, so.. instead of
pawn Код:
/equip 1
or 2, 3,4 or whatever, I want to use text... I want it to look something like this
pawn Код:
/equip M4A1                ||                      MP5              ||            Shotgun
only one at a time of course, so I can choose exactly the one I want.. and I'm stuck... Any help is appreciated! Please supply me with code/information/code with explaining. Thanks in advance!


Re: Need some help with commands - Wesley221 - 18.10.2011

pawn Код:
CMD:equip(playerid, params[])
{
    if( !strcmp( params, "M4A1", true) ) // comparing the params with 'M4A1', if theyre the same
    {
                // this will get called
        // do your stuff in here when player types '/equip M4a1'
    }
    if( !strcmp( params, "MP5", true) )
    {
   
    }
    if( !strcmp( params, "Shotgun", true) )
    {
   
    }
    return 1;
}
This should work.


Re: Need some help with commands - rubygta - 18.10.2011

Thanks for the reply, there's one thing I forgot to tell you, and it's that I need this for strcmp.
Thank you.