SA-MP Forums Archive
How could i disable Teamkill - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How could i disable Teamkill (/showthread.php?tid=82795)



How could i disable Teamkill - will_92 - 20.06.2009

i want a code where i could disable teamkill , so like teamates cannot damage each other


Re: How could i disable Teamkill - Grim_ - 20.06.2009

pawn Код:
OnPlayerSpawn(playerid)
{
  if(gTeam[playerid] == TEAM_ONE) //some check to see if a players team = X
  {
   SetPlayerTeam(playerid, 1);
  }
  else if (gTeam[playerid] == TEAM_TWO)
  {
   SetPlayerTeam(playerid, 2);
  }
  return 1;
}
That's all, but there's one important thing, it's not always sycned so at times you can kill your teammates.


Re: How could i disable Teamkill - Mr_Finnigan - 20.06.2009

Код:
// top of your gamemode
forward SettingPlayerTeam();
//OnPlayerConnect
SetTimerEx("SettingPlayerTeam",10,1,"d",playerid);
//Bottom of your script
public SettingPlayerTeam()
{
  for(new playerid; playerid < 200; playerid++)
    SetPlayerTeam(playerid, gTeam[playerid]);
  return 1;
}
I found this from Seif and ive used it and it always works for me


Re: How could i disable Teamkill - Grim_ - 20.06.2009

Don't you mean:
forward SettingPlayerTeam(playerid);
public SettingPlayerTeam(playerid)


Re: How could i disable Teamkill - Mr_Finnigan - 20.06.2009

Nope just as its written,works like a charm.


I have heard several question it but its always worked,I beleive Seif said its built into sa-mp and these are callbacks for it.


Re: How could i disable Teamkill - will_92 - 20.06.2009

now , how would i replace the gTeam with ?,, and the playerid;playerdid<200 with ?


Re: How could i disable Teamkill - Grim_ - 20.06.2009

If so, then there's no reason for using SetTimerEx, simply because there's no use of putting that extra "playerid" format.
You could just use SetTimer("SettingPlayerTeam", 100, 1);


Re: How could i disable Teamkill - will_92 - 20.06.2009

kk , but what do i replace with gTeam and playerid;playerid with ?
im trying to make something like , when teamates shoot each other they can't do anydamages , but like they could damage the other team
and


C:\Documents and Settings\Owner\Desktop\SGGW.pwn(3723) : error 017: undefined symbol "gTeam"
C:\Documents and Settings\Owner\Desktop\SGGW.pwn(3723) : error 017: undefined symbol "playerid"
C:\Documents and Settings\Owner\Desktop\SGGW.pwn(3723) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Owner\Desktop\SGGW.pwn(3723) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.


Re: How could i disable Teamkill - Grim_ - 20.06.2009

Learn the basics of scripting documentation on the wiki.
https://sampwiki.blast.hk/wiki/Main_Page


Re: How could i disable Teamkill - will_92 - 20.06.2009

C:\Documents and Settings\Owner\Desktop\SGGW.pwn(3723) : error 017: undefined symbol "gTeam"
C:\Documents and Settings\Owner\Desktop\SGGW.pwn(3723) : error 017: undefined symbol "playerid"
C:\Documents and Settings\Owner\Desktop\SGGW.pwn(3723) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Owner\Desktop\SGGW.pwn(3723) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.