How could i disable Teamkill
#1

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

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.
Reply
#3

Код:
// 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
Reply
#4

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

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.
Reply
#6

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

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);
Reply
#8

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.
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)