Converting command
#5

I've re-wrote the command, I hope it works:

pawn Код:
if (strcmp("/heal", cmdtext, true, 10) == 0)
    {
        if(gPlayerClass[playerid] == MEDIC_CLASS)
        {
            new Float:health, user, Float:x, Float:y, Float:z;
            if(sscanf(cmdtext, "i", user)) return SendClientMessage(playerid, COLOR_WHITE, "[USAGE]: /heal [playerid]");
           
            GetPlayerPos(user, x,y,z); GetPlayerHealth(user, health);
            if(!IsPlayerInRangeOfPoint(playerid, 5, x,y,z)) return SendClientMessage(playerid, COLOR_WHITE, "You aren't close enough to the player.");
            if(health < 1) return SendClientMessage(playerid, COLOR_WHITE, "[Error]: The health of the player is above 1..");
            SendClientMessage(playerid, COLOR_WHITE, "You've been healed.");
            SetPlayerHealth(playerid, health + 50);
        }
        else return SendClientMessage(playerid, COLOR_WHITE, "You aren't a medic.");
        return 1;
    }
Reply


Messages In This Thread
Converting command - by John Rockie - 15.02.2012, 21:53
Re: Converting command - by John Rockie - 18.02.2012, 13:46
Re: Converting command - by Vince - 18.02.2012, 14:12
Re: Converting command - by Twisted_Insane - 18.02.2012, 14:14
Re: Converting command - by Guitar - 18.02.2012, 14:20

Forum Jump:


Users browsing this thread: 1 Guest(s)