Advertisement
Guest User

Untitled

a guest
Apr 4th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.34 KB | None | 0 0
  1. // FILTERSCRIPT //
  2.  
  3. #define fs
  4.  
  5.  
  6.  
  7. //============ INCLUDES ===========//
  8.  
  9.  
  10. #include <a_samp>
  11. #include <dini>
  12.  
  13.  
  14. //================================//
  15.  
  16.  
  17.  
  18.  
  19. //========== DIALOGID DEFINITIONS ==========//
  20.  
  21.  
  22.  
  23. #define DIALOGID_GANGCREATE 100
  24. #define DIALOGID_GANGCREATE1 101
  25. #define DIALOGID_GANGCREATE2 102
  26. #define DIALOGID_GANGCREATE3 103
  27. #define DIALOGID_GANGCREATE4 104
  28. #define DIALOGID_GANGCREATE5 105
  29. #define DIALOGID_STATS 106
  30. #define DIALOGID_SKINCHANGE 107
  31. #define DIALOGID_WEAPONCHANGE 108
  32.  
  33.  
  34.  
  35. //=========================================//
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43. //======= CONFIGS =======//
  44.  
  45.  
  46.  
  47.  
  48. #define MAX_GANGS 1000 // Change it to your own
  49. #define GANG_CHASH 500000 // Change it to your own
  50.  
  51.  
  52.  
  53. //======================//
  54.  
  55.  
  56.  
  57.  
  58.  
  59. //======= COLORS =======//
  60.  
  61.  
  62. #define COLOR_ORANGE2 0xFF8000FF
  63. #define COLOR_DBLUE2 0x2641FEAA
  64. #define COLOR_RED 0xAA333300
  65. #define COLOR_LIGHTRED 0xFF634700
  66. #define COLOR_DARKRED 0x9A000000
  67. #define COLOR_BLUE 0x0000FF00
  68. #define COLOR_LIGHTBLUE 0x33CCFF00
  69. #define COLOR_DARKBLUE 0x00009A00
  70. #define COLOR_WHITE 0xFFFFFF00
  71. #define COLOR_GREEN 0x33AA3300
  72. #define COLOR_LIGHTGREEN 0x9ACD3200
  73. #define COLOR_DARKGREEN 0x40008000
  74. #define COLOR_YELLOW 0xFFFF0000
  75. #define COLOR_YELLOW2 0xF5DEB300
  76. #define COLOR_GREY 0xAFAFAF00
  77. #define COLOR_BROWN 0x99330000
  78. #define COLOR_ORANGE 0xFF993300
  79. #define COLOR_MAGENTA 0xFF00FF00
  80. #define COLOR_PURPLE 0xC2A2DA00
  81. #define COLOR_DBLUE 0x8D8DFF00
  82. #define COLOR_LAWENFORCE 0x8D8DFF00
  83. #define COLOR_LAWENFORCERADAR 0x8D8DFFAA
  84. #define COLOR_DARKPURPLE 0xD900D300
  85. #define COLOR_BLACK 0x02020200
  86. #define COLOR_CYAN 0x99FFFF00
  87. #define COLOR_TAN 0xFFFFCC00
  88. #define COLOR_PINK 0xFF66FF00
  89. #define COLOR_KHAKI 0x99990000
  90. #define COLOR_LIME 0x99FF0000
  91. #define COLOR_TURQ 0x00A3C000
  92. #define COLOR_SYSTEM 0xEFEFF700
  93. #define COLOR_GRAD1 0xB4B5B700
  94. #define COLOR_GRAD2 0xBFC0C200
  95. #define COLOR_GRAD3 0xCBCCCE00
  96. #define COLOR_GRAD4 0xD8D8D800
  97. #define COLOR_GRAD5 0xE3E3E300
  98. #define COLOR_GRAD6 0xF0F0F0FF
  99. #define COLOR_FADE1 0xE6E6E600
  100. #define COLOR_FADE2 0xC8C8C800
  101. #define COLOR_FADE3 0xAAAAAA00
  102. #define COLOR_FADE4 0x8C8C8C00
  103. #define COLOR_FADE5 0x6E6E6E00
  104. #define GELB 0xFF828200
  105. #define ROT 0xFF0000FF
  106. #define GREEN 0x00CC00FF
  107. #define WHITE 0xFFFFFFFF
  108.  
  109.  
  110. //====================//
  111.  
  112.  
  113.  
  114.  
  115. //=========== INTEGERS =============//
  116.  
  117.  
  118. enum gInfo
  119. {
  120. Name[128],
  121. ID,
  122. Float:Spawn_X,
  123. Float:Spawn_Y,
  124. Float:Spawn_Z,
  125. Float:Spawn_A,
  126. Spawn_Interior,
  127. Spawn_VirtualWorld,
  128. Gang_Cash,
  129. Gang_Skin,
  130. Gang_Weapon,
  131. Gang_Kills,
  132. Gang_Deaths,
  133. Gang_Rank1[32],
  134. Gang_Rank2[32],
  135. Gang_Rank3[32],
  136. Gang_Rank4[32],
  137. Gang_Rank5[32],
  138. Gang_Rank6[32],
  139. Gang_House,
  140. }
  141.  
  142. new GangInfo[MAX_GANGS][gInfo];
  143.  
  144. enum pInfo
  145. {
  146. gang_member,
  147. gang_leader,
  148. gang_rank
  149. }
  150. new fileZ[256];
  151. new assign[MAX_PLAYERS];
  152. new PlayerInfo[MAX_PLAYERS][pInfo];
  153.  
  154. //==================================//
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161. //=========== FORWARDS ===========//
  162.  
  163.  
  164. forward OnGangLogin(playerid);
  165. forward LoadData();
  166.  
  167.  
  168. //===============================//
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182. //============= FUNCTION'S AND CALLBACK'S =============//
  183.  
  184.  
  185.  
  186.  
  187. public OnFilterScriptInit()
  188. {
  189. print("\n--------------------------------------");
  190. print(" Gang System");
  191. print("--------------------------------------\n");
  192. LoadData();
  193. return 1;
  194. }
  195.  
  196. public OnFilterScriptExit()
  197. {
  198. print("\n--------------------------------------");
  199. print(" Gang System");
  200. print("--------------------------------------\n");
  201. return 1;
  202. }
  203.  
  204. public LoadData()
  205. {
  206. for(new count = 20;count<MAX_GANGS;count++)
  207. {
  208. new Load[256];
  209. format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
  210. if(dini_Exists(fileZ))
  211. {
  212. Load = dini_Get(fileZ,"Name");
  213. strmid(GangInfo[count][Name],Load,0,256,256);
  214. Load = dini_Get(fileZ,"ID");
  215. GangInfo[count][ID] = strval(Load);
  216. Load = dini_Get(fileZ,"Spawn_X");
  217. GangInfo[count][Spawn_X] = strval(Load);
  218. Load = dini_Get(fileZ,"Spawn_Y");
  219. GangInfo[count][Spawn_Y] = strval(Load);
  220. Load = dini_Get(fileZ,"Spawn_Z");
  221. GangInfo[count][Spawn_Z] = strval(Load);
  222. Load = dini_Get(fileZ,"Spawn_A");
  223. GangInfo[count][Spawn_A] = strval(Load);
  224. Load = dini_Get(fileZ,"Spawn_Interior");
  225. GangInfo[count][Spawn_Interior] = strval(Load);
  226. Load = dini_Get(fileZ,"Spawn_VirtualWorld");
  227. GangInfo[count][Spawn_VirtualWorld] = strval(Load);
  228. Load = dini_Get(fileZ,"Gang_Cash");
  229. GangInfo[count][Gang_Cash] = strval(Load);
  230. Load = dini_Get(fileZ,"Gang_Skin");
  231. GangInfo[count][Gang_Skin] = strval(Load);
  232. Load = dini_Get(fileZ,"Gang_Weapon");
  233. GangInfo[count][Gang_Weapon] = strval(Load);
  234. Load = dini_Get(fileZ,"Gang_Kills");
  235. GangInfo[count][Gang_Kills] = strval(Load);
  236. Load = dini_Get(fileZ,"Gang_Deaths");
  237. GangInfo[count][Gang_Deaths] = strval(Load);
  238. format(fileZ, sizeof(fileZ),"Gang : ID = %d | Name = %s Loaded.",count,GangInfo[count][Name]);
  239. printf("%s", fileZ);
  240. }
  241. }
  242. }
  243.  
  244.  
  245. public OnPlayerConnect(playerid)
  246. {
  247. format(fileZ, sizeof(fileZ), "Gangs/Players/%s.ini",Names(playerid));
  248. if(dini_Exists(fileZ)){OnGangLogin(playerid);}
  249. else{
  250. new File: hFile = fopen(fileZ, io_write);
  251. if (hFile)
  252. {
  253. new var[32];
  254. format(var, 32, "gang_member=%d\n", PlayerInfo[playerid][gang_member]);fwrite(hFile, var);
  255. format(var, 32, "gang_leader=%d\n",PlayerInfo[playerid][gang_leader]);fwrite(hFile, var);
  256. format(var, 32, "gang_rank=%d\n",PlayerInfo[playerid][gang_rank]);fwrite(hFile, var);
  257. }
  258. fclose(hFile);
  259. OnGangLogin(playerid);
  260. }
  261. return 1;
  262. }
  263.  
  264. public OnPlayerDisconnect(playerid, reason)
  265. {
  266. format(fileZ, sizeof(fileZ), "Gangs/Players/%s.ini", Names(playerid));
  267. new File: hFile = fopen(fileZ, io_write);
  268. if (hFile)
  269. {
  270. new var[32];
  271. format(var, 32, "gang_member=%d\n", PlayerInfo[playerid][gang_member]);fwrite(hFile, var);
  272. format(var, 32, "gang_leader=%d\n",PlayerInfo[playerid][gang_leader]);fwrite(hFile, var);
  273. format(var, 32, "gang_rank=%d\n",PlayerInfo[playerid][gang_rank]);fwrite(hFile, var);
  274. }
  275. fclose(hFile);
  276. return 1;
  277. }
  278.  
  279. public OnPlayerSpawn(playerid)
  280. {
  281. for(new count = 20;count<MAX_GANGS;count++)
  282. {
  283. format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
  284. if(dini_Exists(fileZ))
  285. {
  286. if(PlayerInfo[playerid][gang_member] == GangInfo[count][ID])
  287. {
  288. GivePlayerWeapon(playerid, GangInfo[count][Gang_Weapon], 999999);
  289. SetPlayerInterior(playerid,GangInfo[count][Spawn_Interior]);
  290. SetPlayerVirtualWorld(playerid,GangInfo[count][Spawn_VirtualWorld]);
  291. SetPlayerPos(playerid,GangInfo[count][Spawn_X],GangInfo[count][Spawn_Y],GangInfo[count][Spawn_Z]);
  292. SetPlayerSkin(playerid, GangInfo[count][Gang_Skin]);
  293. }
  294. }
  295. break;
  296. }
  297. return 1;
  298. }
  299.  
  300. public OnGangLogin(playerid)
  301. {
  302. if(IsPlayerNPC(playerid)) return 1;
  303. format(fileZ, sizeof(fileZ), "Gangs/Players/%s.ini", Names(playerid));
  304. new File: UserFile = fopen(fileZ, io_read);
  305. if ( UserFile )
  306. {
  307. new key[ 256 ] , val[ 256 ];
  308. new Data[ 256 ];
  309. while ( fread( UserFile , Data , sizeof( Data ) ) )
  310. {
  311. key = ini_GetKey( Data );
  312. if( strcmp( key , "gang_member" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][gang_member] = strval( val ); }
  313. if( strcmp( key , "gang_leader" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][gang_leader] = strval( val ); }
  314. if( strcmp( key , "gang_rank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][gang_rank] = strval( val ); }
  315. }
  316. fclose(UserFile);
  317. }
  318. return 1;
  319. }
  320.  
  321.  
  322.  
  323. public OnPlayerDeath(playerid, killerid, reason)
  324. {
  325. GangInfo[killerid][Gang_Kills] ++;
  326. GangInfo[playerid][Gang_Deaths] ++;
  327. return 1;
  328. }
  329.  
  330.  
  331.  
  332. public OnPlayerText(playerid, text[])
  333. {
  334. if(IsPlayerConnected(playerid))
  335. {
  336. if(text[0] == '!')
  337. {
  338. SendClientMessage(playerid, 0xAA0000AA, "Tè èçïðàòè îòáîðíî ñúîáùåíèå");
  339. new name[24], string[128];
  340. GetPlayerName(playerid, name, 24);
  341. format(string, sizeof(string), "[Oòáîðåí ÷àò]%s: %s", name, text[1]);
  342. printf("%s", string);
  343.  
  344. for(new i = 0; i < MAX_PLAYERS; i++)
  345. {
  346. if(IsPlayerConnected(i))
  347. {
  348. if(PlayerInfo[i][gang_member] || PlayerInfo[i][gang_leader] == PlayerInfo[playerid][gang_member] || PlayerInfo[playerid][gang_leader])
  349. SendClientMessage(i, GetPlayerColor(playerid), string);
  350. }
  351. }
  352. return 0;
  353. }
  354.  
  355. }
  356. return 1;
  357. }
  358.  
  359. public OnPlayerCommandText(playerid, cmdtext[])
  360. {
  361. new cmd[256];
  362. new tmp[256];
  363. new idx;
  364. cmd = strtok(cmdtext, idx);
  365.  
  366.  
  367. if (strcmp(cmd, "/gang", true) ==0 )
  368. {
  369. new showstring[256];
  370. format(showstring,sizeof(showstring),"Ñúçäàé îòáîð\nÑìåíè îòáîð");
  371. ShowPlayerDialog(playerid, DIALOGID_GANGCREATE, DIALOG_STYLE_LIST, "Gang-Display",showstring, "ACCEPT", "EXIT");
  372. return 1;
  373. }
  374.  
  375. if (strcmp(cmd, "/ganghelp", true) ==0 )
  376. {
  377. SendClientMessage(playerid, COLOR_RED, "Ãàíã ñèñòåìà.");
  378. SendClientMessage(playerid, COLOR_RED, "Kîìàíäè:");
  379. SendClientMessage(playerid, COLOR_RED, "------------");
  380. SendClientMessage(playerid, COLOR_RED, "/gang | /ganghelp | /gangs | /invite | /kick |");
  381. SendClientMessage(playerid, COLOR_RED, "/promote | /denote | /gstats |");
  382. return 1;
  383. }
  384.  
  385. if (strcmp(cmd, "/caca", true) ==0 )
  386. {
  387.  
  388. SendClientMessage(playerid, COLOR_RED, "CREDITS:");
  389. SendClientMessage(playerid, COLOR_RED, "---------");
  390. SendClientMessage(playerid, COLOR_RED, "WackoX || For Fixing /gangs");
  391. SendClientMessage(playerid, COLOR_RED, "DarCoBlue || For making dini");
  392. SendClientMessage(playerid, COLOR_RED, "Crime Life Team || For making the half script");
  393. SendClientMessage(playerid, COLOR_RED, "DogZone || For the idea and some script help");
  394. return 1;
  395. }
  396.  
  397. if(!strcmp(cmd, "/gangs", true))
  398. {
  399. new str5[128];
  400. SendClientMessage(playerid, COLOR_RED, "Íàëè÷íè áàíäè:");
  401. for(new count; count <MAX_GANGS; count++)
  402. {
  403. if(GangInfo[count][ID] || GangInfo[count][Name])
  404. {
  405. format(str5, sizeof(str5), "%s", GangInfo[count][Name]);
  406. SendClientMessage(playerid, COLOR_RED, str5);
  407. }
  408. }
  409. return 1;
  410. }
  411.  
  412. if (strcmp(cmd, "/invite", true) ==0 )
  413. {
  414. tmp = strtok(cmdtext, idx);
  415. if(!strlen(tmp))return SendClientMessage(playerid, COLOR_GRAD1, "Íàïèøè: /invite [Nick/ID]");
  416. new inviteid = strval(tmp);
  417. if(inviteid == playerid)return SendClientMessage(playerid, COLOR_RED, "Tè íå ìîæåø äà ïîêàíèø òîçè ÷îâåê");
  418. else if(PlayerInfo[playerid][gang_member] != 0 || PlayerInfo[playerid][gang_leader] != 0)SendClientMessage(playerid, COLOR_GRAD1, "Player is already in other gang.");
  419. else{
  420. for(new count = 20;count<MAX_GANGS;count++){
  421. format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
  422. if(dini_Exists(fileZ)){
  423. if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID]){
  424. PlayerInfo[playerid][gang_member] = PlayerInfo[playerid][gang_member];
  425. format(fileZ,sizeof(fileZ)," %s(%d) òå ïîêàíè äà âëåçåø â îòáîð: %s(%d) ",Names(playerid),playerid,GangInfo[count][Name],GangInfo[count][ID]);
  426. SendClientMessage(playerid, COLOR_RED, fileZ);
  427. SendClientMessage(playerid, COLOR_RED, "Òè ïîêàíè èãðà÷à äà âëåçå â òâîÿ îòáîð");}}}}
  428. return 1;
  429. }
  430.  
  431. if (strcmp(cmd, "/kick", true) ==0 )
  432. {
  433. tmp = strtok(cmdtext, idx);
  434. if(!strlen(tmp))return SendClientMessage(playerid, COLOR_GRAD1, "Íàïèøè: /kick [PartofName/ID]");
  435. new kickid = strval(tmp);
  436. if(kickid == playerid)return SendClientMessage(playerid, ROT, "Òè íå ìîæåø äà ñå èçãîíèø ñàì");
  437. else if(PlayerInfo[playerid][gang_member] != PlayerInfo[playerid][gang_leader])SendClientMessage(playerid, COLOR_GRAD1, "Òîçè ÷îâåê íå å îò òâîÿ îòáîð.");
  438. else if(PlayerInfo[playerid][gang_leader] == 0)SendClientMessage(playerid, COLOR_GRAD1, "Òè íå ñè ëèäåð.");
  439. else{
  440. for(new count = 20;count<MAX_GANGS;count++){
  441. format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
  442. if(dini_Exists(fileZ)){
  443. if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID]){
  444. PlayerInfo[playerid][gang_member] = 0;
  445. format(fileZ,sizeof(fileZ)," %s(%d) áåùå èçãîíåí îò îòáîðà: %s(%d) ",Names(playerid),playerid,GangInfo[count][Name],GangInfo[count][ID]);
  446. SendClientMessage(playerid, COLOR_RED, fileZ);
  447. SendClientMessage(playerid, COLOR_RED, "Òè ñè ïðåìàõíàò îò îòáîðà.");}}}}
  448. return 1;
  449. }
  450.  
  451. if (strcmp(cmd, "/promote", true) ==0 )
  452. {
  453. tmp = strtok(cmdtext, idx);
  454. if(!strlen(tmp))return SendClientMessage(playerid, COLOR_GRAD1, "Íàïèøè: /promote [playerid]");
  455. new promoteid = strval(tmp);
  456. if(promoteid == playerid)return SendClientMessage(playerid, ROT, "Íå ìîæåø äà ñè âäèãíåø ñâîÿ ðàíê");
  457. else if(PlayerInfo[playerid][gang_member] != PlayerInfo[playerid][gang_leader])SendClientMessage(playerid, COLOR_GRAD1, "Èãðà÷à òðÿáâà äà å îò òâîÿ îòáîð");
  458. else if(PlayerInfo[playerid][gang_leader] == 0)SendClientMessage(playerid, COLOR_GRAD1, "Òè íå ñè ëèäåð.");
  459. else{
  460. for(new count = 20;count<MAX_GANGS;count++){
  461. format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
  462. if(dini_Exists(fileZ)){
  463. if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID]){
  464. if(PlayerInfo[playerid][gang_rank] == 6)return SendClientMessage(playerid, COLOR_RED, "Player already got highest Rank");
  465. PlayerInfo[playerid][gang_rank] += 1;
  466. 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]);}
  467. 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]);}
  468. 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]);}
  469. 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]);}
  470. 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]);}
  471. 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]);}
  472. SendClientMessage(playerid, COLOR_RED, fileZ);
  473. SendClientMessage(playerid, COLOR_RED, "Òè âäèãíà ëåâåëà íà èãðà÷à");}}}}
  474. return 1;
  475. }
  476.  
  477. if (strcmp(cmd, "/denote", true) ==0 )
  478. {
  479. tmp = strtok(cmdtext, idx);
  480. if(!strlen(tmp))return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /denote [playerid]");
  481. new denoteid = strval(tmp);
  482. if(denoteid == playerid)return SendClientMessage(playerid, ROT, "Íå ìîæåø äà ñè ïðåìàõíåø ðàíêà");
  483. else if(PlayerInfo[playerid][gang_member] != PlayerInfo[playerid][gang_leader])SendClientMessage(playerid, COLOR_GRAD1, "Èãðà÷à òðÿáâà äà å îò òâîÿ îòáîð.");
  484. else if(PlayerInfo[playerid][gang_leader] == 0)SendClientMessage(playerid, COLOR_GRAD1, "Òè íå ñè àäìèí.");
  485. else{
  486. for(new count = 20;count<MAX_GANGS;count++){
  487. format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
  488. if(dini_Exists(fileZ)){
  489. if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID]){
  490. if(PlayerInfo[playerid][gang_rank] == 1)return SendClientMessage(playerid, ROT, "Ñâàëåí ðàíê íà èãðà÷.");
  491. PlayerInfo[playerid][gang_rank] -= 1;
  492. 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]);}
  493. 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]);}
  494. 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]);}
  495. 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]);}
  496. 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]);}
  497. 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]);}
  498. SendClientMessage(playerid, ROT, fileZ);
  499. SendClientMessage(playerid, ROT, "Òè âçå ëåâåëà íà èãðà÷à.");}}}}
  500. return 1;
  501. }
  502.  
  503. if (strcmp(cmd, "/gstats", true) ==0 )
  504. {
  505. new showstring[256];
  506. new rstring[256];
  507. new nmember = PlayerInfo[playerid][gang_member];
  508. new nrank;
  509. for(new count = 20;count<MAX_GANGS;count++)
  510. {
  511. format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
  512. if(dini_Exists(fileZ)){
  513. if(nmember == GangInfo[count][ID]){
  514. if(nrank == 0){rstring = "N.A";}
  515. format(fileZ, sizeof(fileZ),"%s",GangInfo[count][Gang_Rank1]);
  516. if(nrank == 1){rstring = fileZ;}
  517. format(fileZ, sizeof(fileZ),"%s",GangInfo[count][Gang_Rank2]);
  518. if(nrank == 2){rstring = fileZ;}
  519. format(fileZ, sizeof(fileZ),"%s",GangInfo[count][Gang_Rank3]);
  520. if(nrank == 3){rstring = fileZ;}
  521. format(fileZ, sizeof(fileZ),"%s",GangInfo[count][Gang_Rank4]);
  522. if(nrank == 4){rstring = fileZ;}
  523. format(fileZ, sizeof(fileZ),"%s",GangInfo[count][Gang_Rank5]);
  524. if(nrank == 5){rstring = fileZ;}
  525. format(fileZ, sizeof(fileZ),"%s",GangInfo[count][Gang_Rank6]);
  526. if(nrank == 6){rstring = fileZ;}
  527. if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID]){rstring = "Ëèäåð";}
  528. format(showstring,sizeof(showstring),"Îòáîð: %s\nÎòáîð_ID: %d\nÎòáîð_Ðàíê: %s\nÎòáîð_checkout: %d",GangInfo[count][Name],GangInfo[count][ID],rstring,GangInfo[count][Gang_Cash]);
  529. ShowPlayerDialog(playerid, DIALOGID_STATS, DIALOG_STYLE_MSGBOX, "Stats",showstring, "-OK-", "--");}}
  530. }
  531. return 1;
  532. }
  533. return 0;
  534. }
  535.  
  536. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  537. {
  538. if(dialogid == DIALOGID_GANGCREATE)
  539. {
  540. if(response == 1)
  541. {
  542. if(listitem == 0)
  543. {
  544. format(fileZ, sizeof(fileZ), "Ìîëÿ íàïèøè èìå íà òâîÿ îòáîð.");
  545. ShowPlayerDialog(playerid, DIALOGID_GANGCREATE3, DIALOG_STYLE_INPUT, "Create Gang", fileZ, "Create", "exit");
  546. }
  547. if(listitem == 1)
  548. {
  549. format(fileZ, sizeof(fileZ), "Ñìåíè ìÿñòî íà îòáîð\nÑìåíè èìå\nÑìåíè ðàíê\nÑìåíè ñêèí\nÑìåíè îðúæèÿòà");
  550. ShowPlayerDialog(playerid, DIALOGID_GANGCREATE2, DIALOG_STYLE_LIST, "Change Spawn\nChange Name\nChange Ranks", fileZ, "O.K.", "exit");
  551. }
  552. }
  553. }
  554. if(dialogid == DIALOGID_GANGCREATE1)
  555. {
  556. if(response == 1)
  557. {
  558. for(new count = 20;count<MAX_GANGS;count++)
  559. {
  560. format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
  561. if(dini_Exists(fileZ)){
  562. if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID]){
  563. dini_Set(fileZ,"Name",inputtext);
  564. format(fileZ, sizeof(fileZ), "Íîâî èìå íà îòáîðà : (ID:%d) %s",GangInfo[count][ID],inputtext);
  565. SendClientMessage(playerid,ROT,fileZ);
  566. break;}}
  567. }
  568. }
  569. }
  570. if(dialogid == DIALOGID_GANGCREATE2)
  571. {
  572. if(response == 1)
  573. {
  574. if(listitem == 0)
  575. {
  576. for(new count = 20;count<MAX_GANGS;count++)
  577. {
  578. format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
  579. if(dini_Exists(fileZ))
  580. {
  581. if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID])
  582. {
  583.  
  584. //new Float:x,Float:y,Float:z;
  585. GetPlayerPos(playerid,GangInfo[count][Spawn_X],GangInfo[count][Spawn_Y],GangInfo[count][Spawn_Z]);
  586. dini_FloatSet(fileZ,"Spawn_X",GangInfo[count][Spawn_X]);
  587. dini_FloatSet(fileZ,"Spawn_Y",GangInfo[count][Spawn_Y]);
  588. dini_FloatSet(fileZ,"Spawn_Z",GangInfo[count][Spawn_Z]);
  589. dini_IntSet(fileZ,"Spawn_Interior",GetPlayerInterior(playerid));
  590. dini_IntSet(fileZ,"Spawn_VirtualWorld",GetPlayerVirtualWorld(playerid));
  591. format(fileZ, sizeof(fileZ), "Òè çàäàäå áàçàòà íà îòáîðà ",GangInfo[count][Name]);
  592. SendClientMessage(playerid,ROT,fileZ);
  593.  
  594. }
  595. }
  596. }
  597. }
  598. if(listitem == 1)
  599. {
  600. format(fileZ, sizeof(fileZ), "Ìîëÿ èçáåðè èìå íà âàøèÿ îòáîð.");
  601. ShowPlayerDialog(playerid, DIALOGID_GANGCREATE1, DIALOG_STYLE_INPUT, "Gang Name", fileZ, "Change", "exit");
  602. }
  603. if(listitem == 2)
  604. {
  605. format(fileZ, sizeof(fileZ), "Ðàíê1\nÐàíê2\nÐàíê3\nÐàíê4\nÐàíê5");
  606. ShowPlayerDialog(playerid, DIALOGID_GANGCREATE4, DIALOG_STYLE_LIST, "Change Rank", fileZ, "O.K.", "exit");
  607. }
  608. if(listitem == 3)
  609. {
  610. format(fileZ, sizeof(fileZ), "Type in the id of the skin");
  611. ShowPlayerDialog(playerid, DIALOGID_SKINCHANGE, DIALOG_STYLE_INPUT, "Change Skin", fileZ, "O.K.", "exit");
  612. }
  613. if(listitem == 4)
  614. {
  615. format(fileZ, sizeof(fileZ), "Type in the id of the weapon");
  616. ShowPlayerDialog(playerid, DIALOGID_WEAPONCHANGE, DIALOG_STYLE_INPUT, "Change Weapon", fileZ, "O.K.", "exit");
  617. }
  618. }
  619. }
  620.  
  621. if(dialogid == DIALOGID_SKINCHANGE)
  622. {
  623. if(response == 1)
  624. {
  625. for(new count = 20;count<MAX_GANGS;count++)
  626. {
  627. new str3[128];
  628. GangInfo[count][Gang_Skin] = strval(inputtext);
  629. dini_IntSet(fileZ,"Skin",GangInfo[count][Gang_Skin]);
  630. SetPlayerSkin(playerid, GangInfo[count][Gang_Skin]);
  631. format(str3, sizeof(str3), "Your gang skin has been set to %d", GangInfo[count][Gang_Skin]);
  632. }
  633. }
  634. }
  635.  
  636. if(dialogid == DIALOGID_WEAPONCHANGE)
  637. {
  638. if(response == 1)
  639. {
  640. for(new count = 20;count<MAX_GANGS;count++)
  641. {
  642. new str3[128];
  643. GangInfo[count][Gang_Weapon] = strval(inputtext);
  644. dini_IntSet(fileZ,"Weapon",GangInfo[count][Gang_Weapon]);
  645. GivePlayerWeapon(playerid, GangInfo[count][Gang_Weapon], 999999);
  646. format(str3, sizeof(str3), "Your gang weapon has been set to %d", GangInfo[count][Gang_Weapon]);
  647. }
  648. }
  649. }
  650.  
  651.  
  652. if(dialogid == DIALOGID_GANGCREATE3)
  653. {
  654. if(response == 1)
  655. {
  656. for(new count = 20;count<MAX_GANGS;count++)
  657. {
  658. format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
  659. if(dini_Exists(fileZ)){}
  660. else{
  661. dini_Create(fileZ);
  662. dini_Set(fileZ,"Name",inputtext);
  663. dini_IntSet(fileZ,"ID",count);
  664. dini_FloatSet(fileZ,"Spawn_X",-304.7875);
  665. dini_FloatSet(fileZ,"Spawn_Y",1298.8138);
  666. dini_FloatSet(fileZ,"Spawn_Z",53.4743);
  667. dini_FloatSet(fileZ,"Spawn_A",53.4743);
  668. dini_IntSet(fileZ,"Spawn_Interior",0);
  669. dini_IntSet(fileZ,"Spawn_VirtualWorld",0);
  670. dini_IntSet(fileZ,"Gang_Cash",Gang_Cash);
  671. dini_IntSet(fileZ,"Gang_Skin",GangInfo[count][Gang_Skin]);
  672. dini_IntSet(fileZ,"Gang_Weapon",GangInfo[count][Gang_Weapon]);
  673. dini_IntSet(fileZ,"Gang_Kills",GangInfo[count][Gang_Kills]);
  674. dini_IntSet(fileZ,"Gang_Deaths",GangInfo[count][Gang_Deaths]);
  675. dini_Set(fileZ,"Gang_Rank1","No Rank");
  676. dini_Set(fileZ,"Gang_Rank2","No Rank");
  677. dini_Set(fileZ,"Gang_Rank3","No Rank");
  678. dini_Set(fileZ,"Gang_Rank4","No Rank");
  679. dini_Set(fileZ,"Gang_Rank5","No Rank");
  680. dini_IntSet(fileZ,"Gang_House",-1);
  681. format(fileZ, sizeof(fileZ), "Èãðà÷ : %s(%d) Ñúçäàäå îòáîð : %s", Names(playerid),playerid,inputtext);
  682. SendClientMessageToAll(GELB,fileZ);
  683. format(fileZ, sizeof(fileZ), "Òâîÿ îòáîð å ñúçäàäåí. id íà áàíäàòà %d",count);
  684. SendClientMessage(playerid,ROT,fileZ);
  685. PlayerInfo[playerid][gang_leader] = count;
  686. PlayerInfo[playerid][gang_member] = count;
  687. break;
  688. }
  689. }
  690. }
  691. }
  692. if(dialogid == DIALOGID_GANGCREATE4)
  693. {
  694. if(response == 1)
  695. {
  696. for(new count = 20;count<MAX_GANGS;count++)
  697. {
  698. format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
  699. if(dini_Exists(fileZ))
  700. {
  701. if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID])
  702. {
  703. if(listitem == 0) // Rank 1
  704. {
  705. assign[playerid] = 1;
  706. format(fileZ, sizeof(fileZ), "Please Choose a name for Members Rank 1.");
  707. ShowPlayerDialog(playerid, DIALOGID_GANGCREATE5, DIALOG_STYLE_INPUT, "Rank 1 -name", fileZ, "Change", "exit");
  708. }
  709. if(listitem == 1) // Rank 2
  710. {
  711. assign[playerid] = 2;
  712. format(fileZ, sizeof(fileZ), "Please Choose a name for Members Rank 2.");
  713. ShowPlayerDialog(playerid, DIALOGID_GANGCREATE5, DIALOG_STYLE_INPUT, "Rank 2 -name", fileZ, "Change", "exit");
  714. }
  715. if(listitem == 2) // Rank 3
  716. {
  717. assign[playerid] = 3;
  718. format(fileZ, sizeof(fileZ), "Please Choose a name for Members Rank 3.");
  719. ShowPlayerDialog(playerid, DIALOGID_GANGCREATE5, DIALOG_STYLE_INPUT, "Rank 3 -name", fileZ, "Change", "exit");
  720. }
  721. if(listitem == 3) // Rank 4
  722. {
  723. assign[playerid] = 4;
  724. format(fileZ, sizeof(fileZ), "Please Choose a name for Members Rank 4.");
  725. ShowPlayerDialog(playerid, DIALOGID_GANGCREATE5, DIALOG_STYLE_INPUT, "Rank 4 -name", fileZ, "Change", "exit");
  726. }
  727. if(listitem == 4) // Rank 5
  728. {
  729. assign[playerid] = 5;
  730. format(fileZ, sizeof(fileZ), "Please Choose a name for Leader Rank 5.");
  731. ShowPlayerDialog(playerid, DIALOGID_GANGCREATE5, DIALOG_STYLE_INPUT, "Rank 5 -name", fileZ, "Change", "exit");
  732. }
  733. }
  734. }
  735. }
  736. }
  737. }
  738. if(dialogid == DIALOGID_GANGCREATE5)
  739. {
  740. if(response == 1)
  741. {
  742. for(new count = 20;count<MAX_GANGS;count++)
  743. {
  744. format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
  745. if(dini_Exists(fileZ))
  746. {
  747. if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID])
  748. {
  749. if(assign[playerid] == 1)
  750. {
  751. dini_Set(fileZ,"Gang_Rank1",inputtext);
  752. assign[playerid] = 0;
  753. format(fileZ, sizeof(fileZ), "íîâî ðàíê èìå : %s",inputtext);
  754. SendClientMessage(playerid, GREEN,fileZ);
  755. }
  756. if(assign[playerid] == 2)
  757. {
  758. dini_Set(fileZ,"Gang_Rank2",inputtext);
  759. assign[playerid] = 0;
  760. format(fileZ, sizeof(fileZ), "íîâî ðàíê èìå : %s",inputtext);
  761. SendClientMessage(playerid, GREEN,fileZ);
  762. }
  763. if(assign[playerid] == 3)
  764. {
  765. dini_Set(fileZ,"Gang_Rank3",inputtext);
  766. assign[playerid] = 0;
  767. format(fileZ, sizeof(fileZ), "íîâî ðàíê èìå : %s",inputtext);
  768. SendClientMessage(playerid, GREEN,fileZ);
  769. }
  770. if(assign[playerid] == 4)
  771. {
  772. dini_Set(fileZ,"Gang_Rank4",inputtext);
  773. assign[playerid] = 0;
  774. format(fileZ, sizeof(fileZ), "íîâî ðàíê èìå : %s",inputtext);
  775. SendClientMessage(playerid, GREEN,fileZ);
  776. }
  777. if(assign[playerid] == 5)
  778. {
  779. dini_Set(fileZ,"Gang_Rank5",inputtext);
  780. assign[playerid] = 0;
  781. format(fileZ, sizeof(fileZ), "íîâî ðàíê èìå : %s",inputtext);
  782. SendClientMessage(playerid, GREEN,fileZ);
  783. }
  784. }
  785. }
  786. }
  787. }
  788. }
  789. return 1;
  790. }
  791.  
  792. //==================================================//
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800. //======== STOCKS ========//
  801.  
  802.  
  803.  
  804.  
  805. stock Names(playerid)
  806. {
  807. new pname[MAX_PLAYER_NAME];
  808. GetPlayerName(playerid,pname,sizeof(pname));
  809. return pname;
  810. }
  811.  
  812.  
  813.  
  814.  
  815.  
  816. stock ini_GetKey( line[] )
  817. {
  818. new keyRes[256];
  819. keyRes[0] = 0;
  820. if ( strfind( line , "=" , true ) == -1 ) return keyRes;
  821. strmid( keyRes , line , 0 , strfind( line , "=" , true ) , sizeof( keyRes) );
  822. return keyRes;
  823. }
  824.  
  825.  
  826.  
  827. stock ini_GetValue( line[] )
  828. {
  829. new valRes[256];
  830. valRes[0]=0;
  831. if ( strfind( line , "=" , true ) == -1 ) return valRes;
  832. strmid( valRes , line , strfind( line , "=" , true )+1 , strlen( line ) , sizeof( valRes ) );
  833. return valRes;
  834. }
  835.  
  836.  
  837.  
  838. strtok(const string[], &index)
  839. {
  840. new length = strlen(string);
  841. while ((index < length) && (string[index] <= ' '))
  842. {
  843. index++;
  844. }
  845.  
  846. new offset = index;
  847. new result[20];
  848. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  849. {
  850. result[index - offset] = string[index];
  851. index++;
  852. }
  853. result[index - offset] = EOS;
  854. return result;
  855. }
  856.  
  857.  
  858. //------------------------------- END ----------------------------------------//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement