Problem with a command related to health
#1

Hello.
I made a sethealth command, I know there's plenty of them out there, but I just wanted to figure out another way to do it, so basically, if I do /sethealth [someid] [10] it will automatically set the player's health to some other value instead of 10.
Anyone can figure out what am I doing wrong right below?

PHP код:
CMD:sethealth(playeridparams[])
{
    if(!
IsAdminLevel(playerid1)) return ERROR(playerid"You need a higher administrator level to use this command.");
    if(
sscanf(params"rf"params[0], params[1]))
    {
        
USAGE(playerid"/sethealth [player/name] [health]");
        
CMDHELP(playerid"Will set the specified health to the defined player.");
        return 
1;
    }
    if(
params[0] == INVALID_PLAYER_ID) return ERROR(playerid"The ID or name entered was invalid.");
    if(
params[0] == playerid)
    {
        
AdmCmd(playerid"You have successfully set your health to %.1f."params[1]);
    }
    else
    {
        
AdmCmd(playerid"You have successfully set %s's health to %.1f."GetName(params[0]), params[1]);
        
AdmCmd(playerid"Administrator %s has set your health to %.1f."GetName(playerid), params[1]);
    }
    
CMDMessageToAdmins(playerid"sethealth");
    
SetPlayerHealth(params[0], params[1]);
    return 
1;

Reply


Messages In This Thread
Problem with a command related to health - by Magic_Time - 22.02.2015, 16:46
Re: Problem with a command related to health - by xXSPRITEXx - 22.02.2015, 16:53
Re: Problem with a command related to health - by zork - 22.02.2015, 16:56
AW: Problem with a command related to health - by Nero_3D - 22.02.2015, 17:11
Re: Problem with a command related to health - by Magic_Time - 22.02.2015, 18:14

Forum Jump:


Users browsing this thread: 1 Guest(s)