SetPlayerTeam(playerid, );
#1

Hello!'

I use "SetPlayerTeam(playerid, );" to set players to a team when spawning, but of some reason you are still able to kill a team mate if you enter the server before a another player, i mean.... if you and me are on the server and i restart it, both of us cant kill each other, but if i re logging you can kill me, it is like the first one to join can kill the others who join :S

is that a samp bug or something in my script who makes it like this?
Reply
#2

Not sure what the exact problem is but I know that SetPlayerTeam is bugged (and I don't know it that was fixed already but it seems like not). And the only (AFAIK) fix is to reset SetPlayerTeam.

Try to put SetPlayerTeam for everyone in a timer:
pawn Код:
SetTimer("fixTeams", 1000, true);
pawn Код:
forward fixTeams(); public fixTeams()
{
    for(new i, j = GetMaxPlayers(); i < j; ++i)
    {
        SetPlayerTeam(i, GetPlayerTeam(i));
    }
}
I could be wrong though! I didn't work with teams a lot.
Reply
#3

Quote:
Originally Posted by RyDeR`
Посмотреть сообщение
Not sure what the exact problem is but I know that SetPlayerTeam is bugged (and I don't know it that was fixed already but it seems like not). And the only (AFAIK) fix is to reset SetPlayerTeam.

Try to put SetPlayerTeam for everyone in a timer:
pawn Код:
SetTimer("fixTeams", 1000, true);
pawn Код:
forward fixTeams(); public fixTeams()
{
    for(new i, j = GetMaxPlayers(); i < j; ++i)
    {
        SetPlayerTeam(i, GetPlayerTeam(i));
    }
}
I could be wrong though! I didn't work with teams a lot.
Yeah it seams its not fixed, i didnt know at all that SetPlayerTeam was bugged, so i try with your timer and see if that makes it work, thanks!
Reply
#4

As the default team for the player is NO_TEAM, would it still work if when they connected you set their team to NO_TEAM?

Sorry to high-jack your thread, btw.
Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
You don't need a timer at all. You just need to set all teams when a player joins or they won't be correctly set for new (or existing, one of the two) players.
i dont know if i can do that, bc i check if a player is a member in a faction when they spawn, and if he is in a faction, he gets in the right team for the right faction.
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
OK, and why can't you call SetPlayerTeam when you do that? It's exactly the same code as you have in your timer, just called when you want to set one team, instead of every second.
I mean that when a player connects, they have 0 on everything until they login and spawn, and if everything is at 0 when they connect, i cant set the teams when they join/connect with this.
pawn Код:
if(Member[playerid] == 0)
pawn Код:
if(Leader[playerid] == 1)
Reply
#7

Quote:
Originally Posted by ******
Посмотреть сообщение
No, so set it when you can do that then.
Thats just what i already have done, i set the players in teams when they spawn, but as i told in first post. the already logged in player can kill the next player who logs on even if they are in same team.
Reply
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
Yes, that's why, as we've been saying, you set EVERYONES team when someone logs in.
So? if you are putted in team 1, you shouldn't be able to kill other who is in team 1 even if they join after you and so on..
Reply
#9

Quote:
Originally Posted by ******
Посмотреть сообщение
No, but you can because existing team settings are not sent to new players - it's a bug and this is how you work around it.
So then i need to put that timer on OnPlayerConnect?
Reply
#10

Quote:
Originally Posted by ******
Посмотреть сообщение
No, you don't need the timer at all. You just need to call that function after calling SetPlayerTeam when the person logs in.
Gah... i wish i was a better scripter -_-

what function do you mean? that one RyDeR was talking about? or do you mean some one other function?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)