SA-MP Forums Archive
help whit /heal command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help whit /heal command (/showthread.php?tid=140847)



help whit /heal command - DarkPower - 10.04.2010

Problem is when i wanna /heal player and if player have 100% healths it heal him anywhay how to block that? Here is command

pawn Код:
dcmd_heal(playerid, params[])
{
    if(lije1[playerid] == 0 ) return SendClientMessage(playerid ,0xFF0000FF, "Moras biti zaposlen kao lijecnik kako bi mogao lijeciti ljude!");
        new id,optional[16],health;
        if (sscanf(params, "uz", id,optional))
        {
            SendClientMessage(playerid,0xFFB400FF, "Napisi: /Heal ID/Nick Helta: (1-100)");
        }
        else if (id == INVALID_PLAYER_ID)
        {
            new string[256];
            format(string,sizeof(string),"Igrac nije pronaden");
            SendClientMessage(playerid,0xFFB400FF,string);
            return 1;
        }
        else
        {
            if (sscanf(optional,"d",health))
            {
              health=90;
            }
            new Float:X,Float:Y,Float:Z,Float:InRange;
            GetPlayerPos(playerid,Float:X,Float:Y,Float:Z);
            InRange=IsPlayerInRangeOfPoint(id,24-(lije1[playerid] == 1 ),X,Y,Z);
            if (InRange>0)
            {
           
        if (id == playerid) return SendClientMessage(playerid, 0xFF0005FF, "Nemozes samog sebe ljeciti!");
        new Float:health2;
        GetPlayerHealth(playerid,health2);
        if (health2 > 95) return SendClientMessage(playerid, 0xFF0005FF, "Taj igrac ima preko >| 95 POSTO |< helti!");
                SetPlayerHealth(id,health);
              new Name2[MAX_PLAYER_NAME];
                GetPlayerName(playerid,Name2,sizeof(Name2));
                new string[256];
                format(string,sizeof(string),"[%d] %s te izljecio na %d\%",playerid,Name2,health);
                SendClientMessage(id,0xFFB400FF,string);
                GetPlayerName(id,Name2,sizeof(Name2));
                format(string,sizeof(string),"izljecio si [%d] %s na %d\"",id,Name2,health);
                SendClientMessage(playerid,0xFFB400FF,string);
                GivePlayerMoney(playerid,1000);
            }
        }
        return 1;
    }



Re: help whit /heal command - DarkPower - 11.04.2010

bump


Re: help whit /heal command - aircombat - 11.04.2010

if(GetPlayerHealth(playerid) >= 100) return SendClientMessage(playerid,COLOR_RED,"No Need To Heal This Player!");


Re: help whit /heal command - DarkPower - 11.04.2010

i allready make that but that dosent work because thats look for player who type that command not for player what you wanna to heal.... Example. if i have 100% health and you have 50% and if i type /heal its say
Код:
No Need To Heal This Player!
and if i get my health UNDER 100 then i can heal you


Re: help whit /heal command - aircombat - 11.04.2010

srry here is the right code :
if(GetPlayerHealth(id) >= 100) return SendClientMessage(playerid,COLOR_RED,"No Need To Heal This Player!");


Re: help whit /heal command - DarkPower - 11.04.2010

tny thats all i need it


Re: help whit /heal command - aircombat - 11.04.2010

np anytime