Set somebody elses health?
#1

How do I set somebody elses health, SetPlayerHealth(playerid, giverid, 100); ? Meh, I have no idea.

Instead of making a new thread, it's simpler to edit.
Reply
#2

GetPlayerTeam sometimes returns the incorrect value.
You should create a variable, and OnPlayerRequest class, if classid == gTeam[playerid] = RUSSIA, or w/e.
Then use it to check in OnPlayerSpawn
pawn Код:
if(gTeam[playerid] == RUSSIA) { //code here }
Reply
#3

The menu displays what they want to be, eg. Russia gets a menu for like, Infantry, Medic etc ... I also have other shit how would I do more than a single line?

EDIT: Works, thanks mate.
Reply
#4

Add more things to the menu? or what?
Please explain more.
Reply
#5

Bump, new question!
Reply
#6

pawn Код:
SetPlayerHealth(playerid, Float:health);
Reply
#7

Doesn't help, sorry to say. I know how to set your own health, my script includes Medics that SHOULD be able to /heal [playerid] .. thats the question I'm asking.
Reply
#8

pawn Код:
new cmd[256], tmp[256], idx;
if(strcmp(cmd, "/heal", true) == 0)
{
  if(IsPlayerMedic(playerid)) //check
  {
   tmp = strtok(cmdtext, idx);
   if(!strlen(tmp)) return SendClientMessage(playerid, color, "Usage: /heal <id>");  
   new pid = strval(tmp);
   if(IsPlayerConnected(pid))
   {
     if(GetPlayerHealth(pid < 100)
     {
      SetPlayerHealth(pid, 100);
      return 1;
     }
     else return SendClientMessage(playerid, color, "Player health is full!");
   }
   else return SendClientMessage(playerid, color, "Invalid ID");
  }
  else return SendClientMessage(playerid, color, "Must be a medic!");
}
Reply
#9

well if you don't have medic script on your server do like this:

new cmd[256], tmp[256], idx;
if(strcmp(cmd, "/heal", true) == 0)
{
tmp = strtok(cmdtext, idx);
new otherplayer = strval(tmp);
if (!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_WHITE, "Player isn't connected.");
if (otherplayer == playerid) return SendClientMessage(playerid, COLOR_WHITE, "You can't heal your self");
SetPlayerHealth(otherplayer, 100);
SendClientMessage(playerid, COLOR_WHITE, "You have filled the health");
return 1;

}
Reply
#10

He does, that's why I specifically made it that way
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)