Need help - ZCMD /heal [ID]
#1

So basically I tried to script an admin command, called /heal ID. I just started using ZCMD, and I was wondering if anyone could help me with this one.

I get no error when compiling it, but when I try to do /heal 1(no id 1, offline), it shows "ERROR; correct usage /heal [ID]", the same when I do /heal 0(myself).

When I do it as non-admin it works properly giving me the message "ERROR: You're not an administrator".

Here' the code:

pawn Код:
COMMAND:heal(playerid, params[])
{
  if(IsPlayerAdmin(playerid))
  {
      new toplayer, health;
      if(!sscanf(params,"ui",toplayer, health))
      {
        if(IsPlayerConnected(toplayer))
        {
    if(health <= 100)
          {
           new string[64];
           new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
           GetPlayerName(playerid, name, sizeof(name));
           GetPlayerName(toplayer, PlayerName, sizeof(PlayerName));
           format(string, sizeof(string), "&s has filled your HP.",name, health);
           SendClientMessage(toplayer, 0xFFFFFF, string);
           format(string, sizeof(string), "You gave %s full HP.",PlayerName, health);
           SendClientMessage(playerid, 0xFFFFFF, string);
           SetPlayerHealth(toplayer, 100);
          }
           else return SendClientMessage(playerid, 0xFFFFFF, "ERROR: This player already has full health!");
        }
        else return SendClientMessage(playerid, 0xFFFFFF, "ERROR: The player is offline.");
      }
      else return SendClientMessage(playerid, 0xFFFFFF, "Correct usage: /heal [ID]");
  }
  else return SendClientMessage(playerid, 0xFFFFFF, "ERROR, You're not an administrator");
  return 1;
}
Reply


Messages In This Thread
Need help - ZCMD /heal [ID] - by MrBorsh - 07.07.2012, 15:28
Re: Need help - ZCMD /heal [ID] - by jaami - 07.07.2012, 15:31
Re: Need help - ZCMD /heal [ID] - by MrBorsh - 07.07.2012, 15:31
Re: Need help - ZCMD /heal [ID] - by leonardo1434 - 07.07.2012, 15:48
Re: Need help - ZCMD /heal [ID] - by Elysian` - 07.07.2012, 15:53
Re: Need help - ZCMD /heal [ID] - by coole210 - 07.07.2012, 15:54
Re: Need help - ZCMD /heal [ID] - by leonardo1434 - 07.07.2012, 15:57
Re: Need help - ZCMD /heal [ID] - by MrBorsh - 07.07.2012, 16:24

Forum Jump:


Users browsing this thread: 2 Guest(s)