SA-MP Forums Archive
OnPlayerGiveDamage / Anti- Teamkill Help! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerGiveDamage / Anti- Teamkill Help! (/showthread.php?tid=408674)



OnPlayerGiveDamage / Anti- Teamkill Help! - California_ - 19.01.2013

[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.


Re: OnPlayerGiveDamage / Anti- Teamkill Help! - s0nic - 19.01.2013

Simply change killerid to damagedid and give it a go..


Respuesta: OnPlayerGiveDamage / Anti- Teamkill Help! - SaiB0T - 19.01.2013

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;
}



Re: OnPlayerGiveDamage / Anti- Teamkill Help! - V_LOPE - 19.01.2013

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;
}