Question about getplayerteam & setplayerteam - 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: Question about getplayerteam & setplayerteam (
/showthread.php?tid=123820)
Question about getplayerteam & setplayerteam -
GMusicOn - 27.01.2010
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.
Re: Question about getplayerteam & setplayerteam -
Sergei - 27.01.2010
pawn Код:
public OnPlayerSpawn(playerid)
{
SetPlayerTeam(playerid,GetPlayerTeam(playerid));
return 1;
}
Re: Question about getplayerteam & setplayerteam -
GMusicOn - 27.01.2010
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?
Re: Question about getplayerteam & setplayerteam -
goudewup - 27.01.2010
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
Re: Question about getplayerteam & setplayerteam -
GMusicOn - 27.01.2010
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.