First time scripting help
#5

pawn Код:
public OnPlayerCommandText(playerid,cmdtext[])
{
    if (strcmp("/healhelp", cmdtext, true, 9) == 0)
    {
        SendClientMessage(playerid,COLOR_RED,"If you want to heal yourself use /healme, wich will cost 500 and for armour /armour wich will be 1000.");
        return 1;
    }
    if (strcmp("/healme", cmdtext, true, 7) == 0)
    {
        SetPlayerHealth(playerid,100);
        GivePlayerMoney(playerid,-500);
        SendClientMessage(playerid,COLOR_GREEN,"You have reafilled your health.");
        SendClientMessage(playerid,COLOR_BLUE,"Make sure to /healhelp for more information!");
        return 1;
    }
    if (strcmp("/armour", cmdtext, true, 7) == 0)
    {
        SetPlayerArmor(playerid,100);
        SendClientMessage(playerid,COLOR_RED,"You have refilled your armour.");
        SendClientMessage(playerid,COLOR_BLUE,"Make sure to /healhelp for more information!");
        return 1;
    }
    return 0;
}
bro check this https://sampwiki.blast.hk/wiki/OnPlayerCommandText
Also , adding 10 as a constant was wrong..
Just count how many characters including the slash , and add the length there
Reply


Messages In This Thread
First time scripting help - by Juan_Viz - 29.08.2012, 00:02
Re: First time scripting help - by Devilxz97 - 29.08.2012, 00:08
Respuesta: First time scripting help - by Juan_Viz - 29.08.2012, 00:09
Re: First time scripting help - by Devilxz97 - 29.08.2012, 00:14
Re: First time scripting help - by CoDeZ - 29.08.2012, 00:24
Re: First time scripting help - by Devilxz97 - 29.08.2012, 00:24
Respuesta: First time scripting help - by Juan_Viz - 29.08.2012, 01:38
Respuesta: First time scripting help - by Juan_Viz - 29.08.2012, 01:51
Re: First time scripting help - by SA-MPDrifter - 29.08.2012, 01:52
Re: First time scripting help - by Akira297 - 29.08.2012, 01:57

Forum Jump:


Users browsing this thread: 1 Guest(s)