[Questions] Teams, Commands, Binding.
#2

Create an array like so, this in turn creates your teams and ranks (stores them):

pawn Код:
new
  gPlayerTeam[ MAX_PLAYERS ][ 2 ]; // teamid, rankid
Set a player to a team:

pawn Код:
gPlayerTeam[ playerid ][ 0 ] = teamid; // we haven't touched the rankid yet so it's default 0
Set a players rank in thier team:

pawn Код:
gPlayteTeam[ playerid ][ 1 ] = rankid; // we don't touch the team, we just set the rank
Check if they are a dealer for team 7 (or whatever team you want):

pawn Код:
if ( gPlayerTeam[ playerid ][ 0 ] == 7 )
{
  // we are on team 7
  if ( gPlayerTeam[ playerid ][ 1 ] == 3 )
  {
    // we are a Dealer, rank 3 on team 7
  }
}
Display the rank of everyone on team 7 (uses 'foreach'):

pawn Код:
new
  lString[ 128 ];

foreach(Player, i)
{
  if ( gPlayerTeam[ i ][ 0 ] == 7 )  
  {
    format( lString, sizeof( lString ), "Player: %d on team: 7 is rank: %d", i, gPlayerTeam[ playerid ][ 1 ] );
    SendClientMessage( playerid, 0xffffffff, lString );
  }
}
For the vehicles you could use params, "SetVehicleParamsForPlayer" if I remember the name correctly but you would have to remember they stream in and out so they require setting again or you could use a state:

pawn Код:
@OnPlayerStateChange(...........
{
  // check that they just entered a vehicle
  if ( newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER )
  {
    // check what vehicle they entered
    if ( GetPlayerVehicleID( playerid ) == SOME_VEHICLE_ID_HERE )
    {
      // check thier team, for example this car is only for team 7
      if ( gPlayerTeam[ playerid ][ 0 ] != 7 ) RemovePlayerFromVehicle( playerid ); // can't remember right now if this has a vehicleid param
    }
  }
  return 1;
}
Something like that.
Reply


Messages In This Thread
[Questions] Teams, Commands, Binding. - by fsnameless - 03.01.2010, 03:24
Re: [Questions] Teams, Commands, Binding. - by Donny_k - 03.01.2010, 04:23
Re: [Questions] Teams, Commands, Binding. - by fsnameless - 03.01.2010, 04:29
Re: [Questions] Teams, Commands, Binding. - by Donny_k - 03.01.2010, 04:44
Re: [Questions] Teams, Commands, Binding. - by fsnameless - 03.01.2010, 06:05

Forum Jump:


Users browsing this thread: 1 Guest(s)