heal command
#1

Hey,

i have this code:
pawn Код:
CMD:heal(playerid,params[])
{
    new pID;
    if(gTeam[playerid] == Medic) return SendClientMessage(playerid,COLOR_RED,"You must be a medic to use this command");
    else if(sscanf(params, "u", pID)) SendClientMessage(playerid,COLOR_YELLOW,"Please use /heal [playerid]");
    else if(GetPlayerHealth(pID) == 100) SendClientMessage(playerid,COLOR_YELLOW,"This player is already full health");
    else if(PlayerFromPlayer(playerid,pID,4)) SendClientMessage(playerid,COLOR_YELLOW,"%s is not close enough to heal");
    else if(!IsPlayerConnected(playerid)) SendClientMessage(playerid,COLOR_YELLOW,"That player is not connected!");
    else if(pID == playerid) SendClientMessage(playerid,COLOR_YELLOW,"You cannot use this command to heal your self");
    else
    {
    SetPlayerHealth(pID,100);
    GivePlayerMoney(playerid,1000);
    GivePlayerMoney(pID,-1000);
    SendClientMessage(playerid,COLOR_YELLOW,"You have healed %s");
    SendClientMessage(pID,COLOR_YELLOW,"You have been healed by %s for $1000");
    }
    return 1;
}
but for some reason the GetPlayerHealth isn't right as i get this:
Код:
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\pawno\MaddMikesCNR.pwn(88) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply
#2

GetPlayerHealth has 2 arguments. Use the following stock if you want to make it easier.

pawn Код:
stock Float:GetPlayerHealthEx(playerid)
{
    new Float:HealthX;
    GetPlayerHealth(playerid, HealthX);
    return HealthX;
}
Also, I found another error

pawn Код:
else if(!IsPlayerConnected(playerid)) SendClientMessage(playerid,COLOR_YELLOW,"That player is not connected!");
That should be
pawn Код:
else if(!IsPlayerConnected(pID)) SendClientMessage(playerid,COLOR_YELLOW,"That player is not connected!");
Reply
#3

on the return HealthEx;

C:\Users\Admin\Desktop\SAMP\Midnight Drifts\pawno\MaddMikesCNR.pwn(86) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply
#4

Sorry, I was missing the float at the start of the function, try now.
Reply
#5

perfect thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)