evade damage
#1

Hee all,

i was wondering if it is possible to make that a player can't hit a specific player, but can kill others without the use of teams

i need this for a mini missions, but i don't want to use teams because i never use them in my script, and i don't want them to be of use after the mini mission!

Thanks in advance!

Jop9888
Reply
#2

Perhaps take a look in OnPlayerTakeDamage

pawn Код:
new CantBeHarmed = INVALID_PLAYER_ID;

OnMiniMissionStart()
{
  CantBeHarmed = id;
  return 1;
}

OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
  if(playerid == CantBeHarmed) return 0;
  return 1;
}
I'm not sure in what context you need this to be, so this is the best I can suggest.
Reply
#3

Thanks! that's what i wanted
Reply
#4

Quote:
Originally Posted by BuuGhost
Посмотреть сообщение
Perhaps take a look in OnPlayerTakeDamage

pawn Код:
new CantBeHarmed = INVALID_PLAYER_ID;

OnMiniMissionStart()
{
  CantBeHarmed = id;
  return 1;
}

OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
  if(playerid == CantBeHarmed) return 0;
  return 1;
}
I'm not sure in what context you need this to be, so this is the best I can suggest.
Returning 0 in OnPlayerTakeDamage doesn't prevent the damage.

@Poster

Use teams and then set everyone's team to -1 when the other modes start.
Reply
#5

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
Returning 0 in OnPlayerTakeDamage doesn't prevent the damage.

@Poster

Use teams and then set everyone's team to -1 when the other modes start.
Aha, just setplayerhealth+difference then, never tested around.
Reply
#6

pawn Код:
new CantBeHarmed = INVALID_PLAYER_ID;

OnMiniMissionStart()
{
  CantBeHarmed = id;
  return 1;
}

OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
  if(playerid == CantBeHarmed)
  {
  new Float:health;
  GetPlayerHealth(playerid,health);
  SetPlayerHealth(playerid,health + amount);
  }
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)