[Tutorial] [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base
#23

Quote:
Originally Posted by Ritchie999

I assign the skins, for police i use skins 280 to 286
and for the gangs i use all the gang skins.

so basically, the leader of the gang invites people, and when they quit and re-join they are still in the gang but they have to be invited into the faction to join it
Alright so you want it to save what faction there in after the leader invites them.

So first your gonna need a Saving system, if you already have on and understand it well then skip this step.

http://forum.sa-mp.com/index.php?topic=126584.0
Very simple tutorial to make a dini saving system.

After you set up your players save files, it's time we add the variables for players stats.

under the enum pInfo.

pawn Code:
enum pInfo
{
/* The stuff in the tutorial */,
pTeam,
pLeader,
}
Under the /register command look for were it is creating the file.
For dini look for dini_IntSet(file, "name", somthing);
add the two saves for Team, and Leader.

After you do that, under the /login command, create the function that will load the Team save, and Leader Save, and set it to pTeam, and pLeader.
pawn Code:
gTeam = dini_Set(file, "Team")
And example.

pawn Code:
if(strcmp(cmd, "/invite", true) == 0)
    {
      if(PlayerInfo[playerid][Leader] == 1)
      {
        if(gTeam[playerid] == 1)
            {
              if(!strlen(cmd[7])) return SendClientMessage(playerid, 0xAFAFAFAA, "USAGE: /invite [playerid]");
              new otherplayerid = strval(cmdtext[9]);
              if(!IsPlayerConnected(otherplayerid)) return SendClientMessage(playerid, 0xAFAFAFAA, "That player isnt connected");
              if(otherplayerid == playerid) return SendClientMessage(playerid, 0xFF0000AA, "You cannot invite yourself!!");
              new gstring[128], string2[128];
              new adminname[MAX_PLAYER_NAME], otherguysname[MAX_PLAYER_NAME];
              GetPlayerName(playerid,adminname,sizeof(adminname));
              GetPlayerName(otherplayerid,otherguysname,sizeof(otherguysname));
              format(gstring,sizeof(gstring),"** You have invited %s", otherguysname);
              format(string2,sizeof(string2),"** You were invited to join a faction by %s", adminname);
              SendClientMessage(playerid, 0x00E100FF, gstring);
              SendClientMessage(otherplayerid, 0x00E100FF, string2);
              gTeam[otherplayerid] = 1;
              SetPlayerHealth(otherplayerid, 0.00 );
              return 1;
            }
        return 1;
        }
        if(PlayerInfo[playerid][Leader] == 1)
      {
        if(gTeam[playerid] == 2)
            {
              if(!strlen(cmd[7])) return SendClientMessage(playerid, 0xAFAFAFAA, "USAGE: /invite [playerid]");
              new otherplayerid = strval(cmdtext[9]);
              if(!IsPlayerConnected(otherplayerid)) return SendClientMessage(playerid, 0xAFAFAFAA, "That player isnt connected");
              if(otherplayerid == playerid) return SendClientMessage(playerid, 0xFF0000AA, "You cannot invite yourself!!");
              new gstring[128], string2[128];
              new adminname[MAX_PLAYER_NAME], otherguysname[MAX_PLAYER_NAME];
              GetPlayerName(playerid,adminname,sizeof(adminname));
              GetPlayerName(otherplayerid,otherguysname,sizeof(otherguysname));
              format(gstring,sizeof(gstring),"** You have invited %s", otherguysname);
              format(string2,sizeof(string2),"** You were invited to join a faction by %s", adminname);
              SendClientMessage(playerid, 0x00E100FF, gstring);
              SendClientMessage(otherplayerid, 0x00E100FF, string2);
              gTeam[otherplayerid] = 2;
              SetPlayerHealth(otherplayerid, 0.00 );
              return 1;
            }
        return 1;
        }
      else
      {
        SendClientMessage(playerid, COLOR_RED, "Only Leaders can Invite.");
        return 1;
        }
    }
An example of my /invite command.
The pLeader is there to make sure the leader is the only one who can invite.

You can do even more, such as pick skins, and respawn the player.
Reply


Messages In This Thread
[TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by retart441 - 10.11.2009, 23:44
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by DiddyBop - 10.11.2009, 23:50
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted - by retart441 - 10.11.2009, 23:59
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by Daren_Jacobson - 11.11.2009, 01:11
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by Avsecret - 11.11.2009, 01:25
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted - by retart441 - 11.11.2009, 02:44
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by Daren_Jacobson - 11.11.2009, 03:35
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by Sergei - 11.11.2009, 04:35
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by retart441 - 11.11.2009, 04:42
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by LarzI - 11.11.2009, 08:22
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted - by retart441 - 11.11.2009, 21:52
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by Ritchie999 - 16.11.2009, 01:35
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by Retardedwolf - 16.11.2009, 03:20
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by Ritchie999 - 16.11.2009, 11:17
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by LarzI - 16.11.2009, 14:16
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by [LCG]TANKER - 16.11.2009, 20:10
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted - by retart441 - 16.11.2009, 20:28
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted - by Ritchie999 - 16.11.2009, 20:35
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by Peter_Corneile - 16.11.2009, 20:37
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted - by retart441 - 16.11.2009, 23:31
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by Retardedwolf - 17.11.2009, 08:20
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted - by Ritchie999 - 17.11.2009, 18:54
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted - by retart441 - 17.11.2009, 19:18
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by Alex_Cop - 19.12.2009, 10:13
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by CJ101 - 19.12.2009, 10:16
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted - by philmckrakin - 22.12.2009, 00:01
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by roar - 22.12.2009, 00:25
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by CSMajor - 21.07.2010, 21:28
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by whosHate - 02.08.2012, 22:54
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by Astrais - 04.01.2013, 18:53
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by AA9 - 11.06.2013, 15:52
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by Inverse - 15.06.2013, 15:07
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by iokito7 - 04.07.2013, 09:59
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by ciberblue - 14.12.2013, 02:16
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by boomerboom - 14.12.2013, 07:27
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by djones - 12.01.2014, 02:56
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by Sojo12 - 12.01.2014, 07:01
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by Calin2551 - 01.03.2014, 14:29
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by KurtBart - 17.05.2014, 13:57
Re: [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base - by TheRaGeLord - 08.02.2015, 10:43

Forum Jump:


Users browsing this thread: 3 Guest(s)