Guest User

Untitled

a guest
Jul 21st, 2010
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.06 KB | None | 0 0
  1. //=======================>>Sytem de Creat Gang<<==================//
  2. //===== Creat de Tre si tradus tot de Tre =====//
  3. //===================>>http://forumsa-mp.forumhit.ro/index.htm<<==============//
  4. //===================>>Va rog nu stergeti Creditele<<=============//
  5. #include <a_samp>
  6.  
  7.  
  8. #define FILTERSCRIPT
  9.  
  10. #if defined FILTERSCRIPT
  11. forward PlayerLeaveGang(playerid);
  12. #define COLOR_ORANGERED 0xE9370DFC
  13. #define COLOR_GOLD 0xDEAD4370
  14. #define COLOR_MEDIUMAQUA 0x83BFBFFF
  15. #define COLOR_BLUE 0x0000FFAA
  16. #define COLOR_GREY 0xAFAFAFAA
  17. #define COLOR_GREEN 0x33AA33AA
  18. #define COLOR_YELLOW 0xFFFF00AA
  19. #define COLOR_WHITE 0xFFFFFFAA
  20. #define COLOR_PURPLE 0x9900FFAA
  21. #define COLOR_BROWN 0x993300AA
  22. #define COLOR_ORANGE 0xFF9933AA
  23. #define COLOR_CYAN 0x99FFFFAA
  24. #define COLOR_TAN 0xFFFFCCAA
  25. #define COLOR_PINK 0xFF66FFAA
  26. #define COLOR_KHAKI 0x999900AA
  27. #define COLOR_LIME 0x99FF00AA
  28. #define COLOR_BLACK 0x000000AA
  29. #define COLOR_TURQ 0x00A3C0AA
  30. #define COLOR_LIGHTBLUE 0x00BFFFAA
  31. #define COLOR_GREENISHGOLD 0xCCFFDD56
  32. #define COLOR_LIGHTBLUEGREEN 0x0FFDD349
  33. #define COLOR_LIGHTCYAN 0xAAFFCC33
  34. #define COLOR_LEMON 0xDDDD2357
  35. #define COLOR_LIGHTGREEN 0x7CFC00AA
  36. #define COLOR_WHITEYELLOW 0xFFE87DAA
  37. #define COLOR_BLUEAQUA 0x7E60FFAA
  38. #define COLOR_GREENYELLOWWHITE 0xCBFF45AA
  39. #define COLOR_DARKBLUE 0x15005EAA
  40. #define COLOR_RED 0xAA3333AA
  41. #define COLOR_LIGHTRED 0xFF0000AA
  42. #define NUMVALUES 4
  43.  
  44. new playerColors[100] = {
  45. 0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF,0x6495EDFF,0xf0e68cFF,0x778899FF,0xFF1493FF,0xF4A460FF,0xEE82EEFF,0xFFD720FF,
  46. 0x8b4513FF,0x4949A0FF,0x148b8bFF,0x14ff7fFF,0x556b2fFF,0x0FD9FAFF,0x10DC29FF,0x534081FF,0x0495CDFF,0xEF6CE8FF,0xBD34DAFF,
  47. 0x247C1BFF,0x0C8E5DFF,0x635B03FF,0xCB7ED3FF,0x65ADEBFF,0x5C1ACCFF,0xF2F853FF,0x11F891FF,0x7B39AAFF,0x53EB10FF,0x54137DFF,
  48. 0x275222FF,0xF09F5BFF,0x3D0A4FFF,0x22F767FF,0xD63034FF,0x9A6980FF,0xDFB935FF,0x3793FAFF,0x90239DFF,0xE9AB2FFF,0xAF2FF3FF,
  49. 0x057F94FF,0xB98519FF,0x388EEAFF,0x028151FF,0xA55043FF,0x0DE018FF,0x93AB1CFF,0x95BAF0FF,0x369976FF,0x18F71FFF,0x4B8987FF,
  50. 0x491B9EFF,0x829DC7FF,0xBCE635FF,0xCEA6DFFF,0x20D4ADFF,0x2D74FDFF,0x3C1C0DFF,0x12D6D4FF,0x48C000FF,0x2A51E2FF,0xE3AC12FF,
  51. 0xFC42A8FF,0x2FC827FF,0x1A30BFFF,0xB740C2FF,0x42ACF5FF,0x2FD9DEFF,0xFAFB71FF,0x05D1CDFF,0xC471BDFF,0x94436EFF,0xC1F7ECFF,
  52. 0xCE79EEFF,0xBD1EF2FF,0x93B7E4FF,0x3214AAFF,0x184D3BFF,0xAE4B99FF,0x7E49D7FF,0x4C436EFF,0xFA24CCFF,0xCE76BEFF,0xA04E0AFF,
  53. 0x9F945CFF,0xDCDE3DFF,0x10C9C5FF,0x70524DFF,0x0BE472FF,0x8A2CD7FF,0x6152C2FF,0xCF72A9FF,0xE59338FF,0xEEDC2DFF,0xD8C762FF,
  54. 0x3FE65CFF
  55. };
  56.  
  57. #define MAX_GANGS 32
  58. #define MAX_GANG_MEMBERS 20
  59. #define MAX_GANG_NAME 30
  60. new gangMembers[MAX_GANGS][MAX_GANG_MEMBERS];
  61. new gangNames[MAX_GANGS][MAX_GANG_NAME];
  62. new gangInfo[MAX_GANGS][3];
  63. new gangBank[MAX_GANGS];
  64. new playerGang[MAX_PLAYERS];
  65. new gangInvite[MAX_PLAYERS];
  66.  
  67.  
  68.  
  69. public OnFilterScriptInit()
  70. {
  71. print("==========================");
  72. print(" Gang Create by Tre ");
  73. print("==========================");
  74. return 1;
  75. }
  76.  
  77. public OnFilterScriptExit()
  78. {
  79. return 1;
  80. }
  81.  
  82. #endif
  83.  
  84. public OnPlayerText(playerid, text[])
  85. {
  86. if(text[0] == '!') {
  87. if(playerGang[playerid] > 0) {
  88. new gangChat[256];
  89. new senderName[MAX_PLAYER_NAME];
  90. new string[256];
  91.  
  92. strmid(gangChat,text,1,strlen(text));
  93.  
  94. GetPlayerName(playerid, senderName, sizeof(senderName));
  95. format(string, sizeof(string),"[GANG %s:] %s", senderName, gangChat);
  96.  
  97. for(new i = 0; i < gangInfo[playerGang[playerid]][1]; i++) {
  98. SendClientMessage(gangMembers[playerGang[playerid]][i], COLOR_LIGHTBLUE, string);
  99. }
  100. }
  101.  
  102. return 0;
  103. }
  104. return 1;
  105. }
  106.  
  107. public OnPlayerConnect(playerid)
  108. {
  109. playerGang[playerid]=0;
  110. gangInvite[playerid]=0;
  111. return 1;
  112. }
  113.  
  114. public OnPlayerDisconnect(playerid, reason)
  115. {
  116. PlayerLeaveGang(playerid);
  117. return 1;
  118. }
  119.  
  120. public OnPlayerCommandText(playerid, cmdtext[])
  121. {
  122. new string[256];
  123. new sendername[MAX_PLAYER_NAME];
  124. new giveplayer[MAX_PLAYER_NAME];
  125. new cmd[256];
  126. new giveplayerid,idx;
  127.  
  128. cmd = strtok(cmdtext, idx);
  129.  
  130. if(strcmp(cmd, "/ganghelp", true) == 0) {
  131. SendClientMessage(playerid, COLOR_YELLOW,"/gang creaza [Nnume]");
  132. SendClientMessage(playerid, COLOR_YELLOW,"/gang intra");
  133. SendClientMessage(playerid, COLOR_YELLOW,"/gang invita [JucatorId]");
  134. SendClientMessage(playerid, COLOR_YELLOW,"/gang abandoneaza");
  135. SendClientMessage(playerid, COLOR_YELLOW,"/ganginfo [GascaId]");
  136. SendClientMessage(playerid, COLOR_YELLOW,"! [Text] Gasca Cutie de vorbit");
  137. return 1;
  138. }
  139.  
  140.  
  141. //------------------- gasca
  142.  
  143. if(strcmp(cmd, "/gang", true) == 0) {
  144. new tmp[256];
  145. new gangcmd, gangnum;
  146. tmp = strtok(cmdtext, idx);
  147.  
  148. if(!strlen(tmp)) {
  149. SendClientMessage(playerid, 0x83BFBFFF, "Scrie /ganghelp pentru detalii .");
  150. return 1;
  151. }
  152. giveplayerid = strval(tmp);
  153.  
  154. if(strcmp(tmp, "creaza", true)==0)
  155. gangcmd = 1;
  156. else if(strcmp(tmp, "invita", true)==0)
  157. gangcmd = 2;
  158. else if(strcmp(tmp, "intra", true)==0)
  159. gangcmd = 3;
  160. else if(strcmp(tmp, "abandoneaza", true)==0)
  161. gangcmd = 4;
  162.  
  163. tmp = strtok(cmdtext, idx);
  164. if(gangcmd < 3 && !strlen(tmp)) {
  165. if(gangcmd==0)
  166. SendClientMessage(playerid, 0x83BFBFFF, "Scrie /ganghelp pentru detalii.");
  167. else if(gangcmd==1)
  168. SendClientMessage(playerid, 0x83BFBFFF, "Scrie: /gang creaaza [Nume]");
  169. else if(gangcmd==2)
  170. SendClientMessage(playerid, 0x83BFBFFF, "Scrie: /gang invita [JucatorId]");
  171. return 1;
  172. }
  173.  
  174. //Creaza//
  175. if(gangcmd==1) {
  176. if(playerGang[playerid]>0) {
  177. SendClientMessage(playerid, 0x83BFBFFF, "Esti deja intr-o gasca!");
  178. return 1;
  179. }
  180.  
  181. for(new i = 1; i < MAX_GANGS; i++) {
  182. if(gangInfo[i][0]==0) {
  183. //Nume Gasca
  184. format(gangNames[i], MAX_GANG_NAME, "%s", tmp);
  185. //Gasca exixtenta
  186. gangInfo[i][0]=1;
  187. //E doar un membru
  188. gangInfo[i][1]=1;
  189. //Culoare Gastii e culoare Jucatorului
  190. gangInfo[i][2]=playerColors[playerid];
  191.  
  192. //Jucatorul e primul membru
  193. gangMembers[i][0] = playerid;
  194. format(string, sizeof(string),"Ai creat Gasca '%s' (ID: %d)", gangNames[i], i);
  195. SendClientMessage(playerid, 0x83BFBFFF, string);
  196.  
  197. playerGang[playerid]=i;
  198.  
  199. return 1;
  200. }
  201. }
  202.  
  203. return 1;
  204.  
  205. //Intra Gasca//
  206. } else if (gangcmd==3) {
  207. gangnum = gangInvite[playerid];
  208.  
  209. if(playerGang[playerid]>0) {
  210. SendClientMessage(playerid, 0x83BFBFFF, "Esti deja intr-o gasca.");
  211. return 1;
  212. }
  213. if(gangInvite[playerid]==0) {
  214. SendClientMessage(playerid, 0x83BFBFFF, "Nu esti invitat intr-o Gasca.");
  215. return 1;
  216. }
  217. if(gangInfo[gangnum][0]==0) {
  218. SendClientMessage(playerid, 0x83BFBFFF, "Gasca nu exixta.");
  219. return 1;
  220. }
  221.  
  222. if(gangInfo[gangnum][1] < MAX_GANG_MEMBERS) {
  223. new i = gangInfo[gangnum][1];
  224.  
  225. gangInvite[playerid]=0;
  226.  
  227. gangMembers[gangnum][i] = playerid;
  228.  
  229. GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
  230. for(new j = 0; j < gangInfo[gangnum][1]; j++) {
  231. format(string, sizeof(string),"%s a intrat in gasca.Salutatil pe %s si ajutatil sa se acomodeze.", sendername);
  232. SendClientMessage(gangMembers[gangnum][j], COLOR_ORANGE, string);
  233. }
  234.  
  235. gangInfo[gangnum][1]++;
  236. playerGang[playerid] = gangnum;
  237.  
  238. SetPlayerColor(playerid,gangInfo[gangnum][2]);
  239.  
  240. format(string, sizeof(string),"Ai intrat in gasca '%s'(id: %d)", gangNames[gangnum], gangnum);
  241. SendClientMessage(playerid, 0x83BFBFFF, string);
  242.  
  243. return 1;
  244. }
  245.  
  246. SendClientMessage(playerid, 0x83BFBFFF, "Nici un membru gasit");
  247. return 1;
  248.  
  249. //Invitatie//
  250. } else if (gangcmd==2) {
  251. giveplayerid = strval(tmp);
  252.  
  253. if(playerGang[playerid]==0) {
  254. SendClientMessage(playerid, 0x83BFBFFF, "Nu esti in Gasca.");
  255. return 1;
  256. }
  257. // if(gangMembers[playerGang[playerid]][0]!=playerid) {
  258. // SendClientMessage(playerid, COLOR_RED, "Trebuie sa fii liderul gastii sa inviti.");
  259. // return 1;
  260. // }
  261.  
  262. if(IsPlayerConnected(giveplayerid)) {
  263. GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
  264. GetPlayerName(playerid, sendername, sizeof(sendername));
  265.  
  266. format(string, sizeof(string),"L-ai invitat pe %s in gasca ta.", giveplayer);
  267. SendClientMessage(playerid, 0x83BFBFFF, string);
  268. format(string, sizeof(string),"Ai primit o invitatie de la %s in gasca lui '%s' (id: %d)", sendername, gangNames[playerGang[playerid]],playerGang[playerid]);
  269. SendClientMessage(giveplayerid, 0x83BFBFFF, string);
  270.  
  271. gangInvite[giveplayerid]=playerGang[playerid];
  272.  
  273. } else
  274. SendClientMessage(playerid, 0x83BFBFFF, "Acel membru nu exista!");
  275.  
  276. //Paraseste//
  277. } else if (gangcmd==4) {
  278. PlayerLeaveGang(playerid);
  279. }
  280.  
  281. return 1;
  282. }
  283.  
  284. //------------------- /ganginfo
  285.  
  286. if(strcmp(cmd, "/ganginfo", true) == 0) {
  287. new tmp[256];
  288. new gangnum;
  289. tmp = strtok(cmdtext, idx);
  290.  
  291. if(!strlen(tmp) && playerGang[playerid]==0) {
  292. SendClientMessage(playerid, 0x83BFBFFF, "Scrie: /ganginfo [GascaID]");
  293. return 1;
  294. } else if (!strlen(tmp))
  295. gangnum = playerGang[playerid];
  296. else
  297. gangnum = strval(tmp);
  298.  
  299. if(gangInfo[gangnum][0]==0) {
  300. SendClientMessage(playerid, 0x83BFBFFF, "Nu exista aceasta GascaId!");
  301. return 1;
  302. }
  303.  
  304. format(string, sizeof(string),"'%s' Membrii Gastii (id: %d)", gangNames[gangnum], gangnum);
  305. SendClientMessage(playerid, 0x83BFBFFF, string);
  306.  
  307. for(new i = 0; i < gangInfo[gangnum][1]; i++) {
  308. GetPlayerName(gangMembers[gangnum][i], giveplayer, sizeof(giveplayer));
  309. format(string, sizeof(string),"%s (%d)", giveplayer, gangMembers[gangnum][i]);
  310. SendClientMessage(playerid, 0x83BFBFFF, string);
  311. }
  312.  
  313. return 1;
  314. }
  315.  
  316. //------------------- /gangs
  317.  
  318. if(strcmp(cmd, "/gangs", true) == 0)
  319. {
  320. new x;
  321.  
  322. SendClientMessage(playerid, 0x83BFBFFF, "Gasti Exixtente:");
  323. for(new i=0; i < MAX_GANGS; i++) {
  324. if(gangInfo[i][0]==1) {
  325. format(string, sizeof(string), "%s%s(%d) - %d membri", string,gangNames[i],i,gangInfo[i][1]);
  326.  
  327. x++;
  328. if(x > 2) {
  329. SendClientMessage(playerid, 0x83BFBFFF, string);
  330. x = 0;
  331. format(string, sizeof(string), "");
  332. } else {
  333. format(string, sizeof(string), "%s, ", string);
  334. }
  335. }
  336. }
  337.  
  338. if(x <= 2 && x > 0) {
  339. string[strlen(string)-2] = '.';
  340. SendClientMessage(playerid, 0x83BFBFFF, string);
  341. }
  342.  
  343. return 1;
  344. }
  345. return 0;
  346. }
  347.  
  348. stock PlayerName(playerid) {
  349. new name[255];
  350. GetPlayerName(playerid, name, 255);
  351. return name;
  352. }
  353.  
  354. public PlayerLeaveGang(playerid) {
  355. new string[256];
  356. new playername[MAX_PLAYER_NAME];
  357. new gangnum = playerGang[playerid];
  358.  
  359. if(gangnum > 0) {
  360. for(new i = 0; i < gangInfo[gangnum][1]; i++) {
  361. if(gangMembers[gangnum][i]==playerid) {
  362.  
  363. //Doar un membru
  364. gangInfo[gangnum][1]--;
  365.  
  366. for(new j = i; j < gangInfo[gangnum][1]; j++) {
  367. //Shift banda de membri
  368. gangMembers[gangnum][j]=gangMembers[gangnum][j+1];
  369. }
  370.  
  371. //Distruge Gasca daca nu sunt membri
  372. if(gangInfo[gangnum][1]<1) {
  373. gangInfo[gangnum][0]=0;
  374. gangInfo[gangnum][1]=0;
  375. gangBank[gangnum]=0;
  376. }
  377.  
  378. //Avertizare membri
  379. for(new j = 0; j < gangInfo[gangnum][1]; j++) {
  380. GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
  381. format(string, sizeof(string),"%s a parasit gasca ta!", playername);
  382. SendClientMessage(gangMembers[gangnum][j], COLOR_ORANGE, string);
  383. }
  384.  
  385. format(string, sizeof(string),"Ai parasit gasca '%s'(id: %d)", gangNames[gangnum], gangnum);
  386. SendClientMessage(playerid, 0x83BFBFFF, string);
  387.  
  388. playerGang[playerid]=0;
  389.  
  390. SetPlayerColor(playerid,playerColors[playerid]);
  391.  
  392. return;
  393. }
  394. }
  395. } else {
  396. SendClientMessage(playerid, 0x83BFBFFF, "Nu esti intr=o gasca.");
  397. }
  398. }
  399.  
  400. strtok(const string[], &index)
  401. {
  402. new length = strlen(string);
  403. while ((index < length) && (string[index] <= ' '))
  404. {
  405. index++;
  406. }
  407.  
  408. new offset = index;
  409. new result[20];
  410. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  411. {
  412. result[index - offset] = string[index];
  413. index++;
  414. }
  415. result[index - offset] = EOS;
  416. return result;
  417. }
Advertisement
Add Comment
Please, Sign In to add comment