[HELP] /heal command?
#1

I need someone to make me a /heal command that only if your on the team called "medics" you will be able to use it.
Also, if a player is already healed (100%) health it will say you can't heal the person but if you can, it sets the players
health to 100% and gives the healer 1 point. Thanks. (I don't want to post this in the thread request thing cause I just get bad feedback)
Reply
#2

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/heal", cmdtext, true, 10) == 0)
	{
		SetPlayerHealth(playerid, 100.0);
		return 1;
	}
	return 0;
}
This is not for the team, its for all.
Just change it.
Reply
#3

Top
pawn Код:
new Points[MAX_PLAYERS];
Command
pawn Код:
dcmd_heal(playerid, params[])
{
  if(Player[status] != 1) return SendClientMessage(playerid, COLOR, "You're not a medic!"); // let's guess when Player[status] == 1 (medic).

  new id;
  new string[64];

  if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR, "Syntax: /heal [id]"); // syntax
  else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR, "That player is not connected to the server!"); // valid id
  else if(id == playerid) return SendClientMessage(playerid, COLOR, "You cannot heal yourself!"); // yourself
  else if(GetDistanceBetweenPlayers(playerid, id) > 5.00) return SendClientMessage(playerid, COLOR, "That player is too far away!"); // in order to check if they are closely
  // you must change the 5.00 to w/e you want...
  else
  {
    new Float:pHealth; // health var
    GetPlayerHealth(id, pHealth);
    if(pHealth >= 100) return SendClientMessage(playerid, COLOR, "That player has enough health already!") // checking if health == 100
    else // result
    {
      new pName[MAX_PLAYER_NAME];
      GetPlayerName(id, pName, sizeof(pName));
      SetPlayerHealth(id, 100.0);
      format(string, sizeof(string), "You've successfully healed %s (ID: %d)!", pName, id);
      SendClientMessage(playerid, COLOR, string);
      SendClientMessage(id, COLOR, "A medic has healed you!");
      Points[playeid] ++;
      format(string, sizeof(string, "Now you have %d points!", Points[playerid]);
      SendClientMessage(playerid, COLOR, string);
    }  
  }
 
  return 1;    
}
Reply
#4

Quote:
Originally Posted by SAWC™
Top
pawn Код:
new Points[MAX_PLAYERS];
Command
pawn Код:
dcmd_heal(playerid, params[])
{
  if(Player[status] != 1) return SendClientMessage(playerid, COLOR, "You're not a medic!"); // let's guess when Player[status] == 1 (medic).

  new id;
  new string[64];

  if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR, "Syntax: /heal [id]"); // syntax
  else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR, "That player is not connected to the server!"); // valid id
  else if(id == playerid) return SendClientMessage(playerid, COLOR, "You cannot heal yourself!"); // yourself
  else if(GetDistanceBetweenPlayers(playerid, id) > 5.00) return SendClientMessage(playerid, COLOR, "That player is too far away!"); // in order to check if they are closely
  // you must change the 5.00 to w/e you want...
  else
  {
    new Float:pHealth; // health var
    GetPlayerHealth(id, pHealth);
    if(pHealth >= 100) return SendClientMessage(playerid, COLOR, "That player has enough health already!") // checking if health == 100
    else // result
    {
      new pName[MAX_PLAYER_NAME];
      GetPlayerName(id, pName, sizeof(pName));
      SetPlayerHealth(id, 100.0);
      format(string, sizeof(string), "You've successfully healed %s (ID: %d)!", pName, id);
      SendClientMessage(playerid, COLOR, string);
      SendClientMessage(id, COLOR, "A medic has healed you!");
      Points[playeid] ++;
      format(string, sizeof(string, "Now you have %d points!", Points[playerid]);
      SendClientMessage(playerid, COLOR, string);
    }  
  }
 
  return 1;    
}
WOW :O It works but can you make it so thats it's in
Код:
	// if(strcmp(cmd, "/heal", true) == 0) {
format, cause I got this warning:

C:\Users\Dustin\Desktop\WW3 v0.3 Edition\gamemodes\WW3.pwn(290 : warning 203: symbol is never used: "dcmd_heal"
Pawn compiler 3.2.3664 Copyright © 1945-2006, ITB CompuPhase


1 Warning.
Also, can you make it so ONLY IF YOUR TEAM IS CALLED "Medic", you can use the command? Thanks for everything!
Reply
#5

This isn't the script request topic, you better learn from it and change it into strcmp yourself...

Quote:
Originally Posted by DeltaAirlines12
Also, can you make it so ONLY IF YOUR TEAM IS CALLED "Medic", you can use the command? Thanks for everything!
Quote:
Originally Posted by SAWC™
pawn Код:
if(Player[status] != 1) return SendClientMessage(playerid, COLOR, "You're not a medic!"); // this variable represents your team's variable...
//find yours and make acoplish...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)