Players in groups
#1

Hello,

I want to have 2 "groups" witch are in this case: group_one and group_two.
I got a timer that has a callback function and I need to have in the callback function a script that will put the player in either team_one or team_two. (Prefer auto asign)
So not on PlayerRequestClass or something but on my callback.

All things I want to happen after the countdown are listed in this callback:

pawn Код:
forward CountdownMechanics();
public CountdownMechanics()
Also I need something so I can see if someone is in team_one or team_two like:

pawn Код:
If(pTeam[playerid] == team_one)
{
    return 1;
}
Or something.

I've tried so much things but can't get the teams working.
Please help me if possible.
Reply
#2

I didn't get what you want, for groups you can use y_groups, however.
Reply
#3

you should define a value to each team, like
pawn Код:
#define team_none 0
#define team_one 1
#define team_two 2
...then your if(pTeam[playerid])==team_one) check works already.
a player, freshly joined, has 0 in his pTeam[] cell, thats why its clever to check if a player is NOt assigned to a team yet similar to yours:
pawn Код:
if(pTeam[playerid])==team_none)
{
pTeam[playerid]=team_one;
}
...this would put any player into teamone. in order to balance it, its a good idea to simply count all players' teams, and chose the side with less players. if its equal, chose a random team ( random(2)+1 ).
Reply
#4

Quote:
Originally Posted by Babul
Посмотреть сообщение
you should define a value to each team, like
pawn Код:
#define team_none 0
#define team_one 1
#define team_two 2
...then your if(pTeam[playerid])==team_one) check works already.
a player, freshly joined, has 0 in his pTeam[] cell, thats why its clever to check if a player is NOt assigned to a team yet similar to yours:
pawn Код:
if(pTeam[playerid])==team_none)
{
pTeam[playerid]=team_one;
}
...this would put any player into teamone. in order to balance it, its a good idea to simply count all players' teams, and chose the side with less players. if its equal, chose a random team ( random(2)+1 ).
Could you give an example on the balance? I tried some things but it didnt work out well.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)