Anti teamkill
#1

3 players, Mike Danny and Sonny.

Mike shoots Sonny and Danny - they take no damage
Danny or Sonny shoots Mike - Mike takes damge

Our team is 1, all 3 of us are in team 1.
Reply
#2

That bugs been there since...like forever...afaik
Reply
#3

Can't reproduce.
Reply
#4

Tried to code it , works sometimes , but the bug goes through few times.
Reply
#5

Quote:
Originally Posted by Burridge
That bugs been there since...like forever...afaik
What Burridge said.

It seems after a few seconds the SetPlayerTeam gets reset or something. Just make a timer every 10 or so seconds to reset the players team.
Reply
#6

Code:
#include <a_samp>

public OnGameModeInit()
{
  AddPlayerClass(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // required
}

public OnPlayerSpawn(playerid)
{
  SetPlayerTeam(playerid, 1);
}
Works fine.
Reply
#7

I threw up a quick DM mode and tried it out.

No timer, only SetPlayerTeam when they spawn (about 25/30 players)
Sometimes was able to team kill with a deagle, very rarely. People at spawn trying to kill each other, but failing. The odd team kill seen in deathbox.

Timer to update SetPlayerTeam every second (about 10/15 players)
Not one team kill that I know of.
Reply
#8

But GetPlayerTeam was returning 1 for all 3 of us?
Reply
#9

Quote:
Originally Posted by Mikep.
3 players, Mike Danny and Sonny.

Mike shoots Sonny and Danny - they take no damage
Danny or Sonny shoots Mike - Mike takes damge

Our team is 1, all 3 of us are in team 1.
Conformed, Have a TDM server for other past 2 to 3 years with coding changed @ 0.3.

Anti TK works 90% of the time, the more players, the more likely for a TK, but it cannot be produced and its, in a way rare but frequent thing.
Reply
#10

If you set team with AddClassEx or SetSpawnInfo, you will get proper team with GetPlayerTeam, but anti-team kill won't work. You need to re-apply team under OnPlayerSpawn. Also if you set team during gameplay and then die, you will stay in the same team, but anti-team kill won't be activated anymore after spawn.
Reply
#11

Team is set to 1 in both OnPlayerConnect and OnPlayerSpawn, still doesn't work. Should I use AddPlayerClassEx then?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)