Need some help with commands
#1

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!
Reply
#2

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.
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)