[Questions] Teams, Commands, Binding.
#1

Question One:
Creating a team

Question Two:
Making Ranks In One Team
Example:
Код:
Drug Leader: Drew // Rank 1
Drug Co-Leader: Bob // Rank 2
Drug Dealer: Nick // Rank 3
Drug Deliver: Alex // Rank 4
Question Three:
Making A Command That Displays Ranks Of People In A Team
Example:
pawn Код:
new drugr1; // Drug rank One
new drugr2;
if(strcmp(cmdtext, "/DrugCo", true)==0) {
format(drugr1, 70, "Drug Leader Is: %s", rank1);
SendClientMessage(playerid, red, drugr1);
format(drugr2, 70, "Drug Co-Leader Is: %s", rank2);
SendClientMessage(playerid, red, drugr2);
Question Four:
Binding Specified Ranks To Drive Certain Vehicles.

Please Only Post If You Can Help,
There Might Be A Cash Donation To You If You Help Majorly

Cheers,
Nameless.
Reply
#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
#3

dam! that was fast ill try these in a bit and if it works and you have a paypal ill give you maybe 10$ depending on whats on my card i hope i got 10$ on it =P
Reply
#4

Donate it to Kye or give it to charity or something, cheers anyway.

Also wrappers would be good to use instead of typing the arrays out each time you could do this:

pawn Код:
#define SetTeam(%1,%2)   gPlayerTeam[ %1 ][ 0 ] = %2
#define GetTeam(%1)     gPlayerTeam[ %1 ][ 0 ]

#define SetRank(%1,%2)    gPlayerTeam[ %1 ][ 1 ] = %2
#define GetRank(%1)     gPlayerTeam[ %1 ][ 1 ]
Obviously some OOB security would be good but again it's just a starting point for you to work from.
Reply
#5

ok =)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)