[Tutorial] [Tut] How to add a family in Godfather Script (/families system)
#1

What will you get out of this tutorial?
Most of you probaly know the /families system in the godfather script/Godfather script edits. At the end of this tutorial you will learn how to get the command to make a family, Learn how to add skins, how to add the /f command and add a family color.

[1]Command to make a Family...
I am going to assume that you are using a blank Godfather script, and if its not been edited you will find command's in your script called /allowcreation and /deletecreation, these should look like this:

Код:
	if(strcmp(cmd, "/allowcreation", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pLeader] == 6)
	    {
	      tmp = strtok(cmdtext, idx);
				if(!strlen(tmp)) {
					SendClientMessage(playerid, COLOR_WHITE, "USAGE: /allowcreation [FamilyNr] [playerid/PartOfName]");
					return 1;
				}
				new family = strval(tmp);
				if(family < 1 || family > 10) { SendClientMessage(playerid, COLOR_GREY, "  FamilyNr can't be below 1 or above 10 !"); return 1; }
				if(PlayerInfo[playerid][pLeader] == 5 && family > 5) { SendClientMessage(playerid, COLOR_GREY, "  La Cosa Nostra Leader can only take FamilyNr 1 till 5 !"); return 1; }
				else if(PlayerInfo[playerid][pLeader] == 6 && family < 6) { SendClientMessage(playerid, COLOR_GREY, "  Yakuza Leader can only take FamilyNr 6 till 10 !"); return 1; }
	      tmp = strtok(cmdtext, idx);
				if(!strlen(tmp)) {
					SendClientMessage(playerid, COLOR_WHITE, "USAGE: /allowcreation [FamilyNr] [playerid/PartOfName]");
					return 1;
				}
				giveplayerid = ReturnUser(tmp);
				if(IsPlayerConnected(giveplayerid))
				{
				  if(giveplayerid != INVALID_PLAYER_ID)
				  {
				    family -= 1;
				    if(FamilyInfo[family][FamilyTaken] == 1)
				    {
				      SendClientMessage(playerid, COLOR_GREY, "  That FamilyNr is already taken !" );
				      return 1;
				    }
				    GetPlayerName(playerid, sendername, sizeof(sendername));
				    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
				    format(string, sizeof(string), "* You've made %s the Leader of FamilyNr %d.",giveplayer,family);
				    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
				    if(PlayerInfo[playerid][pLeader] == 5)
				    {
				      format(string, sizeof(string), "* La Cosa Nostra Leader %s has made you a Family Leader of FamilyNr %d.",sendername,family);
				    	SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
				    }
				    else if(PlayerInfo[playerid][pLeader] == 6)
				    {
				      format(string, sizeof(string), "* Yakuza Leader %s has made you a Family Leader of FamilyNr %d.",sendername,family);
				    	SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
				    }
				    format(string, sizeof(string), "%s",giveplayer);
				    strmid(FamilyInfo[family][FamilyLeader], string, 0, strlen(string), 255);
				    FamilyInfo[family][FamilyMembers] ++;
				    FamilyInfo[family][FamilyTaken] = 1;
				    PlayerInfo[giveplayerid][pFMember] = family;
				    SaveFamilies();
				  }
				}
				else
				{
          SendClientMessage(playerid, COLOR_GREY, "  That player is Offline !");
          return 1;
				}
	    }
	    else
	    {
	      SendClientMessage(playerid, COLOR_GREY, "  You are not the Leader of one of the Organisations !");
	      return 1;
	    }
	  }
	  return 1;
	}
	if(strcmp(cmd, "/deletecreation", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pLeader] == 6)
	    {
	      tmp = strtok(cmdtext, idx);
				if(!strlen(tmp)) {
					SendClientMessage(playerid, COLOR_WHITE, "USAGE: /deletecreation [FamilyNr]");
					return 1;
				}
				new family = strval(tmp);
				if(family < 1 || family > 10) { SendClientMessage(playerid, COLOR_GREY, "  FamilyNr can't be below 1 or above 10 !"); return 1; }
				if(PlayerInfo[playerid][pLeader] == 5 && family > 5) { SendClientMessage(playerid, COLOR_GREY, "  La Cosa Nostra Leader can only take FamilyNr 1 till 5 !"); return 1; }
				else if(PlayerInfo[playerid][pLeader] == 6 && family < 6) { SendClientMessage(playerid, COLOR_GREY, "  Yakuza Leader can only take FamilyNr 6 till 10 !"); return 1; }
				family -= 1;
				if(FamilyInfo[family][FamilyTaken] != 1)
				{
				  SendClientMessage(playerid, COLOR_GREY, "  That FamilyNr isn't taken !");
				  return 1;
				}
				ClearFamily(family);
				SaveFamilies();
	    }
	    else
	    {
	      SendClientMessage(playerid, COLOR_GREY, "  You are not the Leader of one of the Organisations !");
	      return 1;
	    }
	  }
	  return 1;
	}
