Help with my first command.
#9

Quote:
Originally Posted by Xtreme_playa
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/healme", cmdtext, true, 7) == 0) // string count for /healme is 7 not 10
    {
        SetPlayerArmour(playerid, 50);
        SetPlayerHealth(playerid, 50);
        SendClientMessage(playerid, COLOR_PINK, "You've refilled your Armour, and health. Goodluck!");
        return 1;
    }
    return 1;
}
Don't put that 10 blindly, it stands for number of strings to be compared to process the command further, if the number the strings don't match the number in the your command, you'd get "Unknown Command". For /healme, it would be 7 including "/".
I just copied his command and get rid off warnings, didn't remove or add code cuz i don't want to screw something else in his script!
Reply


Messages In This Thread
Help with my first command. - by Goru - 11.07.2012, 14:21
Re: Help with my first command. - by Revo - 11.07.2012, 14:25
Re: Help with my first command. - by RedJohn - 11.07.2012, 14:27
Re: Help with my first command. - by Goru - 11.07.2012, 14:32
Re: Help with my first command. - by RedJohn - 11.07.2012, 14:34
Re: Help with my first command. - by Goru - 11.07.2012, 14:45
Re: Help with my first command. - by Lordzy - 11.07.2012, 14:49
Re: Help with my first command. - by Mark™ - 11.07.2012, 14:50
Re: Help with my first command. - by RedJohn - 11.07.2012, 15:01
Re: Help with my first command. - by Mark™ - 11.07.2012, 15:05

Forum Jump:


Users browsing this thread: 2 Guest(s)