03.01.2010, 04:23
Create an array like so, this in turn creates your teams and ranks (stores them):
Set a player to a team:
Set a players rank in thier team:
Check if they are a dealer for team 7 (or whatever team you want):
Display the rank of everyone on team 7 (uses 'foreach'):
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:
Something like that.
pawn Код:
new
gPlayerTeam[ MAX_PLAYERS ][ 2 ]; // teamid, rankid
pawn Код:
gPlayerTeam[ playerid ][ 0 ] = teamid; // we haven't touched the rankid yet so it's default 0
pawn Код:
gPlayteTeam[ playerid ][ 1 ] = rankid; // we don't touch the team, we just set the rank
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
}
}
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 );
}
}
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;
}