If you look at these commands in your script you will see it say some stuff about La Costra Nostra and Yakuza, this is because these commands were originaly made for the factions to create families, Although for this im assuming you want admins to use the commands, so we need to delete thse lines..

Код:
				if(PlayerInfo[playerid][pLeader] == 5 && family > 5) { SendClientMessage(playerid, COLOR_GREY, "  La Cosa Nostra Leader can only take FamilyNr 1 till 5 !"); return 1; }
				else if(PlayerInfo[playerid][pLeader] == 6 && family < 6) { SendClientMessage(playerid, COLOR_GREY, "  Yakuza Leader can only take FamilyNr 6 till 10 !"); return 1; }
and replace them with..

Код:
				if(PlayerInfo[playerid][pAdmin] <= 1336) { SendClientMessage(playerid, COLOR_GREY, "  Admin 1337+ only!"); return 1; }
do this for both /allowcreation and /deletecreation so now they are both admin commands and not Factions commands, Now you have got the command ready we will move onto Adding skins.

[2]Adding family skins...
This is the main bit of the tutorial, this is where we add skins for families. Assumeing that you have made someone a family with /allowcreation in game we will make this skin thing...now lets say that you gave someone family slot 5 and he is going to make it Grove. He uses the /adjust command in game to set the Spawn spot, Name, MOTD and i think maybe a few other things... To do the skin we do this in the script and we do this by going to the /clothes command on to script..... in that command there is a line like this..

Код:
SelectCharID[playerid] = PlayerInfo[playerid][pMember];
you need to change this so it sets that varible as the Family, not Faction, so change it to..

Код:
SelectCharID[playerid] = PlayerInfo[playerid][pFMember];
now whatever ur family id is, that variable will be it, Although it works a little differently that you think...in our case the slot id is 5..so you expect your pFMember to be 5? well it isnt, it is 4... because on /families it goes from 1,2,3 to 10... but on the script it goes from 0,1,2 to 9.. so in our case the pFMember is 4 even though the slot id is 5....hope that makes sense....

Now you need to use ctrl+F and search for 'public onplayertext' and the will be a big section underneath "switch (SelectCharID[playerid])" and this is where you set up your skins for families. you will see lots of 'case 1: , case 2:' e.t.c. the number after Case is the family id, so in our case Case 4: is what we will be using... before you do anything remove all of those case's, (if you wanna keep /clothes for factions, i will show you how to do that in a second tutoriall....) now add

Код:
				case 4:
				{
				}
Or case for whatever family you are making of course..

Now in the 'case' you gotta set the skins and this bit is annoying to do but its pretty simple. before we look at what we put in the 'case' search for.."new joinped" and there will be a big list of numbers this is skins, and this is where we put the grove skins..

the '52' should be how many skins are on that list (starts from 1 i THINK.. ). and you need to add your three skins to the bottom like this:

Код:
{000},
{000},
{000} // no ',' on last one
once you added these you need to add 3 to that '52' so i will make mine 55... Now go back to case and add these lines, edited to fit your script..

Код:
				  if(SelectCharPlace[playerid] == 1) { SetPlayerSkin(playerid, JoinPed[48][0]); SelectCharPlace[playerid] = 2; ChosenSkin[playerid] = JoinPed[52][0]; }
				  else if(SelectCharPlace[playerid] == 2) { SetPlayerSkin(playerid, JoinPed[49][0]); SelectCharPlace[playerid] = 3; ChosenSkin[playerid] = JoinPed[53][0]; }
				  else if(SelectCharPlace[playerid] == 3) { SetPlayerSkin(playerid, JoinPed[50][0]); SelectCharPlace[playerid] = 1; ChosenSkin[playerid] = JoinPed[54][0]; }
So that should work... and if you go to your account or tell your 'friend' with that family to go try /clothes command, it should work...


[3]Setting Family Colors...
You should have a callback called... 'SetPlayerToTeamColor', if not you need to set this at the top of the script:

Код:
forward SetPlayerToTeamColor(playerid);
and you need to add this into your script aswel...

Код:
public SetPlayerToTeamColor(playerid)
{
	if(IsPlayerConnected(playerid))
	{
	}
}
Ok, now make sure that you have got the this called onplayerspawn at the end of it (if its not there)... 'SetPlayerToTeamColor(playerid);' Now on the 'public' bit you need to do something like this (the pFMember is whatever the family slot is - 1...so slot 5 is pFMember is 4...)

Код:
if(PlayerInfo[playerid][pFMember] == 4) SetPlayerColor(playerid, COLOR_PURPLE);
Although please make sure you set the color to white for everyone so that everyones default color color is white, so it should look like this at this point..

Код:
public SetPlayerToTeamColor(playerid)
{
	if(IsPlayerConnected(playerid))
	{
		SetPlayerColor(playerid,COLOR_WHITE); // white
		if(PlayerInfo[playerid][pFMember] == 4) SetPlayerColor(playerid, COLOR_PURPLE);
	}
}
So, i hope this tutorial helps, ive ran through it pretty fast so if i get feedback that says i should re-do it, i am happy to do so...

Reply
#2

Nice tutorial, it will help newbies editting their GF script.
Reply
#3

yeah... good job, atleast this will make GF edits more original!
Reply
#4

Quote:
Originally Posted by KristianB
Nice tutorial, it will help newbies editting their GF script.
Yea, im gonna make a few godfather tutorials so whenever someone asks a question in godfather topic i can just say 'go to this link' lol
Reply
#5

Quote:

Yea, im gonna make a few godfather tutorials so whenever someone asks a question in godfather topic i can just say 'go to this link' lol

well good job! atleast if people are gonna make GF edits... they might be good :P

i still prefer scripting your own stuff but... you know
Reply
#6

God Job!
Reply
#7

ok can u do all of this and upload the pwn. ok?
www.m-o-m@hotmail.com add me thanks
Reply
#8

Where to find that script if(strcmp(cmd, "/allowcreation", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pLeader] == 6)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /allowcreation [FamilyNr] [playerid/PartOfName]");
return 1;
}
new family = strval(tmp);
if(family < 1 || family > 10) { SendClientMessage(playerid, COLOR_GREY, " FamilyNr can't be below 1 or above 10 !"); return 1; }
if(PlayerInfo[playerid][pLeader] == 5 && family > 5) { SendClientMessage(playerid, COLOR_GREY, " La Cosa Nostra Leader can only take FamilyNr 1 till 5 !"); return 1; }
else if(PlayerInfo[playerid][pLeader] == 6 && family < 6) { SendClientMessage(playerid, COLOR_GREY, " Yakuza Leader can only take FamilyNr 6 till 10 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /allowcreation [FamilyNr] [playerid/PartOfName]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
family -= 1;
if(FamilyInfo[family][FamilyTaken] == 1)
{
SendClientMessage(playerid, COLOR_GREY, " That FamilyNr is already taken !" );
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You've made %s the Leader of FamilyNr %d.",giveplayer,family);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
if(PlayerInfo[playerid][pLeader] == 5)
{
format(string, sizeof(string), "* La Cosa Nostra Leader %s has made you a Family Leader of FamilyNr %d.",sendername,family);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
}
else if(PlayerInfo[playerid][pLeader] == 6)
{
format(string, sizeof(string), "* Yakuza Leader %s has made you a Family Leader of FamilyNr %d.",sendername,family);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
}
format(string, sizeof(string), "%s",giveplayer);
strmid(FamilyInfo[family][FamilyLeader], string, 0, strlen(string), 255);
FamilyInfo[family][FamilyMembers] ++;
FamilyInfo[family][FamilyTaken] = 1;
PlayerInfo[giveplayerid][pFMember] = family;
SaveFamilies();
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is Offline !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not the Leader of one of the Organisations !");
return 1;
}
}
return 1;
}
if(strcmp(cmd, "/deletecreation", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pLeader] == 6)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /deletecreation [FamilyNr]");
return 1;
}
new family = strval(tmp);
if(family < 1 || family > 10) { SendClientMessage(playerid, COLOR_GREY, " FamilyNr can't be below 1 or above 10 !"); return 1; }
if(PlayerInfo[playerid][pLeader] == 5 && family > 5) { SendClientMessage(playerid, COLOR_GREY, " La Cosa Nostra Leader can only take FamilyNr 1 till 5 !"); return 1; }
else if(PlayerInfo[playerid][pLeader] == 6 && family < 6) { SendClientMessage(playerid, COLOR_GREY, " Yakuza Leader can only take FamilyNr 6 till 10 !"); return 1; }
family -= 1;
if(FamilyInfo[family][FamilyTaken] != 1)
{
SendClientMessage(playerid, COLOR_GREY, " That FamilyNr isn't taken !");
return 1;
}
ClearFamily(family);
SaveFamilies();
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not the Leader of one of the Organisations !");
return 1;
}
}
return 1;
}
Reply
#9

1: use [code ] [/code ] (without spaces in the [])

2: use the PAWNO search function (the binacular button) and search /allowcreation

3: you can find it in the GF script
Reply
#10

Well, with this pawn, can admins give family slot to any member in other script, or only GF Script?
Reply
#11

Quote:
Originally Posted by Leko
View Post
Well, with this pawn, can admins give family slot to any member in other script, or only GF Script?
Don't bump old topics. Family system is static on The Godfather and you may have to increase the slots in-order to add more families.
Reply
#12

Anyway there shouldn't even be tutorial such as this, as godfather is really outdated.
Reply
#13

This tutorial was made when the GF was in it's "Golden" days, the time when GF edits were very rare.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)