Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FPATH "/Factions/%i.ini"
- #define SCM SendClientMessage
- enum pInfo
- {
- Faction,
- FacLeader,
- FacRank
- }
- new PlayerInfo[MAX_PLAYERS][pInfo];
- enum fcInfo
- {
- fName[40],
- fLeader[24],
- fMOTD[128],
- Float:fHqX,
- Float:fHqY,
- Float:fHqZ,
- Float:fHqInX,
- Float:fHqInY,
- Float:fHqInZ,
- fWorld,
- fInt,
- fInsideWorld,
- fInsideInt,
- fMoney,
- fActive,
- fInsideIcon,
- fOutsideIcon,
- fRank1[24],
- fRank2[24],
- fRank3[24],
- fRank4[24],
- fRank5[24],
- fRank6[24]
- }
- new FacInfo[MAX_FACTIONS][fcInfo];
- YCMD:accept(playerid, params[])
- {
- if(isnull(params)) return SCM(playerid, COLOR_GREY, "/accept [invite]");
- if(strcmp(params, "invite") == 0)
- {
- if(invite[playerid] == 0) return SCM(playerid, COLOR_GREY, "You were not invited to any faction!");
- SCM(playerid, COLOR_LIGHTBLUE, "You have accepted your faction!");
- PlayerInfo[playerid][Faction] = invite[playerid];
- invite[playerid] = 0;
- PlayerInfo[playerid][FacRank] = 1;
- }
- return 1;
- }
- YCMD:rank(playerid, params[])
- {
- new ID, number, string[128];
- if(PlayerInfo[playerid][FacRank] != 6) return SCM(playerid, COLOR_GREY, "You are not rank 6 in your faction!");
- if(sscanf(params, "ui", ID, number)) return SCM(playerid, COLOR_GREY, "YCMD:/rank [PlayerID] [Rank]");
- PlayerInfo[ID][FacRank] = number;
- format(string, sizeof(string), "%s has made you rank %i, in your faction! Good job!", RemoveUnderScore(playerid), number);
- SCM(ID, COLOR_LIGHTBLUE, string);
- return 1;
- }
- forward SaveFac(id);
- public SaveFac(id)
- {
- new file4[40];
- format(file4, sizeof(file4), FPATH, id);
- new INI:File = INI_Open(file4);
- INI_WriteString(File, "fName", FacInfo[id][fName]);
- INI_WriteString(File, "fLeader", FacInfo[id][fLeader]);
- INI_WriteString(File, "fMOTD", FacInfo[id][fMOTD]);
- INI_WriteFloat(File, "fHqX", FacInfo[id][fHqX]);
- INI_WriteFloat(File, "fHqY", FacInfo[id][fHqY]);
- INI_WriteFloat(File, "fHqZ", FacInfo[id][fHqZ]);
- INI_WriteFloat(File, "fHqInX", FacInfo[id][fHqInX]);
- INI_WriteFloat(File, "fHqInY", FacInfo[id][fHqInY]);
- INI_WriteFloat(File, "fHqInZ", FacInfo[id][fHqInZ]);
- INI_WriteInt(File, "fWorld", FacInfo[id][fWorld]);
- INI_WriteInt(File, "fInt", FacInfo[id][fInt]);
- INI_WriteInt(File, "fInsideWorld", FacInfo[id][fInsideWorld]);
- INI_WriteInt(File, "fInsideInt", FacInfo[id][fInsideInt]);
- INI_WriteInt(File, "fMoney", FacInfo[id][fMoney]);
- INI_WriteInt(File, "fActive", FacInfo[id][fActive]);
- INI_WriteString(File, "fRank1", FacInfo[id][fRank1]);
- INI_WriteString(File, "fRank2", FacInfo[id][fRank2]);
- INI_WriteString(File, "fRank3", FacInfo[id][fRank3]);
- INI_WriteString(File, "fRank4", FacInfo[id][fRank4]);
- INI_WriteString(File, "fRank5", FacInfo[id][fRank5]);
- INI_WriteString(File, "fRank6", FacInfo[id][fRank6]);
- INI_Close(File);
- return 1;
- }
- forward loadfac_data(id, name[], value[]);
- public loadfac_data(id, name[], value[])
- {
- INI_String("fName", FacInfo[id][fName], 40);
- INI_String("fLeader", FacInfo[id][fLeader], 24);
- INI_String("fMOTD", FacInfo[id][fMOTD], 128);
- INI_Float("fHqX", FacInfo[id][fHqX]);
- INI_Float("fHqY", FacInfo[id][fHqY]);
- INI_Float("fHqZ", FacInfo[id][fHqZ]);
- INI_Float("fHqInX", FacInfo[id][fHqInX]);
- INI_Float("fHqInY", FacInfo[id][fHqInY]);
- INI_Float("fHqInZ", FacInfo[id][fHqInZ]);
- INI_Int("fWorld", FacInfo[id][fWorld]);
- INI_Int("fInt", FacInfo[id][fInt]);
- INI_Int("fInsideWorld", FacInfo[id][fInsideWorld]);
- INI_Int("fInsideInt", FacInfo[id][fInsideInt]);
- INI_Int("fMoney", FacInfo[id][fMoney]);
- INI_Int("fActive", FacInfo[id][fActive]);
- INI_String("fRank1", FacInfo[id][fRank1], 24);
- INI_String("fRank2", FacInfo[id][fRank2], 24);
- INI_String("fRank3", FacInfo[id][fRank3], 24);
- INI_String("fRank4", FacInfo[id][fRank4], 24);
- INI_String("fRank5", FacInfo[id][fRank5], 24);
- INI_String("fRank6", FacInfo[id][fRank6], 24);
- return 1;
- }
- YCMD:fac(playerid, params[])
- {
- new string[128], Fam = PlayerInfo[playerid][Faction];
- if(PlayerInfo[playerid][Faction] == 0) return SCM(playerid, COLOR_GREY, "You are not in a Faction");
- if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: (/fac)amily [Faction chat]");
- switch(PlayerInfo[playerid][FacRank])
- {
- case 1: format(string, sizeof(string), "(( %s %s: %s ))", FacInfo[Fam][fRank1], RemoveUnderScore(playerid), params);
- case 2: format(string, sizeof(string), "(( %s %s: %s ))", FacInfo[Fam][fRank2], RemoveUnderScore(playerid), params);
- case 3: format(string, sizeof(string), "(( %s %s: %s ))", FacInfo[Fam][fRank3], RemoveUnderScore(playerid), params);
- case 4: format(string, sizeof(string), "(( %s %s: %s ))", FacInfo[Fam][fRank4], RemoveUnderScore(playerid), params);
- case 5: format(string, sizeof(string), "(( %s %s: %s ))", FacInfo[Fam][fRank5], RemoveUnderScore(playerid), params);
- case 6: format(string, sizeof(string), "(( %s %s: %s ))", FacInfo[Fam][fRank6], RemoveUnderScore(playerid), params);
- }
- foreach(Player, i)
- {
- if(PlayerInfo[i][Faction] == Fam) SCM(i, COLOR_LIGHTBLUE, string);
- }
- return 1;
- }
- YCMD:editfaction(playerid, params[])
- {
- new editop[40], string[128], Fam, ID;
- if(PlayerInfo[playerid][FacLeader] == 0 && PlayerInfo[playerid][Admin] < 4) return SCM(playerid, COLOR_GREY, "You are not a Faction leader.");
- if(sscanf(params, "s[40]", editop)) return SCM(playerid, COLOR_GREY, "YCMD:/editfaction [option](Options: leader, name, motd, rank1, rank2, rank3, rank4, rank5, rank6)");
- if(strcmp(editop,"leader",true) == 0)
- {
- if(PlayerInfo[playerid][Admin] < 4) return SCM(playerid, COLOR_GREY, "You are not an admin, you cannot use this command");
- if(sscanf(params, "s[40]ui", editop , ID, Fam)) return SCM(playerid, COLOR_GREY, "YCMD:/editfaction leader [PLAYERID] [FactionID]");
- if(Fam < 1 || Fam > 5) return SCM(playerid, COLOR_GREY, "Families IDs are only 1-5.");
- PlayerInfo[ID][Faction] = Fam;
- print("shit got dis far");
- format(string, sizeof(string), "%s has been made leader of a Faction slot %i by %s", RemoveUnderScore(ID), Fam, RemoveUnderScore(playerid));
- SCM(playerid, COLOR_LIGHTRED, string);
- SCM(ID, COLOR_LIGHTRED, string);
- print("shit got dis far2");
- PlayerInfo[ID][FacRank] = 6;
- PlayerInfo[ID][FacLeader] = 1;
- PlayerInfo[ID][FamLeader] = 0;
- PlayerInfo[ID][Family] = 0;
- PlayerInfo[ID][FamRank] = 0;
- FacInfo[Fam][fLeader] = RemoveUnderScore(ID);
- print("shit got realfar");
- }
- if(strcmp(editop,"name",true) == 0)
- {
- new name[40];
- if(PlayerInfo[playerid][FacLeader] == 0) return SCM(playerid, COLOR_GREY, "You are not a Faction leader.");
- if(sscanf(params, "ss", editop, name)) return SCM(playerid, COLOR_GREY, "YCMD:/editfaction name [NEWNAME]");
- Fam = PlayerInfo[playerid][Faction];
- FacInfo[Fam][fName] = name;
- format(string, sizeof(string), "Faction ID %i, is now known as %s.", Fam, name);
- SendClientMessageToAll(COLOR_LIGHTRED, string);
- }
- if(strcmp(editop,"motd",true) == 0)
- {
- new name[128];
- if(PlayerInfo[playerid][FacLeader] == 0) return SCM(playerid, COLOR_GREY, "You are not a Faction leader.");
- if(sscanf(params, "ss", editop, name)) return SCM(playerid, COLOR_GREY, "YCMD:/editfaction motd [TEXT]");
- Fam = PlayerInfo[playerid][Faction];
- format(string,sizeof(string), "%s", name);
- FacInfo[Fam][fMOTD] = name;
- foreach(Player, i)
- {
- if(PlayerInfo[i][Faction] == Fam)
- {
- SCM(i, COLOR_LIGHTBLUE, "MOTD Changed, read it below:");
- SCM(i, COLOR_LIGHTBLUE, string);
- }
- }
- }
- if(strcmp(editop,"rank1",true) == 0)
- {
- if(PlayerInfo[playerid][FacLeader] == 0) return SCM(playerid, COLOR_GREY, "You are not a Faction leader.");
- new name[24];
- if(sscanf(params, "ss", editop, name)) return SCM(playerid, COLOR_GREY, "YCMD:/editfaction rank1 [RankName]");
- Fam = PlayerInfo[playerid][Faction];
- FacInfo[Fam][fRank1] = name;
- SendClientMessage(playerid, COLOR_LIGHTBLUE, "Rank name changed.");
- }
- if(strcmp(editop,"rank2",true) == 0)
- {
- if(PlayerInfo[playerid][FacLeader] == 0) return SCM(playerid, COLOR_GREY, "You are not a Faction leader.");
- new name[24];
- if(sscanf(params, "ss", editop, name)) return SCM(playerid, COLOR_GREY, "YCMD:/editfaction rank2 [RankName]");
- Fam = PlayerInfo[playerid][Faction];
- FacInfo[Fam][fRank2] = name;
- SendClientMessage(playerid, COLOR_LIGHTBLUE, "Rank name changed.");
- }
- if(strcmp(editop,"rank3",true) == 0)
- {
- if(PlayerInfo[playerid][FacLeader] == 0) return SCM(playerid, COLOR_GREY, "You are not a Faction leader.");
- new name[24];
- if(sscanf(params, "ss", editop, name)) return SCM(playerid, COLOR_GREY, "YCMD:/editfaction rank3 [RankName]");
- Fam = PlayerInfo[playerid][Faction];
- FacInfo[Fam][fRank3] = name;
- SendClientMessage(playerid, COLOR_LIGHTBLUE, "Rank name changed.");
- }
- if(strcmp(editop,"rank4",true) == 0)
- {
- if(PlayerInfo[playerid][FacLeader] == 0) return SCM(playerid, COLOR_GREY, "You are not a Faction leader.");
- new name[24];
- if(sscanf(params, "ss", editop, name)) return SCM(playerid, COLOR_GREY, "YCMD:/editfaction rank4 [RankName]");
- Fam = PlayerInfo[playerid][Faction];
- FacInfo[Fam][fRank4] = name;
- SendClientMessage(playerid, COLOR_LIGHTBLUE, "Rank name changed.");
- }
- if(strcmp(editop,"rank5",true) == 0)
- {
- if(PlayerInfo[playerid][FacLeader] == 0) return SCM(playerid, COLOR_GREY, "You are not a Faction leader.");
- new name[24];
- if(sscanf(params, "ss", editop, name)) return SCM(playerid, COLOR_GREY, "YCMD:/editfaction rank5 [RankName]");
- Fam = PlayerInfo[playerid][Faction];
- FacInfo[Fam][fRank5] = name;
- SendClientMessage(playerid, COLOR_LIGHTBLUE, "Rank name changed.");
- }
- if(strcmp(editop,"rank6",true) == 0)
- {
- if(PlayerInfo[playerid][FacLeader] == 0) return SCM(playerid, COLOR_GREY, "You are not a Faction leader.");
- new name[24];
- if(sscanf(params, "ss", editop, name)) return SCM(playerid, COLOR_GREY, "YCMD:/editfaction rank6 [RankName]");
- Fam = PlayerInfo[playerid][Faction];
- FacInfo[Fam][fRank6] = name;
- SendClientMessage(playerid, COLOR_LIGHTBLUE, "Rank name changed.");
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment