Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // FILTERSCRIPT //
- #define fs
- //============ INCLUDES ===========//
- #include <a_samp>
- #include <dini>
- //================================//
- //========== DIALOGID DEFINITIONS ==========//
- #define DIALOGID_GANGCREATE 100
- #define DIALOGID_GANGCREATE1 101
- #define DIALOGID_GANGCREATE2 102
- #define DIALOGID_GANGCREATE3 103
- #define DIALOGID_GANGCREATE4 104
- #define DIALOGID_GANGCREATE5 105
- #define DIALOGID_STATS 106
- #define DIALOGID_SKINCHANGE 107
- #define DIALOGID_WEAPONCHANGE 108
- //=========================================//
- //======= CONFIGS =======//
- #define MAX_GANGS 1000 // Change it to your own
- #define GANG_CHASH 500000 // Change it to your own
- //======================//
- //======= COLORS =======//
- #define COLOR_ORANGE2 0xFF8000FF
- #define COLOR_DBLUE2 0x2641FEAA
- #define COLOR_RED 0xAA333300
- #define COLOR_LIGHTRED 0xFF634700
- #define COLOR_DARKRED 0x9A000000
- #define COLOR_BLUE 0x0000FF00
- #define COLOR_LIGHTBLUE 0x33CCFF00
- #define COLOR_DARKBLUE 0x00009A00
- #define COLOR_WHITE 0xFFFFFF00
- #define COLOR_GREEN 0x33AA3300
- #define COLOR_LIGHTGREEN 0x9ACD3200
- #define COLOR_DARKGREEN 0x40008000
- #define COLOR_YELLOW 0xFFFF0000
- #define COLOR_YELLOW2 0xF5DEB300
- #define COLOR_GREY 0xAFAFAF00
- #define COLOR_BROWN 0x99330000
- #define COLOR_ORANGE 0xFF993300
- #define COLOR_MAGENTA 0xFF00FF00
- #define COLOR_PURPLE 0xC2A2DA00
- #define COLOR_DBLUE 0x8D8DFF00
- #define COLOR_LAWENFORCE 0x8D8DFF00
- #define COLOR_LAWENFORCERADAR 0x8D8DFFAA
- #define COLOR_DARKPURPLE 0xD900D300
- #define COLOR_BLACK 0x02020200
- #define COLOR_CYAN 0x99FFFF00
- #define COLOR_TAN 0xFFFFCC00
- #define COLOR_PINK 0xFF66FF00
- #define COLOR_KHAKI 0x99990000
- #define COLOR_LIME 0x99FF0000
- #define COLOR_TURQ 0x00A3C000
- #define COLOR_SYSTEM 0xEFEFF700
- #define COLOR_GRAD1 0xB4B5B700
- #define COLOR_GRAD2 0xBFC0C200
- #define COLOR_GRAD3 0xCBCCCE00
- #define COLOR_GRAD4 0xD8D8D800
- #define COLOR_GRAD5 0xE3E3E300
- #define COLOR_GRAD6 0xF0F0F0FF
- #define COLOR_FADE1 0xE6E6E600
- #define COLOR_FADE2 0xC8C8C800
- #define COLOR_FADE3 0xAAAAAA00
- #define COLOR_FADE4 0x8C8C8C00
- #define COLOR_FADE5 0x6E6E6E00
- #define GELB 0xFF828200
- #define ROT 0xFF0000FF
- #define GREEN 0x00CC00FF
- #define WHITE 0xFFFFFFFF
- //====================//
- //=========== INTEGERS =============//
- enum gInfo
- {
- Name[128],
- ID,
- Float:Spawn_X,
- Float:Spawn_Y,
- Float:Spawn_Z,
- Float:Spawn_A,
- Spawn_Interior,
- Spawn_VirtualWorld,
- Gang_Cash,
- Gang_Skin,
- Gang_Weapon,
- Gang_Kills,
- Gang_Deaths,
- Gang_Rank1[32],
- Gang_Rank2[32],
- Gang_Rank3[32],
- Gang_Rank4[32],
- Gang_Rank5[32],
- Gang_Rank6[32],
- Gang_House,
- }
- new GangInfo[MAX_GANGS][gInfo];
- enum pInfo
- {
- gang_member,
- gang_leader,
- gang_rank
- }
- new fileZ[256];
- new assign[MAX_PLAYERS];
- new PlayerInfo[MAX_PLAYERS][pInfo];
- //==================================//
- //=========== FORWARDS ===========//
- forward OnGangLogin(playerid);
- forward LoadData();
- //===============================//
- //============= FUNCTION'S AND CALLBACK'S =============//
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Gang System");
- print("--------------------------------------\n");
- LoadData();
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n--------------------------------------");
- print(" Gang System");
- print("--------------------------------------\n");
- return 1;
- }
- public LoadData()
- {
- for(new count = 20;count<MAX_GANGS;count++)
- {
- new Load[256];
- format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
- if(dini_Exists(fileZ))
- {
- Load = dini_Get(fileZ,"Name");
- strmid(GangInfo[count][Name],Load,0,256,256);
- Load = dini_Get(fileZ,"ID");
- GangInfo[count][ID] = strval(Load);
- Load = dini_Get(fileZ,"Spawn_X");
- GangInfo[count][Spawn_X] = strval(Load);
- Load = dini_Get(fileZ,"Spawn_Y");
- GangInfo[count][Spawn_Y] = strval(Load);
- Load = dini_Get(fileZ,"Spawn_Z");
- GangInfo[count][Spawn_Z] = strval(Load);
- Load = dini_Get(fileZ,"Spawn_A");
- GangInfo[count][Spawn_A] = strval(Load);
- Load = dini_Get(fileZ,"Spawn_Interior");
- GangInfo[count][Spawn_Interior] = strval(Load);
- Load = dini_Get(fileZ,"Spawn_VirtualWorld");
- GangInfo[count][Spawn_VirtualWorld] = strval(Load);
- Load = dini_Get(fileZ,"Gang_Cash");
- GangInfo[count][Gang_Cash] = strval(Load);
- Load = dini_Get(fileZ,"Gang_Skin");
- GangInfo[count][Gang_Skin] = strval(Load);
- Load = dini_Get(fileZ,"Gang_Weapon");
- GangInfo[count][Gang_Weapon] = strval(Load);
- Load = dini_Get(fileZ,"Gang_Kills");
- GangInfo[count][Gang_Kills] = strval(Load);
- Load = dini_Get(fileZ,"Gang_Deaths");
- GangInfo[count][Gang_Deaths] = strval(Load);
- format(fileZ, sizeof(fileZ),"Gang : ID = %d | Name = %s Loaded.",count,GangInfo[count][Name]);
- printf("%s", fileZ);
- }
- }
- }
- public OnPlayerConnect(playerid)
- {
- format(fileZ, sizeof(fileZ), "Gangs/Players/%s.ini",Names(playerid));
- if(dini_Exists(fileZ)){OnGangLogin(playerid);}
- else{
- new File: hFile = fopen(fileZ, io_write);
- if (hFile)
- {
- new var[32];
- format(var, 32, "gang_member=%d\n", PlayerInfo[playerid][gang_member]);fwrite(hFile, var);
- format(var, 32, "gang_leader=%d\n",PlayerInfo[playerid][gang_leader]);fwrite(hFile, var);
- format(var, 32, "gang_rank=%d\n",PlayerInfo[playerid][gang_rank]);fwrite(hFile, var);
- }
- fclose(hFile);
- OnGangLogin(playerid);
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- format(fileZ, sizeof(fileZ), "Gangs/Players/%s.ini", Names(playerid));
- new File: hFile = fopen(fileZ, io_write);
- if (hFile)
- {
- new var[32];
- format(var, 32, "gang_member=%d\n", PlayerInfo[playerid][gang_member]);fwrite(hFile, var);
- format(var, 32, "gang_leader=%d\n",PlayerInfo[playerid][gang_leader]);fwrite(hFile, var);
- format(var, 32, "gang_rank=%d\n",PlayerInfo[playerid][gang_rank]);fwrite(hFile, var);
- }
- fclose(hFile);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- for(new count = 20;count<MAX_GANGS;count++)
- {
- format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
- if(dini_Exists(fileZ))
- {
- if(PlayerInfo[playerid][gang_member] == GangInfo[count][ID])
- {
- GivePlayerWeapon(playerid, GangInfo[count][Gang_Weapon], 999999);
- SetPlayerInterior(playerid,GangInfo[count][Spawn_Interior]);
- SetPlayerVirtualWorld(playerid,GangInfo[count][Spawn_VirtualWorld]);
- SetPlayerPos(playerid,GangInfo[count][Spawn_X],GangInfo[count][Spawn_Y],GangInfo[count][Spawn_Z]);
- SetPlayerSkin(playerid, GangInfo[count][Gang_Skin]);
- }
- }
- break;
- }
- return 1;
- }
- public OnGangLogin(playerid)
- {
- if(IsPlayerNPC(playerid)) return 1;
- format(fileZ, sizeof(fileZ), "Gangs/Players/%s.ini", Names(playerid));
- new File: UserFile = fopen(fileZ, io_read);
- if ( UserFile )
- {
- new key[ 256 ] , val[ 256 ];
- new Data[ 256 ];
- while ( fread( UserFile , Data , sizeof( Data ) ) )
- {
- key = ini_GetKey( Data );
- if( strcmp( key , "gang_member" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][gang_member] = strval( val ); }
- if( strcmp( key , "gang_leader" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][gang_leader] = strval( val ); }
- if( strcmp( key , "gang_rank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][gang_rank] = strval( val ); }
- }
- fclose(UserFile);
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- GangInfo[killerid][Gang_Kills] ++;
- GangInfo[playerid][Gang_Deaths] ++;
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- if(IsPlayerConnected(playerid))
- {
- if(text[0] == '!')
- {
- SendClientMessage(playerid, 0xAA0000AA, "Tè èçïðàòè îòáîðíî ñúîáùåíèå");
- new name[24], string[128];
- GetPlayerName(playerid, name, 24);
- format(string, sizeof(string), "[Oòáîðåí ÷àò]%s: %s", name, text[1]);
- printf("%s", string);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(PlayerInfo[i][gang_member] || PlayerInfo[i][gang_leader] == PlayerInfo[playerid][gang_member] || PlayerInfo[playerid][gang_leader])
- SendClientMessage(i, GetPlayerColor(playerid), string);
- }
- }
- return 0;
- }
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[256];
- new tmp[256];
- new idx;
- cmd = strtok(cmdtext, idx);
- if (strcmp(cmd, "/gang", true) ==0 )
- {
- new showstring[256];
- format(showstring,sizeof(showstring),"Ñúçäàé îòáîð\nÑìåíè îòáîð");
- ShowPlayerDialog(playerid, DIALOGID_GANGCREATE, DIALOG_STYLE_LIST, "Gang-Display",showstring, "ACCEPT", "EXIT");
- return 1;
- }
- if (strcmp(cmd, "/ganghelp", true) ==0 )
- {
- SendClientMessage(playerid, COLOR_RED, "Ãàíã ñèñòåìà.");
- SendClientMessage(playerid, COLOR_RED, "Kîìàíäè:");
- SendClientMessage(playerid, COLOR_RED, "------------");
- SendClientMessage(playerid, COLOR_RED, "/gang | /ganghelp | /gangs | /invite | /kick |");
- SendClientMessage(playerid, COLOR_RED, "/promote | /denote | /gstats |");
- return 1;
- }
- if (strcmp(cmd, "/caca", true) ==0 )
- {
- SendClientMessage(playerid, COLOR_RED, "CREDITS:");
- SendClientMessage(playerid, COLOR_RED, "---------");
- SendClientMessage(playerid, COLOR_RED, "WackoX || For Fixing /gangs");
- SendClientMessage(playerid, COLOR_RED, "DarCoBlue || For making dini");
- SendClientMessage(playerid, COLOR_RED, "Crime Life Team || For making the half script");
- SendClientMessage(playerid, COLOR_RED, "DogZone || For the idea and some script help");
- return 1;
- }
- if(!strcmp(cmd, "/gangs", true))
- {
- new str5[128];
- SendClientMessage(playerid, COLOR_RED, "Íàëè÷íè áàíäè:");
- for(new count; count <MAX_GANGS; count++)
- {
- if(GangInfo[count][ID] || GangInfo[count][Name])
- {
- format(str5, sizeof(str5), "%s", GangInfo[count][Name]);
- SendClientMessage(playerid, COLOR_RED, str5);
- }
- }
- return 1;
- }
- if (strcmp(cmd, "/invite", true) ==0 )
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp))return SendClientMessage(playerid, COLOR_GRAD1, "Íàïèøè: /invite [Nick/ID]");
- new inviteid = strval(tmp);
- if(inviteid == playerid)return SendClientMessage(playerid, COLOR_RED, "Tè íå ìîæåø äà ïîêàíèø òîçè ÷îâåê");
- else if(PlayerInfo[playerid][gang_member] != 0 || PlayerInfo[playerid][gang_leader] != 0)SendClientMessage(playerid, COLOR_GRAD1, "Player is already in other gang.");
- else{
- for(new count = 20;count<MAX_GANGS;count++){
- format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
- if(dini_Exists(fileZ)){
- if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID]){
- PlayerInfo[playerid][gang_member] = PlayerInfo[playerid][gang_member];
- format(fileZ,sizeof(fileZ)," %s(%d) òå ïîêàíè äà âëåçåø â îòáîð: %s(%d) ",Names(playerid),playerid,GangInfo[count][Name],GangInfo[count][ID]);
- SendClientMessage(playerid, COLOR_RED, fileZ);
- SendClientMessage(playerid, COLOR_RED, "Òè ïîêàíè èãðà÷à äà âëåçå â òâîÿ îòáîð");}}}}
- return 1;
- }
- if (strcmp(cmd, "/kick", true) ==0 )
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp))return SendClientMessage(playerid, COLOR_GRAD1, "Íàïèøè: /kick [PartofName/ID]");
- new kickid = strval(tmp);
- if(kickid == playerid)return SendClientMessage(playerid, ROT, "Òè íå ìîæåø äà ñå èçãîíèø ñàì");
- else if(PlayerInfo[playerid][gang_member] != PlayerInfo[playerid][gang_leader])SendClientMessage(playerid, COLOR_GRAD1, "Òîçè ÷îâåê íå å îò òâîÿ îòáîð.");
- else if(PlayerInfo[playerid][gang_leader] == 0)SendClientMessage(playerid, COLOR_GRAD1, "Òè íå ñè ëèäåð.");
- else{
- for(new count = 20;count<MAX_GANGS;count++){
- format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
- if(dini_Exists(fileZ)){
- if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID]){
- PlayerInfo[playerid][gang_member] = 0;
- format(fileZ,sizeof(fileZ)," %s(%d) áåùå èçãîíåí îò îòáîðà: %s(%d) ",Names(playerid),playerid,GangInfo[count][Name],GangInfo[count][ID]);
- SendClientMessage(playerid, COLOR_RED, fileZ);
- SendClientMessage(playerid, COLOR_RED, "Òè ñè ïðåìàõíàò îò îòáîðà.");}}}}
- return 1;
- }
- if (strcmp(cmd, "/promote", true) ==0 )
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp))return SendClientMessage(playerid, COLOR_GRAD1, "Íàïèøè: /promote [playerid]");
- new promoteid = strval(tmp);
- if(promoteid == playerid)return SendClientMessage(playerid, ROT, "Íå ìîæåø äà ñè âäèãíåø ñâîÿ ðàíê");
- else if(PlayerInfo[playerid][gang_member] != PlayerInfo[playerid][gang_leader])SendClientMessage(playerid, COLOR_GRAD1, "Èãðà÷à òðÿáâà äà å îò òâîÿ îòáîð");
- else if(PlayerInfo[playerid][gang_leader] == 0)SendClientMessage(playerid, COLOR_GRAD1, "Òè íå ñè ëèäåð.");
- else{
- for(new count = 20;count<MAX_GANGS;count++){
- format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
- if(dini_Exists(fileZ)){
- if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID]){
- if(PlayerInfo[playerid][gang_rank] == 6)return SendClientMessage(playerid, COLOR_RED, "Player already got highest Rank");
- PlayerInfo[playerid][gang_rank] += 1;
- if(PlayerInfo[playerid][gang_rank] == 1){format(fileZ,sizeof(fileZ)," %s(%d) òè äàäå ðàíê %s(%d) ",Names(playerid),playerid,GangInfo[count][Gang_Rank1],PlayerInfo[playerid][gang_rank]);}
- if(PlayerInfo[playerid][gang_rank] == 2){format(fileZ,sizeof(fileZ)," %s(%d) òè äàäå ðàíê %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank2],PlayerInfo[playerid][gang_rank]);}
- if(PlayerInfo[playerid][gang_rank] == 3){format(fileZ,sizeof(fileZ)," %s(%d) òè äàäå ðàíê %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank3],PlayerInfo[playerid][gang_rank]);}
- if(PlayerInfo[playerid][gang_rank] == 4){format(fileZ,sizeof(fileZ)," %s(%d) òè äàäå ðàíê %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank4],PlayerInfo[playerid][gang_rank]);}
- if(PlayerInfo[playerid][gang_rank] == 5){format(fileZ,sizeof(fileZ)," %s(%d) òè äàäå ðàíê %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank5],PlayerInfo[playerid][gang_rank]);}
- if(PlayerInfo[playerid][gang_rank] == 6){format(fileZ,sizeof(fileZ)," %s(%d) òè äàäå ðàíê %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank6],PlayerInfo[playerid][gang_rank]);}
- SendClientMessage(playerid, COLOR_RED, fileZ);
- SendClientMessage(playerid, COLOR_RED, "Òè âäèãíà ëåâåëà íà èãðà÷à");}}}}
- return 1;
- }
- if (strcmp(cmd, "/denote", true) ==0 )
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp))return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /denote [playerid]");
- new denoteid = strval(tmp);
- if(denoteid == playerid)return SendClientMessage(playerid, ROT, "Íå ìîæåø äà ñè ïðåìàõíåø ðàíêà");
- else if(PlayerInfo[playerid][gang_member] != PlayerInfo[playerid][gang_leader])SendClientMessage(playerid, COLOR_GRAD1, "Èãðà÷à òðÿáâà äà å îò òâîÿ îòáîð.");
- else if(PlayerInfo[playerid][gang_leader] == 0)SendClientMessage(playerid, COLOR_GRAD1, "Òè íå ñè àäìèí.");
- else{
- for(new count = 20;count<MAX_GANGS;count++){
- format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
- if(dini_Exists(fileZ)){
- if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID]){
- if(PlayerInfo[playerid][gang_rank] == 1)return SendClientMessage(playerid, ROT, "Ñâàëåí ðàíê íà èãðà÷.");
- PlayerInfo[playerid][gang_rank] -= 1;
- if(PlayerInfo[playerid][gang_rank] == 1){format(fileZ,sizeof(fileZ)," %s(%d) òè ñìúêíà ðàíêà íà %s(%d) ",Names(playerid),playerid,GangInfo[count][Gang_Rank1],PlayerInfo[playerid][gang_rank]);}
- if(PlayerInfo[playerid][gang_rank] == 2){format(fileZ,sizeof(fileZ)," %s(%d) òè ñìúêíà ðàíêà íà %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank2],PlayerInfo[playerid][gang_rank]);}
- if(PlayerInfo[playerid][gang_rank] == 3){format(fileZ,sizeof(fileZ)," %s(%d) òè ñìúêíà ðàíêà íà %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank3],PlayerInfo[playerid][gang_rank]);}
- if(PlayerInfo[playerid][gang_rank] == 4){format(fileZ,sizeof(fileZ)," %s(%d) òè ñìúêíà ðàíêà íà %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank4],PlayerInfo[playerid][gang_rank]);}
- if(PlayerInfo[playerid][gang_rank] == 5){format(fileZ,sizeof(fileZ)," %s(%d) òè ñìúêíà ðàíêà íà %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank5],PlayerInfo[playerid][gang_rank]);}
- if(PlayerInfo[playerid][gang_rank] == 6){format(fileZ,sizeof(fileZ)," %s(%d) òè ñìúêíà ðàíêà íà %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank6],PlayerInfo[playerid][gang_rank]);}
- SendClientMessage(playerid, ROT, fileZ);
- SendClientMessage(playerid, ROT, "Òè âçå ëåâåëà íà èãðà÷à.");}}}}
- return 1;
- }
- if (strcmp(cmd, "/gstats", true) ==0 )
- {
- new showstring[256];
- new rstring[256];
- new nmember = PlayerInfo[playerid][gang_member];
- new nrank;
- for(new count = 20;count<MAX_GANGS;count++)
- {
- format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
- if(dini_Exists(fileZ)){
- if(nmember == GangInfo[count][ID]){
- if(nrank == 0){rstring = "N.A";}
- format(fileZ, sizeof(fileZ),"%s",GangInfo[count][Gang_Rank1]);
- if(nrank == 1){rstring = fileZ;}
- format(fileZ, sizeof(fileZ),"%s",GangInfo[count][Gang_Rank2]);
- if(nrank == 2){rstring = fileZ;}
- format(fileZ, sizeof(fileZ),"%s",GangInfo[count][Gang_Rank3]);
- if(nrank == 3){rstring = fileZ;}
- format(fileZ, sizeof(fileZ),"%s",GangInfo[count][Gang_Rank4]);
- if(nrank == 4){rstring = fileZ;}
- format(fileZ, sizeof(fileZ),"%s",GangInfo[count][Gang_Rank5]);
- if(nrank == 5){rstring = fileZ;}
- format(fileZ, sizeof(fileZ),"%s",GangInfo[count][Gang_Rank6]);
- if(nrank == 6){rstring = fileZ;}
- if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID]){rstring = "Ëèäåð";}
- format(showstring,sizeof(showstring),"Îòáîð: %s\nÎòáîð_ID: %d\nÎòáîð_Ðàíê: %s\nÎòáîð_checkout: %d",GangInfo[count][Name],GangInfo[count][ID],rstring,GangInfo[count][Gang_Cash]);
- ShowPlayerDialog(playerid, DIALOGID_STATS, DIALOG_STYLE_MSGBOX, "Stats",showstring, "-OK-", "--");}}
- }
- return 1;
- }
- return 0;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOGID_GANGCREATE)
- {
- if(response == 1)
- {
- if(listitem == 0)
- {
- format(fileZ, sizeof(fileZ), "Ìîëÿ íàïèøè èìå íà òâîÿ îòáîð.");
- ShowPlayerDialog(playerid, DIALOGID_GANGCREATE3, DIALOG_STYLE_INPUT, "Create Gang", fileZ, "Create", "exit");
- }
- if(listitem == 1)
- {
- format(fileZ, sizeof(fileZ), "Ñìåíè ìÿñòî íà îòáîð\nÑìåíè èìå\nÑìåíè ðàíê\nÑìåíè ñêèí\nÑìåíè îðúæèÿòà");
- ShowPlayerDialog(playerid, DIALOGID_GANGCREATE2, DIALOG_STYLE_LIST, "Change Spawn\nChange Name\nChange Ranks", fileZ, "O.K.", "exit");
- }
- }
- }
- if(dialogid == DIALOGID_GANGCREATE1)
- {
- if(response == 1)
- {
- for(new count = 20;count<MAX_GANGS;count++)
- {
- format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
- if(dini_Exists(fileZ)){
- if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID]){
- dini_Set(fileZ,"Name",inputtext);
- format(fileZ, sizeof(fileZ), "Íîâî èìå íà îòáîðà : (ID:%d) %s",GangInfo[count][ID],inputtext);
- SendClientMessage(playerid,ROT,fileZ);
- break;}}
- }
- }
- }
- if(dialogid == DIALOGID_GANGCREATE2)
- {
- if(response == 1)
- {
- if(listitem == 0)
- {
- for(new count = 20;count<MAX_GANGS;count++)
- {
- format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
- if(dini_Exists(fileZ))
- {
- if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID])
- {
- //new Float:x,Float:y,Float:z;
- GetPlayerPos(playerid,GangInfo[count][Spawn_X],GangInfo[count][Spawn_Y],GangInfo[count][Spawn_Z]);
- dini_FloatSet(fileZ,"Spawn_X",GangInfo[count][Spawn_X]);
- dini_FloatSet(fileZ,"Spawn_Y",GangInfo[count][Spawn_Y]);
- dini_FloatSet(fileZ,"Spawn_Z",GangInfo[count][Spawn_Z]);
- dini_IntSet(fileZ,"Spawn_Interior",GetPlayerInterior(playerid));
- dini_IntSet(fileZ,"Spawn_VirtualWorld",GetPlayerVirtualWorld(playerid));
- format(fileZ, sizeof(fileZ), "Òè çàäàäå áàçàòà íà îòáîðà ",GangInfo[count][Name]);
- SendClientMessage(playerid,ROT,fileZ);
- }
- }
- }
- }
- if(listitem == 1)
- {
- format(fileZ, sizeof(fileZ), "Ìîëÿ èçáåðè èìå íà âàøèÿ îòáîð.");
- ShowPlayerDialog(playerid, DIALOGID_GANGCREATE1, DIALOG_STYLE_INPUT, "Gang Name", fileZ, "Change", "exit");
- }
- if(listitem == 2)
- {
- format(fileZ, sizeof(fileZ), "Ðàíê1\nÐàíê2\nÐàíê3\nÐàíê4\nÐàíê5");
- ShowPlayerDialog(playerid, DIALOGID_GANGCREATE4, DIALOG_STYLE_LIST, "Change Rank", fileZ, "O.K.", "exit");
- }
- if(listitem == 3)
- {
- format(fileZ, sizeof(fileZ), "Type in the id of the skin");
- ShowPlayerDialog(playerid, DIALOGID_SKINCHANGE, DIALOG_STYLE_INPUT, "Change Skin", fileZ, "O.K.", "exit");
- }
- if(listitem == 4)
- {
- format(fileZ, sizeof(fileZ), "Type in the id of the weapon");
- ShowPlayerDialog(playerid, DIALOGID_WEAPONCHANGE, DIALOG_STYLE_INPUT, "Change Weapon", fileZ, "O.K.", "exit");
- }
- }
- }
- if(dialogid == DIALOGID_SKINCHANGE)
- {
- if(response == 1)
- {
- for(new count = 20;count<MAX_GANGS;count++)
- {
- new str3[128];
- GangInfo[count][Gang_Skin] = strval(inputtext);
- dini_IntSet(fileZ,"Skin",GangInfo[count][Gang_Skin]);
- SetPlayerSkin(playerid, GangInfo[count][Gang_Skin]);
- format(str3, sizeof(str3), "Your gang skin has been set to %d", GangInfo[count][Gang_Skin]);
- }
- }
- }
- if(dialogid == DIALOGID_WEAPONCHANGE)
- {
- if(response == 1)
- {
- for(new count = 20;count<MAX_GANGS;count++)
- {
- new str3[128];
- GangInfo[count][Gang_Weapon] = strval(inputtext);
- dini_IntSet(fileZ,"Weapon",GangInfo[count][Gang_Weapon]);
- GivePlayerWeapon(playerid, GangInfo[count][Gang_Weapon], 999999);
- format(str3, sizeof(str3), "Your gang weapon has been set to %d", GangInfo[count][Gang_Weapon]);
- }
- }
- }
- if(dialogid == DIALOGID_GANGCREATE3)
- {
- if(response == 1)
- {
- for(new count = 20;count<MAX_GANGS;count++)
- {
- format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
- if(dini_Exists(fileZ)){}
- else{
- dini_Create(fileZ);
- dini_Set(fileZ,"Name",inputtext);
- dini_IntSet(fileZ,"ID",count);
- dini_FloatSet(fileZ,"Spawn_X",-304.7875);
- dini_FloatSet(fileZ,"Spawn_Y",1298.8138);
- dini_FloatSet(fileZ,"Spawn_Z",53.4743);
- dini_FloatSet(fileZ,"Spawn_A",53.4743);
- dini_IntSet(fileZ,"Spawn_Interior",0);
- dini_IntSet(fileZ,"Spawn_VirtualWorld",0);
- dini_IntSet(fileZ,"Gang_Cash",Gang_Cash);
- dini_IntSet(fileZ,"Gang_Skin",GangInfo[count][Gang_Skin]);
- dini_IntSet(fileZ,"Gang_Weapon",GangInfo[count][Gang_Weapon]);
- dini_IntSet(fileZ,"Gang_Kills",GangInfo[count][Gang_Kills]);
- dini_IntSet(fileZ,"Gang_Deaths",GangInfo[count][Gang_Deaths]);
- dini_Set(fileZ,"Gang_Rank1","No Rank");
- dini_Set(fileZ,"Gang_Rank2","No Rank");
- dini_Set(fileZ,"Gang_Rank3","No Rank");
- dini_Set(fileZ,"Gang_Rank4","No Rank");
- dini_Set(fileZ,"Gang_Rank5","No Rank");
- dini_IntSet(fileZ,"Gang_House",-1);
- format(fileZ, sizeof(fileZ), "Èãðà÷ : %s(%d) Ñúçäàäå îòáîð : %s", Names(playerid),playerid,inputtext);
- SendClientMessageToAll(GELB,fileZ);
- format(fileZ, sizeof(fileZ), "Òâîÿ îòáîð å ñúçäàäåí. id íà áàíäàòà %d",count);
- SendClientMessage(playerid,ROT,fileZ);
- PlayerInfo[playerid][gang_leader] = count;
- PlayerInfo[playerid][gang_member] = count;
- break;
- }
- }
- }
- }
- if(dialogid == DIALOGID_GANGCREATE4)
- {
- if(response == 1)
- {
- for(new count = 20;count<MAX_GANGS;count++)
- {
- format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
- if(dini_Exists(fileZ))
- {
- if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID])
- {
- if(listitem == 0) // Rank 1
- {
- assign[playerid] = 1;
- format(fileZ, sizeof(fileZ), "Please Choose a name for Members Rank 1.");
- ShowPlayerDialog(playerid, DIALOGID_GANGCREATE5, DIALOG_STYLE_INPUT, "Rank 1 -name", fileZ, "Change", "exit");
- }
- if(listitem == 1) // Rank 2
- {
- assign[playerid] = 2;
- format(fileZ, sizeof(fileZ), "Please Choose a name for Members Rank 2.");
- ShowPlayerDialog(playerid, DIALOGID_GANGCREATE5, DIALOG_STYLE_INPUT, "Rank 2 -name", fileZ, "Change", "exit");
- }
- if(listitem == 2) // Rank 3
- {
- assign[playerid] = 3;
- format(fileZ, sizeof(fileZ), "Please Choose a name for Members Rank 3.");
- ShowPlayerDialog(playerid, DIALOGID_GANGCREATE5, DIALOG_STYLE_INPUT, "Rank 3 -name", fileZ, "Change", "exit");
- }
- if(listitem == 3) // Rank 4
- {
- assign[playerid] = 4;
- format(fileZ, sizeof(fileZ), "Please Choose a name for Members Rank 4.");
- ShowPlayerDialog(playerid, DIALOGID_GANGCREATE5, DIALOG_STYLE_INPUT, "Rank 4 -name", fileZ, "Change", "exit");
- }
- if(listitem == 4) // Rank 5
- {
- assign[playerid] = 5;
- format(fileZ, sizeof(fileZ), "Please Choose a name for Leader Rank 5.");
- ShowPlayerDialog(playerid, DIALOGID_GANGCREATE5, DIALOG_STYLE_INPUT, "Rank 5 -name", fileZ, "Change", "exit");
- }
- }
- }
- }
- }
- }
- if(dialogid == DIALOGID_GANGCREATE5)
- {
- if(response == 1)
- {
- for(new count = 20;count<MAX_GANGS;count++)
- {
- format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
- if(dini_Exists(fileZ))
- {
- if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID])
- {
- if(assign[playerid] == 1)
- {
- dini_Set(fileZ,"Gang_Rank1",inputtext);
- assign[playerid] = 0;
- format(fileZ, sizeof(fileZ), "íîâî ðàíê èìå : %s",inputtext);
- SendClientMessage(playerid, GREEN,fileZ);
- }
- if(assign[playerid] == 2)
- {
- dini_Set(fileZ,"Gang_Rank2",inputtext);
- assign[playerid] = 0;
- format(fileZ, sizeof(fileZ), "íîâî ðàíê èìå : %s",inputtext);
- SendClientMessage(playerid, GREEN,fileZ);
- }
- if(assign[playerid] == 3)
- {
- dini_Set(fileZ,"Gang_Rank3",inputtext);
- assign[playerid] = 0;
- format(fileZ, sizeof(fileZ), "íîâî ðàíê èìå : %s",inputtext);
- SendClientMessage(playerid, GREEN,fileZ);
- }
- if(assign[playerid] == 4)
- {
- dini_Set(fileZ,"Gang_Rank4",inputtext);
- assign[playerid] = 0;
- format(fileZ, sizeof(fileZ), "íîâî ðàíê èìå : %s",inputtext);
- SendClientMessage(playerid, GREEN,fileZ);
- }
- if(assign[playerid] == 5)
- {
- dini_Set(fileZ,"Gang_Rank5",inputtext);
- assign[playerid] = 0;
- format(fileZ, sizeof(fileZ), "íîâî ðàíê èìå : %s",inputtext);
- SendClientMessage(playerid, GREEN,fileZ);
- }
- }
- }
- }
- }
- }
- return 1;
- }
- //==================================================//
- //======== STOCKS ========//
- stock Names(playerid)
- {
- new pname[MAX_PLAYER_NAME];
- GetPlayerName(playerid,pname,sizeof(pname));
- return pname;
- }
- stock ini_GetKey( line[] )
- {
- new keyRes[256];
- keyRes[0] = 0;
- if ( strfind( line , "=" , true ) == -1 ) return keyRes;
- strmid( keyRes , line , 0 , strfind( line , "=" , true ) , sizeof( keyRes) );
- return keyRes;
- }
- stock ini_GetValue( line[] )
- {
- new valRes[256];
- valRes[0]=0;
- if ( strfind( line , "=" , true ) == -1 ) return valRes;
- strmid( valRes , line , strfind( line , "=" , true )+1 , strlen( line ) , sizeof( valRes ) );
- return valRes;
- }
- strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
- //------------------------------- END ----------------------------------------//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement