SA-MP Forums Archive
How to create a faction? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to create a faction? (/showthread.php?tid=377800)



How to create a faction? - MrBorsh - 15.09.2012

Hey, I was wondering if anyone could teach me how to create a faction? let's say LSPD.


Re: How to create a faction? - doreto - 15.09.2012

Teach on what ? its basicly likes of code that tell to server what to do ? there is nothing for learn you need to know all pawn function (most of it , all its will be great) , its like you are saying "teatch me to write" you cant write if you dont know the letters - learn the pawn function you can do whatever you wont by yourself


Re: How to create a faction? - Sig Hansen - 15.09.2012

learn2script

take a look in other gamemodes, we cant really help you unless you give us more information
the word goverment or w/e is way too wide, it could be team based or faction based, etc etc

https://sampforum.blast.hk/showthread.php?tid=107762


Re: How to create a faction? - RLGaming - 15.09.2012

Quote:

enum pInfo
{
pLeader,
pRank,
pMember
};

new PlayerInfo[MAX_PLAYERS][pInfo];


Making somebody a leader. (Took from my script)
CMD:makeleader(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 5)
{
new string[128], giveplayerid, faction;
if(sscanf(params, "ud", giveplayerid, faction))
{
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeleader [playerid] [factionid]");
SendClientMessageEx(playerid, COLOR_LIGHTGREEN, "|1 LSPD |2 FBI |3 FDSA |4 SAAS");
return 1;
}
if(faction > 13 || faction < 0) { SendClientMessageEx(playerid, COLOR_YELLOW, "Don't go below number 0 or above number 4!"); return 1; }

if(IsPlayerConnected(giveplayerid))
{
new ftext[30];
PlayerInfo[giveplayerid][pLeader] = faction;
PlayerInfo[giveplayerid][pRank] = 6;
PlayerInfo[giveplayerid][pMember] = faction;
if(PlayerInfo[giveplayerid][pLeader] == 1) { ftext = "LSPD"; }
else if(PlayerInfo[giveplayerid][pLeader] == 2) { ftext = "FBI"; }
else if(PlayerInfo[giveplayerid][pLeader] == 3) { ftext = "FSDA"; }
else if(PlayerInfo[giveplayerid][pLeader] == 4) { ftext = "SAAS"; }
else { return 1; }


format(string, sizeof(string), "You have been made the leader of the %s by Administrator %s.",ftext, GetPlayerNameEx(playerid));
SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have made %s the leader of the %s.", GetPlayerNameEx(giveplayerid),ftext);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}

If you need anymore help, PM me, i can explain it further.


Re: How to create a faction? - Sig Hansen - 15.09.2012

Quote:
Originally Posted by RLGaming
Посмотреть сообщение
If you need anymore help, PM me, i can explain it further.
How to create a faction?
IS A QUESTION!




HE WANTS TO MAKE HIS OWN FACTION! NOT JUST /makeleader




Re: How to create a faction? - MrBorsh - 15.09.2012

chill guys, I've been scripting 2000 lines in my current script, and I am just using this script to train myself. It would be great if someone could explain it properly how to make a faction. Not like TDM faction but RP. That makeleader is nice, seems very common to me using sscanf2 and zcmd, so that's a good start actually.. But, could anyone try to make it for me and explain the lines, so I could like make it stuck to my head?


Re: How to create a faction? - Sig Hansen - 15.09.2012

Quote:
Originally Posted by MrBorsh
Посмотреть сообщение
chill guys, I've been scripting 2000 lines in my current script, and I am just using this script to train myself. It would be great if someone could explain it properly how to make a faction. Not like TDM faction but RP. That makeleader is nice, seems very common to me using sscanf2 and zcmd, so that's a good start actually.. But, could anyone try to make it for me and explain the lines, so I could like make it stuck to my head?
RP Factions Are Based As The Teams.
So please Again Read;
https://sampforum.blast.hk/showthread.php?tid=107762

Thank You.


Re: How to create a faction? - RLGaming - 15.09.2012

Код:
enum pInfo
{
pLeader,
pRank,
pMember
};
Thats defining the information you'll be using for the factions.

So if there a pLeader then they will be classed as a rank 6(or whatevers your highest rank in the faction).

The pRank is meaning what rank they are, so for eg: /giverank [playerid] [rank] - It will give them a new rank, like
PlayerInfo[playerid][pRank] = rank;

The pMember is basically just saying they are in a faction and which one.

Making someone a higher/lower rank;
Код:
CMD:giverank(playerid, params[])
{
    new pID, value;
    new rank = PlayerInfo[playerid][pLeader];
    if(rank < 6) return SCM(playerid, COLOR_WHITE, "You are not authorised to use that command.");
	else if (sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /giverank [playerid/partofname] [rank 0-6]");
	else if (value < 0 || value > 6) return SendClientMessage(playerid, COLOR_WHITE, "Unknown rank! [0 - 6]");
	else if(pID == INVALID_PLAYER_ID) return SCM(playerid, COLOR_WHITE,"Invalid player ID.");
	else
	{
	   	new pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128];
	   	GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
	    GetPlayerName(pID, tName, MAX_PLAYER_NAME);
	    format(string, sizeof(string), "You have promoted %s to rank %i!", tName, value);
	    SCM(playerid, COLOR_LIGHTBLUE, string);
	    format(string, sizeof(string), "You have been promoted to rank %i!", value, pName);
	    SCM(pID, COLOR_LIGHTBLUE, string);
	    PlayerInfo[pID][pRank] = value;
    }
    return 1;
}
As I said above, your adding the playerID you chosen through sscanf and assigning it to the rank; PlayerInfo[pID][pRank] = value;

You can also changed pID to giveplayerid and add new giveplayerid at the top of the CMD.

Hope this says everything, im not exactly a good scripter so im learning it myself, so if you need anymore help PM me!


Re: How to create a faction? - Stanford - 15.09.2012

Read the tutorial that was written by maiko


Re: How to create a faction? - MrBorsh - 15.09.2012

Quote:
Originally Posted by Edmund_Kavel
Посмотреть сообщение
Read the tutorial that was written by maiko
link?