Set player team from Filterscript
#1

I am scripting a Filterscript for a server, it's not my server, but i am just a scripter of some of the filterscripts.

And then, i tried using SetPlayerTeam, but when i enter the server, the SetPlayerTeam doesn't works, i still have my old team. Are there anything that i can do with it?
Reply
#2

anybody?
Reply
#3

did u take any previous SetPlayerTeam stuff out of the GM itself?
Reply
#4

is it like this
pawn Код:
SetPlayerTeam(playerid, 1);
_________________________________________________
(playerid, 1);
[b][1] is what team NUMBER u put the player in
Reply
#5

Hi VirSpectorX,

If you are having trouble using SetPlayerTeam you could try using your own variables.

eg.

Код:
//Top of script
new Team[MAX_PLAYERS];
//OnPlayerConnect
Team[playerid] = -1;
//Loading stats / OnPlayerSpawn
Team[playerid] = TEAM VARIABLE HERE
//And to reference:
if(Team[playerid] == TEAM VARIABLE HERE)
I have found this the easiest way to track player teams. Give it a go.

Cheers,

TJ
Reply
#6

No, in the game mode, there already a Team system.

Now, i tried to use SetPlayerTeam(playerid, #teamid#); in a filterscript but it doesn't works...

(#teamid# is the id of the team i set in the filtersript)
Reply
#7

Quote:
Originally Posted by KDlivest954
did u take any previous SetPlayerTeam stuff out of the GM itself?
Yes
Reply
#8

Use PVar.

In your GM
Код:
SetPvarInt(playerid,"Team",Teamid);
Now when you try to get the team of the player in your FS, you'll do :

Код:
new teamid[MAX_PLAYERS];
teamid[playerid]=GetPVarInt(playerid,"Team");
There you have the team id.
Reply
#9

Quote:
Originally Posted by DJDhan
Use PVar.

In your GM
Код:
SetPvarInt(playerid,"Team",Teamid);
Now when you try to get the team of the player in your FS, you'll do :

Код:
new teamid[MAX_PLAYERS];
teamid[playerid]=GetPVarInt(playerid,"Team");
There you have the team id.
No, what i want is, to set the Player Team, not to get the player team...
Reply
#10

The above code would let you check for a player's team in any of your FSs.

To set a player's team
Код:
#define TEAM_ONE 1
#define TEAM_TWO 2
new gTeam[MAX_PLAYERS];
Then under OnPlayerRequestClass
Call a function to set the player's team like so:
Код:
SetPlayerTeamFromClass(playerid,classid);
Код:
forward SetPlayerTeamFromClass(playerid,classid);
public SetPlyerTeamFromClass(playerid,classid)
{
if(classid==0) gTeam[playerid] = TEAM_ONE;
if(classid==1) gTeam[playerid] = TEAM_TWO;
return 1;
}
Under OnPlayerSpawn
Код:
SetPlayerTeam(playerid,gTeam[playerid]);
I've answered a topic similar to yours, please search.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)