Question about getplayerteam & setplayerteam
#1

i have searched but it didn't really helped.
Some people say its bugged and some don't

I want an anti-teamkill, so i want to use setplayerteam.
Is it bugged, if yes what can i do about it to fix it as other severs have it fixed so it is posible.
Reply
#2

pawn Код:
public OnPlayerSpawn(playerid)
{
  SetPlayerTeam(playerid,GetPlayerTeam(playerid));
  return 1;
}
Reply
#3

Quote:
Originally Posted by $ЂЯĢ
pawn Код:
public OnPlayerSpawn(playerid)
{
  SetPlayerTeam(playerid,GetPlayerTeam(playerid));
  return 1;
}
Hm.. looking at that then it would be bugged since i allready applied that team number.
So i have to repeat it only on playerspawn or do i need a timer to fix it?
Reply
#4

I don't think that code's gonna work.
And if it does it is useless.
Because you are setting the team of the player to the team of the player.
Maybe you should do something like this:
Код:
public OnPlayerSpawn(playerid)
{
  if(gTeamCount[1] < gTeamCount[2])
  {
   SetPlayerTeam(playerid, 1)
   gTeamCount[1]++
  }
  else
  {
   SetPlayerTeam(playerid, 2)
   gTeamCount[2]++
   }
  return 1;
}
This will automaticly put the player in the team with the least players
Reply
#5

Quote:
Originally Posted by goudewup
I don't think that code's gonna work.
And if it does it is useless.
Because you are setting the team of the player to the team of the player.
Maybe you should do something like this:
Код:
public OnPlayerSpawn(playerid)
{
  if(gTeamCount[1] < gTeamCount[2])
  {
   SetPlayerTeam(playerid, 1)
   gTeamCount[1]++
  }
  else
  {
   SetPlayerTeam(playerid, 2)
   gTeamCount[2]++
   }
  return 1;
}
This will automaticly put the player in the team with the least players
Thanks but i allready have a balancer.
Problem is just with the teams sort off, when i have selected the army skin it works fine.
When you die you get your skin from playerclass, you can change it with another onplayerspawn so it gets the team and changes the skin to the right one.
Sometimes it works and sometimes it fails and gives me another skin.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)