Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <dini>
- #include <sscanf2>
- #include <zcmd>
- #include <mSelection>
- #define MAX_GANGS 50 // cãte ganguri vrei.
- #define Public:%0(%1) \
- forward%0(%1); public%0(%1)
- new gpickup[MAX_GANGS];
- new gangs = 0;
- new arma1 = mS_INVALID_LISTID;
- new arma2 = mS_INVALID_LISTID;
- new arma3 = mS_INVALID_LISTID;
- new arma4 = mS_INVALID_LISTID;
- new arma5 = mS_INVALID_LISTID;
- new arma6 = mS_INVALID_LISTID;
- new GangInvite[MAX_PLAYERS];
- new GangInviteTime[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- LoadGangs();
- print("\n--------------------------------------");
- print(" Gang System by Gireada");
- print("--------------------------------------\n");
- arma1 = LoadModelSelectionMenu("arma1.txt");
- arma2 = LoadModelSelectionMenu("arma2.txt");
- arma3 = LoadModelSelectionMenu("arma3.txt");
- arma4 = LoadModelSelectionMenu("arma4.txt");
- arma5 = LoadModelSelectionMenu("arma5.txt");
- arma6 = LoadModelSelectionMenu("arma6.txt");
- SetTimer("SaveGangs", 1000, 1);
- SetTimer("SaveAccounts", 5000, 1);
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- enum
- {
- DIALOG_INVITE = 99,//ultimul id din GameMode | last id of dialog from GameMode
- DIALOG_SETTINGS,
- DIALOG_COLOR,
- DIALOG_STATS,
- }
- main()
- {
- print("\n----------------------------------");
- print(" Gang System by Gireada");
- print("----------------------------------\n");
- }
- enum PlayerData
- {
- GangID,
- GangRank,
- GangName[50],
- }
- new PlayerInfo[MAX_PLAYERS][PlayerData];
- enum GangData
- {
- ID,
- Name[50],
- Leader[MAX_PLAYER_NAME],
- Float:Spawnx,
- Float:Spawny,
- Float:Spawnz,
- Weapon1,
- Weapon2,
- Weapon3,
- Weapon4,
- Weapon5,
- Weapon6,
- Color[10],
- Interior,
- Virtual,
- Day,
- Month,
- Year,
- Kills,
- Deaths,
- Members,
- }
- new GangInfo[MAX_GANGS][GangData];
- stock PlayerName(playerid)
- {
- new nume[MAX_PLAYER_NAME];
- GetPlayerName(playerid, nume, sizeof(nume));
- return nume;
- }
- public OnPlayerConnect(playerid)
- {
- new file[MAX_PLAYER_NAME];
- format(file, sizeof(file), "GangPlayers/%s.ini",PlayerName(playerid));
- if(dini_Exists(file))
- {
- PlayerInfo[playerid][GangID] = dini_Int(file,"GangID");
- PlayerInfo[playerid][GangRank] = dini_Int(file,"GangRank");
- strmid(PlayerInfo[playerid][GangName], dini_Get(file,"GangName"), 0, strlen(dini_Get(file,"GangName")), 255);
- }
- else
- {
- dini_Create(file);
- dini_IntSet(file,"GangID",0);
- dini_IntSet(file,"GangRank",0);
- dini_Set(file,"GangName"," ");
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- forward SaveAccounts();
- public SaveAccounts()
- {
- new file[MAX_PLAYER_NAME];
- for(new i=0;i<=MAX_GANGS;i++)
- {
- if(IsPlayerConnected(i))
- {
- if(GangInviteTime[i] > 0) GangInviteTime[i]--;
- format(file, sizeof(file), "GangPlayers/%s.ini",PlayerName(i));
- dini_IntSet(file,"GangID",PlayerInfo[i][GangID]);
- dini_IntSet(file,"GangRank",PlayerInfo[i][GangRank]);
- dini_Set(file,"GangName",PlayerInfo[i][GangName]);
- }
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- new file[256];
- format(file, sizeof(file), "Gangs/%d.ini",PlayerInfo[playerid][GangID]);
- new gangid = PlayerInfo[playerid][GangID];
- if(gangid > 0)
- {
- if(!(dini_Exists(file)) || strcmp(PlayerInfo[playerid][GangName], GangInfo[gangid][Name], false, strlen(PlayerInfo[playerid][GangName])))
- {
- SendClientMessage(playerid, 0xFFFFFFFF , "The Gang has been abolished");
- PlayerInfo[playerid][GangID] = 0;
- PlayerInfo[playerid][GangRank] = 0;
- strmid(PlayerInfo[playerid][GangName], " ", 0, strlen(" "), 255);
- }
- else
- {
- GiveGangWeapon(playerid);
- }
- return 1;
- }
- return 1;
- }
- CMD:gangstats(playerid, params[])
- {
- if(PlayerInfo[playerid][GangID] == 0) return SendClientMessage(playerid, 0xFF0000AA, "You need to be in a gang to use this command.");
- new gangid = PlayerInfo[playerid][GangID],string[1024];
- new weapon1[32], weapon2[32], weapon3[32], weapon4[32], weapon5[32], weapon6[32], kills, death, members,day,month,year,leader[MAX_PLAYER_NAME],name[50];
- GetWeaponName(GangInfo[gangid][Weapon1],weapon1,sizeof(weapon1)); GetWeaponName(GangInfo[gangid][Weapon2],weapon2,sizeof(weapon2)); GetWeaponName(GangInfo[gangid][Weapon3],weapon3,sizeof(weapon3));
- GetWeaponName(GangInfo[gangid][Weapon4],weapon4,sizeof(weapon4)); GetWeaponName(GangInfo[gangid][Weapon5],weapon5,sizeof(weapon5)); GetWeaponName(GangInfo[gangid][Weapon6],weapon6,sizeof(weapon6));
- kills = GangInfo[gangid][Kills]; death = GangInfo[gangid][Deaths]; members = GangInfo[gangid][Members]; day = GangInfo[gangid][Day]; month = GangInfo[gangid][Month];
- year = GangInfo[gangid][Year]; format(leader, sizeof(leader), GangInfo[gangid][Leader]); format(name, sizeof(name), GangInfo[gangid][Name]);
- format(string, sizeof(string), "{FFFF00}%s{FFFFFF} Gang Stats\n\nGang Leader: %s\nGang Weapons:\n1.%s\n2.%s\n3.%s\n4.%s\n5.%s\n6.%s\nKills: %d\nDeaths: %d\nFounded in %d.%d.%d\
- \nMembers: %d\nRation: %d",name,leader,weapon1,weapon2,weapon3,weapon4,weapon5,weapon6,kills,death,day,month,year,members,kills-death);
- ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, "Gang Stats", string, "Accept", "");
- return 1;
- }
- CMD:desgang(playerid, params[])
- {
- new file[256],string[256];
- if(!(PlayerInfo[playerid][GangRank] > 5)) return SendClientMessage(playerid, 0xFF0000AA, "You need to be the Big Dog Gangstar to use this command.");
- new gangid = PlayerInfo[playerid][GangID];
- format(file, sizeof(file), "Gangs/%d.ini",gangid);
- dini_Remove(file);
- for(new i = 0; i<MAX_PLAYERS;i++)
- {
- if(IsPlayerConnected(playerid))
- {
- if(i != playerid)
- {
- if(PlayerInfo[i][GangID] == gangid)
- {
- PlayerInfo[i][GangID] = 0;
- format(PlayerInfo[i][GangName], 50, " ");
- PlayerInfo[i][GangRank] = 0;
- format(string, sizeof(string), "%s has disbanded gang.",PlayerName(playerid));
- SendClientMessage(i,0xFFFFFFFF, string);
- }
- }
- }
- }
- format(string, sizeof(string), "%s has disbanded gang.",PlayerName(playerid));
- SendClientMessage(playerid,0xFFFFFFFF, string);
- PlayerInfo[playerid][GangID] = 0;
- format(PlayerInfo[playerid][GangName], 50, " ");
- PlayerInfo[playerid][GangRank] = 0;
- return 1;
- }
- CMD:qgang(playerid, params[])
- {
- new string[256];
- if(PlayerInfo[playerid][GangID] == 0) return SendClientMessage(playerid, 0xFF0000AA, "You need to be in a gang to use this command.");
- if(PlayerInfo[playerid][GangRank] == 6) return SendClientMessage(playerid, 0xFF0000AA, "You are Big Dog Gangstar. If you want to quit gang use /desgang");
- new gangid = PlayerInfo[playerid][GangID];
- GangInfo[gangid][Members]--;
- format(string, sizeof(string), "%s has quit the gang.", PlayerName(playerid));
- SendGangMessage(PlayerInfo[playerid][GangID],string,-1);
- PlayerInfo[playerid][GangID] = 0;
- PlayerInfo[playerid][GangRank] = 0;
- format(PlayerInfo[playerid][GangName], 50, " ");
- return 1;
- }
- CMD:invite(playerid, params[])
- {
- new giveplayerid,string[256],caption[64];
- new gangid = PlayerInfo[playerid][GangID];
- if(unformat(params, "u", giveplayerid)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /invite <playerid/name>");
- if(!(PlayerInfo[playerid][GangRank] > 5)) return SendClientMessage(playerid, 0xFF0000AA, "You need to be the Big Dog Gangstar to use this command.");
- if(PlayerInfo[giveplayerid][GangID] > 0) return SendClientMessage(playerid, 0xFF0000AA, "Player is already in an another gang.");
- if(GangInviteTime[giveplayerid] > 0) return SendClientMessage(playerid, 0xFF0000AA, "That already have an invitation");
- if(giveplayerid == playerid) return SendClientMessage(playerid, 0xFF0000AA, "You can not invite you");
- GangInvite[playerid] = PlayerInfo[playerid][GangID];
- GangInviteTime[playerid] = 30;
- format(caption, sizeof(caption), "%s invitation",GangInfo[gangid][Name]);
- format(string, sizeof(string), "%s has invite you in the gang %s with:\n\n%d members\n%d kills\n%d deaths\n%d ration\n\nPress Accept or Cancel",PlayerName(playerid),\
- GangInfo[gangid][Name],GangInfo[gangid][Members], GangInfo[gangid][Kills], GangInfo[gangid][Deaths], GangInfo[gangid][Kills] - GangInfo[gangid][Deaths]);
- ShowPlayerDialog(giveplayerid, DIALOG_INVITE, DIALOG_STYLE_MSGBOX, caption, string, "Accept", "Cancel");
- return 1;
- }
- CMD:setrank(playerid, params[])
- {
- new string[256], giveplayerid, rank;
- if(unformat(params, "ui", giveplayerid,rank)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /setrank <playerid/name> <rank>(1-5)");
- if(!(IsPlayerConnected(giveplayerid))) return SendClientMessage(playerid, 0xFF0000AA, "Thet player is not connected.");
- if(!(PlayerInfo[playerid][GangID] == PlayerInfo[giveplayerid][GangID])) return SendClientMessage(playerid, 0xFF0000AA, "Thet player is not in your gang.");
- if(!(rank >= 1 && rank <=5)) return SendClientMessage(playerid, 0xFF0000AA, "Rank must be between 1 and 5.");
- if(!(PlayerInfo[playerid][GangRank] == 6)) return SendClientMessage(playerid, 0xFF0000AA, "You need to be the Big Dog Gangstar to use this command.");
- if(giveplayerid == playerid) return SendClientMessage(playerid, 0xFF0000AA, "You are Big Dog Gangstar no one can't change your rank.");
- PlayerInfo[giveplayerid][GangRank] = rank;
- format(string, sizeof(string), "Big Dog Gangstar %s has set your rank to %d",PlayerName(playerid),rank);
- SendClientMessage(giveplayerid, 0xFFFFFFFF, string);
- format(string, sizeof(string), "You set %s rank to %d",PlayerName(giveplayerid),rank);
- SendClientMessage(playerid, 0xFFFFFFFF, string);
- return 1;
- }
- CMD:eject(playerid, params[])
- {
- new giveplayerid,string[256];
- new gangid = PlayerInfo[playerid][GangID];
- if(unformat(params, "u", giveplayerid)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /eject <playerid/name>");
- if(!(PlayerInfo[playerid][GangRank] > 5)) return SendClientMessage(playerid, 0xFF0000AA, "You need to be the Big Dog Gangstar to use this command.");
- if(!(PlayerInfo[giveplayerid][GangID] == gangid)) return SendClientMessage(playerid, 0xFF0000AA, "Player is not in your gang.");
- if(giveplayerid == playerid) return SendClientMessage(playerid, 0xFF0000AA, "You can't eject your self");
- format(string, sizeof(string), "%s has eject %s from gang.",PlayerName(playerid), PlayerName(giveplayerid));
- SendGangMessage(gangid,string,-1);
- PlayerInfo[giveplayerid][GangRank] = 0;
- PlayerInfo[giveplayerid][GangID] = 0;
- GangInfo[gangid][Members]--;
- return 1;
- }
- CMD:setspawn(playerid, params[])
- {
- if(!(PlayerInfo[playerid][GangRank] > 5)) return SendClientMessage(playerid, 0xFF0000AA, "You need to be the Big Dog Gangstar to use this command.");
- new gangid = PlayerInfo[playerid][GangID],string[256];
- new Float:x,Float:y,Float:z;
- GetPlayerPos(playerid,x,y,z);
- GangInfo[gangid][Spawnx] = x; GangInfo[gangid][Spawny] = y; GangInfo[gangid][Spawnz] = z;
- format(string, sizeof(string), "%s has change the spawn.",PlayerName(playerid));
- SendGangMessage(gangid,string,-1);
- DestroyPickup(gpickup[gangid]);
- gpickup[gangid] = CreatePickup(1314, 1, x,y,z, -1);
- return 1;
- }
- CMD:gangchat(playerid, params[])
- {
- new string[500];
- if(unformat(params, "s[500]", string)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /gangchat(/gc) <text>");
- if(!(PlayerInfo[playerid][GangID] > 0)) return SendClientMessage(playerid, 0xFF0000AA, "You are not in a gang>");
- new gangid = PlayerInfo[playerid][GangID];
- SendGangMessage(gangid,string,playerid);
- return 1;
- }
- CMD:alertall(playerid, params[])
- {
- if(!(PlayerInfo[playerid][GangRank] > 5)) return SendClientMessage(playerid, 0xFF0000AA, "You need to be the Big Dog Gangstar to use this command.");
- new Float:x,Float:y,Float:z;
- GetPlayerPos(playerid,x,y,z);
- new interior = GetPlayerInterior(playerid);
- new virtualw = GetPlayerVirtualWorld(playerid);
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- if(IsPlayerConnected(i))
- {
- if(PlayerInfo[i][GangID] == PlayerInfo[playerid][GangID])
- {
- SetPlayerPos(i,x,y,z);
- SetPlayerInterior(i,interior);
- SetPlayerVirtualWorld(i,virtualw);
- GameTextForPlayer(playerid, "The Big Dog Gangstar teleport you", 2000, 6);
- }
- }
- }
- return 1;
- }
- CMD:gangweapon(playerid, params[])
- {
- new gangid = PlayerInfo[playerid][GangID];
- if(!(gangid > 0)) return SendClientMessage(playerid, 0xFF0000AA, "You need to be in a gang to use this commnad.");
- if(!(IsPlayerInRangeOfPoint(playerid, 3.5, GangInfo[gangid][Spawnx], GangInfo[gangid][Spawny], GangInfo[gangid][Spawnz]))) return SendClientMessage(playerid, 0xFF0000AA, "You need to be on the spawn.");
- GiveGangWeapon(playerid);
- return 1;
- }
- COMMAND:gc(playerid, params[])
- {
- return cmd_gangchat(playerid, params);
- }
- CMD:creategang(playerid, params[])
- {
- new GangName2[50],day,month,year,file[256],string[256];
- if(unformat(params, "s[50]", GangName2)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /creategang <name>(MAX 50)");
- if(PlayerInfo[playerid][GangID] > 0) return SendClientMessage(playerid, 0xFF0000AA, "You aleardy have a gang.");
- for(new i=1;i<=MAX_GANGS;i++)
- {
- format(file, sizeof(file), "Gangs/%i.ini",i);
- if(!dini_Exists(file))
- {
- getdate(year, month, day);
- CreateGang(i,GangName2, PlayerName(playerid), day, month, year, "0xFFFFFFFF");
- PlayerInfo[playerid][GangID] = i;
- PlayerInfo[playerid][GangRank] = 6;
- format(PlayerInfo[playerid][GangName], 50, GangName2);break;
- }
- }
- format(string, sizeof(string), "You have create gang %s",GangName2);
- SendClientMessage(playerid, 0xFF0000AA, string);
- return 1;
- }
- CMD:gangsetting(playerid, params[])
- {
- if(!(PlayerInfo[playerid][GangRank] > 5)) return SendClientMessage(playerid, 0xFF0000AA, "You need to be the Big Dog Gangstar to use this command.");
- ShowPlayerDialog(playerid, DIALOG_SETTINGS, DIALOG_STYLE_LIST, "Gang Setting", "Weapons\nColor", "Accept", "Cancel");
- return 1;
- }
- forward SendGangMessage(gangid,const msj[],playerid);
- public SendGangMessage(gangid,const msj[],playerid)
- {
- new string[500];
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- if(IsPlayerConnected(i))
- {
- if(PlayerInfo[i][GangID] == gangid)
- {
- switch(playerid)
- {
- case -1:
- {
- SendClientMessage(i, 0xFF0000AA, msj);
- }
- default:
- {
- switch(PlayerInfo[playerid][GangRank])
- {
- case 1: format(string, sizeof(string), "1*Little Gangsta %s: %s",PlayerName(playerid), msj);
- case 2: format(string, sizeof(string), "2*Gangsta %s: %s",PlayerName(playerid), msj);
- case 3: format(string, sizeof(string), "3*Trouble Gangsta %s: %s",PlayerName(playerid), msj);
- case 4: format(string, sizeof(string), "4*First Gangsta %s: %s",PlayerName(playerid), msj);
- case 5: format(string, sizeof(string), "5*Big Gangsta %s: %s",PlayerName(playerid), msj);
- case 6: format(string, sizeof(string), "6*Big Dog Gangsta %s: %s",PlayerName(playerid), msj);
- }
- SendClientMessage(i, 0xFF0000AA, string);
- }
- }
- }
- }
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- new string[256];
- new gangid = PlayerInfo[playerid][GangID];
- if(response)
- {
- switch(dialogid)
- {
- case DIALOG_INVITE:
- {
- PlayerInfo[playerid][GangID] = GangInvite[playerid];
- GangInviteTime[playerid] = 0;
- GangInvite[playerid] = 0;
- GangInfo[gangid][Members]++;
- format(string, sizeof(string), "[ %s ][ %d ] has enjoy in the gang.",PlayerName(playerid),playerid);
- SendGangMessage(PlayerInfo[playerid][GangID], string,-1);
- }
- case DIALOG_SETTINGS:
- {
- switch(listitem)
- {
- case 0: ShowModelSelectionMenu(playerid, arma1, "Weapon1");
- case 1: ShowPlayerDialog(playerid, DIALOG_COLOR, DIALOG_STYLE_LIST, "Gang Setting", "Red\nBlue\nYellow\nGreen\nWhite\nPurple", "Accept", "Cancel");
- }
- }
- case DIALOG_COLOR:
- {
- switch(listitem)
- {
- case 0: format(GangInfo[gangid][Color], 10, "0xF90505AA");
- case 1: format(GangInfo[gangid][Color], 10, "0x0026FFAA");
- case 2: format(GangInfo[gangid][Color], 10, "0xE6FB00AA");
- case 3: format(GangInfo[gangid][Color], 10, "0x00FF04AA");
- case 4: format(GangInfo[gangid][Color], 10, "0xFFFFFFAA");
- case 5: format(GangInfo[gangid][Color], 10, "0xDD00FFAA");
- }
- }
- }
- }
- if(!response)
- {
- switch(dialogid)
- {
- case DIALOG_INVITE:
- {
- format(string, sizeof(string), "[ %s ][ %d ] has refuze the invitation.",PlayerName(playerid),playerid);
- SendGangMessage(GangInvite[playerid],string, -1);
- GangInviteTime[playerid] = 0;
- GangInvite[playerid] = 0;
- }
- }
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(reason > 47)
- {
- new gangid = PlayerInfo[playerid][GangID];
- new gangid2 = PlayerInfo[killerid][GangID];
- GangInfo[gangid][Deaths]++;
- GangInfo[gangid2][Kills]++;
- }
- return 1;
- }
- forward LoadGangs();
- public LoadGangs()
- {
- new file[256];
- for(new i=1;i<=MAX_GANGS;i++)
- {
- format(file, sizeof(file), "Gangs/%i.ini",i);
- if(dini_Exists(file))
- {
- GangInfo[i][ID] = dini_Int(file,"ID");
- strmid(GangInfo[i][Name], dini_Get(file,"Name"), 0, strlen(dini_Get(file,"Name")), 255);
- strmid(GangInfo[i][Leader], dini_Get(file,"Leader"), 0, strlen(dini_Get(file,"Leader")), 255);
- GangInfo[i][Spawnx] = dini_Float(file,"Spawnx");
- GangInfo[i][Spawnx] = dini_Float(file,"Spawny");
- GangInfo[i][Spawnx] = dini_Float(file,"Spawnz");
- GangInfo[i][Weapon1] = dini_Int(file,"Weapon1");
- GangInfo[i][Weapon2] = dini_Int(file,"Weapon2");
- GangInfo[i][Weapon3] = dini_Int(file,"Weapon3");
- GangInfo[i][Weapon4] = dini_Int(file,"Weapon4");
- GangInfo[i][Weapon5] = dini_Int(file,"Weapon5");
- GangInfo[i][Weapon6] = dini_Int(file,"Weapon6");
- strmid(GangInfo[i][Color], dini_Get(file,"Color"), 0, strlen(dini_Get(file,"Color")), 255);
- GangInfo[i][Interior] = dini_Int(file,"Interior");
- GangInfo[i][Virtual] = dini_Int(file,"Virtual");
- GangInfo[i][Day] = dini_Int(file,"Day");
- GangInfo[i][Month] = dini_Int(file,"Month");
- GangInfo[i][Year] = dini_Int(file,"Year");
- GangInfo[i][Kills] = dini_Int(file,"Kills");
- GangInfo[i][Deaths] = dini_Int(file,"Deaths");
- GangInfo[i][Members] = dini_Int(file,"Members");
- gangs++;
- }
- }
- return 1;
- }
- forward CreateGang(i,const Nume[], const gLeader[], Zi, Luna, An, const color[]);
- public CreateGang(i,const Nume[], const gLeader[], Zi, Luna, An, const color[])
- {
- new file[256];
- format(file, sizeof(file), "Gangs/%i.ini",i);
- dini_Create(file);
- GangInfo[i][ID] = i;
- format(GangInfo[i][Name], 50, Nume);
- format(GangInfo[i][Leader], 50, gLeader);
- GangInfo[i][Spawnx] = 0.0000; GangInfo[i][Spawny] = 0.0000; GangInfo[i][Spawnz] = 0.0000;
- GangInfo[i][Weapon1] = 0; GangInfo[i][Weapon2] = 0; GangInfo[i][Weapon3] = 0;
- GangInfo[i][Weapon4] = 0; GangInfo[i][Weapon5] = 0; GangInfo[i][Weapon6] = 0;
- format(GangInfo[i][Color], 10, color);
- GangInfo[i][Interior] = 0; GangInfo[i][Virtual] = 0; GangInfo[i][Day] = Zi;
- GangInfo[i][Month] = Luna; GangInfo[i][Year] = An; GangInfo[i][Kills] = 0; GangInfo[i][Members] = 0;
- return 1;
- }
- forward SaveGangs();
- public SaveGangs()
- {
- new file[256];
- for(new i=1;i<=MAX_GANGS;i++)
- {
- format(file,sizeof(file), "Gangs/%i.ini",i);
- if(dini_Exists(file))
- {
- dini_IntSet(file,"ID",GangInfo[i][ID]);
- dini_Set(file,"Name", GangInfo[i][Name]);
- dini_Set(file,"Leader", GangInfo[i][Leader]);
- dini_FloatSet(file,"Spawnx",GangInfo[i][Spawnx]);
- dini_FloatSet(file,"Spawny",GangInfo[i][Spawny]);
- dini_FloatSet(file,"Spawnz",GangInfo[i][Spawnz]);
- dini_IntSet(file,"Weapon1",GangInfo[i][Weapon1]);
- dini_IntSet(file,"Weapon2",GangInfo[i][Weapon2]);
- dini_IntSet(file,"Weapon3",GangInfo[i][Weapon3]);
- dini_IntSet(file,"Weapon4",GangInfo[i][Weapon4]);
- dini_IntSet(file,"Weapon5",GangInfo[i][Weapon5]);
- dini_IntSet(file,"Weapon6",GangInfo[i][Weapon6]);
- dini_Set(file,"Color",GangInfo[i][Color]);
- dini_IntSet(file,"Interior",GangInfo[i][Interior]);
- dini_IntSet(file,"Virtual",GangInfo[i][Virtual]);
- dini_IntSet(file,"Day",GangInfo[i][Day]);
- dini_IntSet(file,"Month",GangInfo[i][Month]);
- dini_IntSet(file,"Year",GangInfo[i][Year]);
- dini_IntSet(file,"Kills",GangInfo[i][Kills]);
- dini_IntSet(file,"Deaths",GangInfo[i][Deaths]);
- dini_IntSet(file,"Members",GangInfo[i][Members]);
- }
- }
- return 1;
- }
- public OnPlayerModelSelection(playerid, response, listid, modelid)
- {
- new gangid = PlayerInfo[playerid][GangID];
- if(listid == arma1)
- {
- if(response)
- {
- switch(modelid)
- {
- case 333: GangInfo[gangid][Weapon1] = 2; // Golf Club
- case 334: GangInfo[gangid][Weapon1] = 3;// Nightstick
- case 335: GangInfo[gangid][Weapon1] = 4;// Knife
- case 336: GangInfo[gangid][Weapon1] = 5;// Baseball Bat
- case 338: GangInfo[gangid][Weapon1] = 7;// Pool Cue
- case 339: GangInfo[gangid][Weapon1] = 8;// Katana
- case 341: GangInfo[gangid][Weapon1] = 9;// Chainsaw
- }
- ShowModelSelectionMenu(playerid, arma2, "Weapon2");
- }
- else SendClientMessage(playerid, 0xFF0000FF, "Canceled weapons selection");
- return 1;
- }
- if(listid == arma2)
- {
- if(response)
- {
- switch(modelid)
- {
- case 346: GangInfo[gangid][Weapon2] = 22;// 9mm
- case 347: GangInfo[gangid][Weapon2] = 23;// Silenced 9mm
- case 348: GangInfo[gangid][Weapon2] = 24;// Desert Eagle
- }
- ShowModelSelectionMenu(playerid, arma3, "Weapon3");
- }
- else SendClientMessage(playerid, 0xFF0000FF, "Canceled weapon selection");
- return 1;
- }
- if(listid == arma3)
- {
- if(response)
- {
- switch(modelid)
- {
- case 349: GangInfo[gangid][Weapon3] = 25;// Shotgun
- case 350: GangInfo[gangid][Weapon3] = 26;// Sawnoff
- case 351: GangInfo[gangid][Weapon3] = 27;// Combat Shotgun
- }
- ShowModelSelectionMenu(playerid, arma4, "Weapon4");
- }
- else SendClientMessage(playerid, 0xFF0000FF, "Canceled weapon selection");
- return 1;
- }
- if(listid == arma4)
- {
- if(response)
- {
- switch(modelid)
- {
- case 352: GangInfo[gangid][Weapon4] = 28;// Micro SMG/Uzi
- case 353: GangInfo[gangid][Weapon4] = 29;// MP5
- }
- ShowModelSelectionMenu(playerid, arma5, "Weapon5");
- }
- else SendClientMessage(playerid, 0xFF0000FF, "Canceled weapons selection");
- return 1;
- }
- if(listid == arma5)
- {
- if(response)
- {
- switch(modelid)
- {
- case 355: GangInfo[gangid][Weapon5] = 30;
- case 356: GangInfo[gangid][Weapon5] = 31;
- }
- ShowModelSelectionMenu(playerid, arma6, "Weapon6");
- }
- else SendClientMessage(playerid, 0xFF0000FF, "Canceled weapon selection");
- return 1;
- }
- if(listid == arma6)
- {
- if(response)
- {
- switch(modelid)
- {
- case 357: GangInfo[gangid][Weapon6] = 33;// Country Rifle
- case 358: GangInfo[gangid][Weapon6] = 34;// Sniper Rifle
- }
- }
- else SendClientMessage(playerid, 0xFF0000FF, "Canceled skin selection");
- return 1;
- }
- return 1;
- }
- forward GangExist(gangid);
- public GangExist(gangid)
- {
- new file[256];
- format(file, sizeof(file), "Gangs/%i.ini",gangid);
- if(dini_Exists(file))
- return 1;
- else
- return 0;
- }
- forward GiveGangWeapon(playerid);
- public GiveGangWeapon(playerid)
- {
- new gangid = PlayerInfo[playerid][GangID];
- if(!(GangInfo[gangid][Weapon1] == 0)) GivePlayerWeapon(playerid, GangInfo[gangid][Weapon1], 1);
- if(!(GangInfo[gangid][Weapon2] == 0)) GivePlayerWeapon(playerid, GangInfo[gangid][Weapon2], 500);
- if(!(GangInfo[gangid][Weapon3] == 0)) GivePlayerWeapon(playerid, GangInfo[gangid][Weapon3], 500);
- if(!(GangInfo[gangid][Weapon4] == 0)) GivePlayerWeapon(playerid, GangInfo[gangid][Weapon4], 500);
- if(!(GangInfo[gangid][Weapon5] == 0)) GivePlayerWeapon(playerid, GangInfo[gangid][Weapon5], 500);
- if(!(GangInfo[gangid][Weapon6] == 0)) GivePlayerWeapon(playerid, GangInfo[gangid][Weapon6], 500);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement