Fast help
#1

Hello,just need a fast help with this /heal command:

pawn Код:
CMD:heal(playerid, params[])
{
    new giveplayerid,Float:heal,Float:X, Float:Y, Float:Z;
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pname,sizeof(pname));
        if(sscanf(params), "f", > 90) return SendClientMessage(playerid,0xFF0000FF, "You can't offer at this player health more than 90 hp.");
    if(sscanf(params, "df", giveplayerid, heal))return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /heal (playerid) (health 1-90)");
    {
        if(!IsPlayerConnected(giveplayerid) || giveplayerid == playerid)
        {
            SendClientMessage(playerid, red, "Invalid player id.");
            return true;
        }

        GetPlayerPos(playerid, X, Y, Z);
        if(!IsPlayerInRangeOfPoint(giveplayerid, 5.0, X, Y, Z))
        {
            SendClientMessage(playerid, red, "This player is too far from you, you can't offer him health.");
            return true;
        }

        new string[128];
        format(string, sizeof(string), "You've received an offer to heal you by %s (%d) of %2.1f hp.", pname,playerid,heal);
        SendClientMessage(giveplayerid, -1, string);
        SendClientMessage(giveplayerid, -1, "Type in the chat \"Yes\" or \"No\" to reply the offer.");
        pOffersHeal[giveplayerid] = true;
        HealthAmount = heal;
    }
    return true;
}
}
The error line is this:

pawn Код:
if(sscanf(params), "f", > 90) return SendClientMessage(playerid,0xFF0000FF, "You can't offer at this player health more than 90 hp.");
I don't want a player can offer more than 90 hp,thanks.

EDIT: This is onplayertext:

pawn Код:
if(pOffersHeal[playerid])
    {
        if(strcmp(text, "Yes", true) == 0)
        {
            SetPlayerHealth(playerid, HealthAmount);
            GameTextForPlayer(playerid, "~r~Health ~g~refill ~w~accepted!", 5000, 4);
            SendClientMessage(playerid,COLOR_PINK,"You have accepted the health refill.");
        }

        else if(strcmp(text, "No", true) == 0)
        {
            GameTextForPlayer(playerid, "Health offer denied.", 3000, 3);
            GameTextForPlayer(playerid, "~r~Health ~g~refill ~w~denied!", 5000, 4);
            SendClientMessage(playerid,COLOR_PINK,"You have denied the health refill.");
            pOffersHeal[playerid] = false;
        }
        return true;
    }
I need to show how much health the player has accepted and who sent it,how i can?
Reply


Messages In This Thread
Fast help - by Face9000 - 11.10.2012, 23:23
Re: Fast help - by HuSs3n - 11.10.2012, 23:38
Re: Fast help - by Face9000 - 11.10.2012, 23:44
Re: Fast help - by HuSs3n - 12.10.2012, 00:01
Re: Fast help - by Face9000 - 12.10.2012, 07:34

Forum Jump:


Users browsing this thread: 1 Guest(s)