OnPlayerGiveDamage / Anti- Teamkill Help!
#1

[B]Hello, Im using this code.


pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
if(gTeam[killerid] == gTeam[playerid])
{
    new Float:h;
    GetPlayerHealth(damagedid,h);
    SetPlayerHealth(damagedid,h+amount);
}
  return 1;
}
But its giving me these errors

pawn Код:
C:\Documents and Settings\Tyrese\My Documents\OFFICIAL SERVER\LSGM2.pwn(5967) : error 017: undefined symbol "killerid"

I need this fixed please! I will +REP and if you want, send me a visitor message i can make you admin in my server. we have 20-35 players daily.
Reply
#2

Simply change killerid to damagedid and give it a go..
Reply
#3

pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
if(gTeam[damagedid] == gTeam[playerid])
{
    new Float:h;
    GetPlayerHealth(damagedid,h);
    SetPlayerHealth(damagedid,h+amount);
}
  return 1;
}
Reply
#4

Maybe this will work?

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
  if(issuerid != INVALID_PLAYER_ID)
  {
     if(gTeam[issuerid] == gTeam[playerid])
     {
          new Float:x, Float:y, Float:z;
          GetPlayerPos(issuerid, x,y,z);   
          SetPlayerPos(issuerid,x,y,z+4);
          GameTextForPlayer(issuerid,"Don't shoot your team mates",1000,4);
     }
  }
  return 1;
}
or

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
  if(issuerid != INVALID_PLAYER_ID)
  {
     if(gTeam[issuerid] == gTeam[playerid])
     {
          new Float:h;
          GetPlayerHealth(playerid,h);
          SetPlayerHealth(playerid,h+amount);
     }
  }
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)