CMD: Heal
#1

Work or not?

pawn Код:
CMD:heal(playerid,o[])
{
    new str[20],Float:HP;
    GetPlayerHealth(playerid,HP);
    if (HP > 90.0)
    SendClientMessage(playerid, RED, "You can't use this command | Reason: Your HP above 90.0");
    {
    if (GetPlayerMoney(playerid) <= 500) return SendClientMessage(playerid, RED, #CASH_ERROR);
    {
    SetPlayerHealth(playerid, 0.0);
    SendClientMessage(playerid, RED, "You have killed yourself");
    GetPlayerName(playerid,pname, sizeof(pname));
    format(str,sizeof(str), "%s was death | Reason: Own kill using [/kill]", pname);
    SendClientMessageToAll(RED, str);
    return 1;
       }
    }
}
Sorry for asking this stupid question.I cant open my gtasa to test this script.
Reply
#2

Wouldn't have worked because of brackets, undefined pname, and some more.
pawn Код:
CMD:heal(playerid,params[])
{
    new Float:HP;
    GetPlayerHealth(playerid,HP);
    if (HP > 90.0) return SendClientMessage(playerid, RED, "You can't use this command | Reason: Your HP above 90.0!");
    if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, RED, "#CASH_ERROR");
    SetPlayerHealth(playerid, 0.0);
    SendClientMessage(playerid, RED, "You have killed yourself");
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pname, sizeof(pname));
    new str[128];
    format(str,sizeof(str), "%s was death | Reason: Own kill using [/kill]", pname(playerid));
    SendClientMessageToAll(RED, str);
    return 1;
}
This works.
But I don't get it, why if he's using /heal you are killing him and sending a message to everyone that he used /kill?
Reply
#3

I just copy paste.Just asking if its work or not.The pname i have define on top.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)