Issue with SetPlayerHealth to parameter (y_commands)
#1

Hi, I have been trying to create a /sethp command, where you would type
Код:
/sethp [number] example: /sethp 42
The command system I am using is y_commands, though I don't think that would change much of the result.

I have tried several ways of doing it, probably not the best ways any of them... since none worked :P

Here is my first attempt (I tried with and without the [3] array, since I want max number to be 100 really, I would have to create a check for that, but I thought I should get the actual thing to work first)
pawn Код:
//===[Set Health]===
YCMD:sethp(playerid, hp[], help)
{
    if (help)
    {
        SendClientMessage(playerid, 0xFF0000AA, "Set the player health to wanted number");
    }
    else
    {
        SetPlayerHealth(playerid, hp[3]);
    }
    return 1;
}
I also tried this (with and without new Float:health)
pawn Код:
//===[Set Health]===
YCMD:sethp(playerid, hp[], help)
{
    if (help)
    {
        SendClientMessage(playerid, 0xFF0000AA, "Set the player health to wanted number");
    }
    else
    {
        new health;
        health = hp[3];
        SetPlayerHealth(playerid, health);
    }
    return 1;
}
I don't receive any errors in the compile, but when I type /sethp 42 I get the "Unknown command" message, but if I use the built in /commands or /help sethp that comes with y_commands it shows the correct information.

Thanks for any suggestions!

EDIT: Link to fix
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)