[HELP]Help me plz
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);
    if (strcmp(cmd, "/test", true) == 0)
    {
        new tmp[256];
        tmp = strtok(cmdtext, idx);
        new tested = strval(tmp);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_RED, "Используйте /test <ID>");
            return 1;
        }
        else
        {
            new Float:health;
            GetPlayerHealth(tested, health);
            //getplayerhealth dont return a value, the variable health will get the current health from the player
            new Float:saved;
            if(health == 1.00)
            {
                SendClientMessage(playerid, COLOR_RED, "Мало хп");
            }
            else
            {
                GetPlayerHealth(tested, health); //get the health a second time ??? unused ...
                health = saved; //set the variable to 0.00 because saved is 0.00
                SetPlayerHealth(tested, health-1); //set the players health to -1 so he die
                if(health == saved)
                {
                    SendClientMessage(playerid, COLOR_RED, "Плохой результат");
                    SetPlayerHealth(tested, health+1); //set his health +1 also to 0 but thats already unused because he is dead
                }
            }
            else //a else after a else dont work
            {
                SendClientMessage(playerid, COLOR_GREEN, "Хороший результат");
                SetPlayerHealth(tested, health+1);
            }
        }
    }
    return 0;
}
Reply


Messages In This Thread
[HELP]Help me plz - by crazyserega1994 - 22.07.2008, 09:54
Re: [HELP]Help me plz - by Nero_3D - 22.07.2008, 10:05
Re: [HELP]Help me plz - by chaosnz - 25.09.2009, 06:26
Re: [HELP]Help me plz - by Calgon - 25.09.2009, 06:29

Forum Jump:


Users browsing this thread: 1 Guest(s)