Advertisement
Blackevils

Untitled

Apr 27th, 2020
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.52 KB | None | 0 0
  1. #define FILTERSCRIPT
  2. #include <a_samp>
  3. #include <zcmd>
  4. #include <sscanf2>
  5. #include <dini>
  6.  
  7. enum dData
  8. {
  9. Gangid,
  10. Gangrank
  11. }
  12. new PlayerInfo[MAX_PLAYERS][dData];
  13. #define PlayerFile "playergang/%s.ini"
  14. #define MAX_GANGS 3
  15.  
  16. enum gData
  17. {
  18. Ganggp
  19. }
  20. new GangInfo[MAX_PLAYERS][gData];
  21. #define GangsFile "Gangsgp.ini"
  22.  
  23. #define COLOR_RED 0xFF0000FF
  24.  
  25. //gangzone
  26. new Zone1;
  27. new capture1 = 1;
  28. new capture1start = 0;
  29. new Zone2;
  30. new capture2 = 2;
  31. new capture2start = 0;
  32. new Zone3;
  33. new capture3 = 3;
  34. new capture3start = 0;
  35.  
  36. public OnFilterScriptInit()
  37. {
  38. new file2[256], id;
  39. format(file2,sizeof(file2),GangsFile);
  40. GangInfo[id][Ganggp] = dini_Int(file2, "Ganggp");
  41. //GANGS CAPTURE PICKUP
  42. CreatePickup(1314 , 1, 1493.9996, 751.0131, 29.6638, -1);//GANG1
  43. CreatePickup(1314 , 1, 1089.1531, 1073.2957, 11.3150, -1);//GANG2
  44. CreatePickup(1314 , 1, 983.0714, 1733.2091, 9.3417, -1);//GANG3
  45. //GANGS CAPTURE ZONES
  46. Zone1 = GangZoneCreate(1310.488, 645.488, 1560.399, 823.4191);//zone GANG 1
  47. Zone2 = GangZoneCreate(923.9085, 951.0652, 1181.628, 1198.621);//zone GANG 2
  48. Zone3 = GangZoneCreate(857.5261, 1616.373, 994.1957, 1863.929);//zone GANG 3
  49. return 1;
  50. }
  51.  
  52. public OnFilterScriptExit()
  53. {
  54. return 1;
  55. }
  56.  
  57. public OnPlayerConnect(playerid)
  58. {
  59. new file[256], name[MAX_PLAYER_NAME];
  60. GetPlayerName(playerid,name,sizeof(name));
  61. format(file,sizeof(file),PlayerFile,name);
  62. if(!dini_Exists(file) )
  63. {
  64. dini_Create(file);
  65. dini_Set(file,"Name",name);
  66. dini_IntSet(file,"Gangid",0);
  67. PlayerInfo[playerid][Gangid] = 0;
  68. PlayerInfo[playerid][Gangrank] = 0;
  69. }
  70. else
  71. {
  72. PlayerInfo[playerid][Gangid] = dini_Int(file,"Gangid");
  73. PlayerInfo[playerid][Gangrank] = dini_Int(file,"Gangrank");
  74. new file2[256];
  75. format(file2,sizeof(file2),GangsFile);
  76. dini_IntSet(file2,"Ganggp",GangInfo[playerid][Ganggp]);
  77. GangInfo[playerid][Ganggp] = dini_Int(file2, "Ganggp");
  78. }
  79. return 1;
  80. }
  81.  
  82. public OnPlayerDisconnect(playerid, reason)
  83. {
  84. new file[256], name[MAX_PLAYER_NAME];
  85. GetPlayerName(playerid,name,sizeof(name));
  86. format(file,sizeof(file),PlayerFile,name);
  87. if(dini_Exists(file) )
  88. {
  89. dini_IntSet(file,"Gangid",PlayerInfo[playerid][Gangid]);
  90. dini_IntSet(file,"Gangrank",PlayerInfo[playerid][Gangrank]);
  91. }
  92. new file2[256];
  93. format(file2,sizeof(file2),GangsFile);
  94. dini_IntSet(file2,"Ganggp",GangInfo[playerid][Ganggp]);
  95. return 1;
  96. }
  97.  
  98. CMD:setgangid(playerid,params[])
  99. {
  100. new id, level;
  101. if(!IsPlayerAdmin(playerid) ) return SendClientMessage(playerid,COLOR_RED,"You are not an admin!");
  102. if(sscanf(params,"ud",id,level) ) return SendClientMessage(playerid,COLOR_RED,"USUAGE: /setgangid [id][gangid]");
  103. if(level > MAX_GANGS) return SendClientMessage(playerid,COLOR_RED,"Invalid Level");
  104. if(!IsPlayerConnected(id) ) return SendClientMessage(playerid,COLOR_RED,"Player is not connected");
  105. else
  106. {
  107. PlayerInfo[id][Gangid] = level;
  108. SpawnPlayer(id);
  109. }
  110. return 1;
  111. }
  112.  
  113. public OnPlayerSpawn(playerid)
  114. {
  115. if(PlayerInfo[playerid][Gangid] == 0)
  116. {
  117. SetPlayerPos(playerid,1509.4786,-1707.0342,14.0469); // ls
  118. }
  119. if(PlayerInfo[playerid][Gangid] == 1)
  120. {
  121. SetPlayerPos(playerid, 1489.5876, 691.9392, 11.9275);
  122. }
  123. if(PlayerInfo[playerid][Gangid] == 2)
  124. {
  125. SetPlayerPos(playerid, 1046.1687, 1014.2678, 11.7839);
  126. }
  127. if(PlayerInfo[playerid][Gangid] == 3)
  128. {
  129. SetPlayerPos(playerid, 938.0714, 1733.2091, 9.3417);
  130. }
  131. //GANGZONES
  132. if(capture1 == 1) GangZoneShowForAll(Zone1,0xFF000096);
  133. if(capture1 == 2) GangZoneShowForAll(Zone1,0xFFFFFF96);
  134. if(capture1 == 3) GangZoneShowForAll(Zone1,0xFFFF009A);
  135. //
  136. if(capture2 == 1) GangZoneShowForAll(Zone2,0xFF000096);//0xFF000096 ROSSO
  137. if(capture2 == 2) GangZoneShowForAll(Zone2,0xFFFFFF96);//0xFFFFFF96 BIANCO
  138. if(capture2 == 3) GangZoneShowForAll(Zone2,0xFFFF009A);//0xFFFF009A GIALLO
  139. //
  140. if(capture3 == 1) GangZoneShowForAll(Zone3,0xFF000096);
  141. if(capture3 == 2) GangZoneShowForAll(Zone3,0xFFFFFF96);
  142. if(capture3 == 3) GangZoneShowForAll(Zone3,0xFFFF009A);
  143. return 1;
  144. }
  145.  
  146. CMD:capture(playerid, params[])
  147. {
  148. ///////////////////////////////capture 1
  149. if(PlayerInfo[playerid][Gangid] == 0) return SendClientMessage(playerid, 0xff0000ff, "ERROR: You must be in a gang for use this command.");
  150. if (IsPlayerInRangeOfPoint(playerid, 5.0, 1493.9996, 751.0131, 29.6638))
  151. {
  152. if(capture1start >= 1) return SendClientMessage(playerid, -1,"You can't capture this territory because someone already started a /capture!");
  153. if(PlayerInfo[playerid][Gangid] == 1)
  154. {
  155. if(capture1 == 1) return SendClientMessage(playerid, -1,"Your gang already own this territory!");
  156. SetTimerEx("EndAntiSpawnKill", 15000, false, "i", playerid);
  157. GangZoneFlashForAll(Zone1,0xFF000096);
  158. capture1start = 1;
  159. }
  160. if(PlayerInfo[playerid][Gangid] == 2)
  161. {
  162. if(capture1 == 2) return SendClientMessage(playerid, -1,"Your gang already own this territory!");
  163. SetTimerEx("EndAntiSpawnKill", 15000, false, "i", playerid);
  164. GangZoneFlashForAll(Zone1,0xFFFFFF96);
  165. capture1start = 2;
  166. }
  167. if(PlayerInfo[playerid][Gangid] == 3)
  168. {
  169. if(capture1 == 3) return SendClientMessage(playerid, -1,"Your gang already own this territory!");
  170. SetTimerEx("EndAntiSpawnKill", 15000, false, "i", playerid);
  171. GangZoneFlashForAll(Zone1,0xFFFF009A);
  172. capture1start = 3;
  173. }
  174. }
  175. ///////////////////////////////capture 2
  176. if (IsPlayerInRangeOfPoint(playerid, 5.0, 1089.1531, 1073.2957, 11.3150))
  177. {
  178. if(capture2start >= 1) return SendClientMessage(playerid, -1,"You can't capture this territory because someone already started a /capture!");
  179. if(PlayerInfo[playerid][Gangid] == 1)
  180. {
  181. if(capture2 == 1) return SendClientMessage(playerid, -1,"Your gang already own this territory!");
  182. SetTimerEx("EndAntiSpawnKill", 15000, false, "i", playerid);
  183. GangZoneFlashForAll(Zone2,0xFF000096);
  184. capture2start = 1;
  185. }
  186. if(PlayerInfo[playerid][Gangid] == 2)
  187. {
  188. if(capture2 == 2) return SendClientMessage(playerid, -1,"Your gang already own this territory!");
  189. SetTimerEx("EndAntiSpawnKill", 15000, false, "i", playerid);
  190. GangZoneFlashForAll(Zone2,0xFFFFFF96);
  191. capture2start = 2;
  192. }
  193. if(PlayerInfo[playerid][Gangid] == 3)
  194. {
  195. if(capture2 == 3) return SendClientMessage(playerid, -1,"Your gang already own this territory!");
  196. SetTimerEx("EndAntiSpawnKill", 15000, false, "i", playerid);
  197. GangZoneFlashForAll(Zone2,0xFFFF009A);
  198. capture2start = 3;
  199. }
  200. }
  201. //////////////////////capture 3
  202. if (IsPlayerInRangeOfPoint(playerid, 5.0, 983.0714, 1733.2091, 9.3417))
  203. {
  204. if(capture3start >= 1) return SendClientMessage(playerid, -1,"You can't capture this territory because someone already started a /capture!");
  205. if(PlayerInfo[playerid][Gangid] == 1)
  206. {
  207. if(capture3 == 1) return SendClientMessage(playerid, -1,"Your gang already own this territory!");
  208. SetTimerEx("EndAntiSpawnKill", 15000, false, "i", playerid);
  209. GangZoneFlashForAll(Zone3,0xFF000096);
  210. capture3start = 1;
  211. }
  212. if(PlayerInfo[playerid][Gangid] == 2)
  213. {
  214. if(capture3 == 2) return SendClientMessage(playerid, -1,"Your gang already own this territory!");
  215. SetTimerEx("EndAntiSpawnKill", 15000, false, "i", playerid);
  216. GangZoneFlashForAll(Zone3,0xFFFFFF96);
  217. capture3start = 2;
  218. }
  219. if(PlayerInfo[playerid][Gangid] == 3)
  220. {
  221. if(capture3 == 3) return SendClientMessage(playerid, -1,"Your gang already own this territory!");
  222. SetTimerEx("EndAntiSpawnKill", 15000, false, "i", playerid);
  223. GangZoneFlashForAll(Zone3,0xFFFF009A);
  224. capture3start = 3;
  225. }
  226. }
  227. return 1;
  228. }
  229.  
  230. forward EndAntiSpawnKill(playerid);
  231.  
  232. public EndAntiSpawnKill(playerid)
  233. { ///////////////////////////////capture 1
  234. if (IsPlayerInRangeOfPoint(playerid, 5.0, 1493.9996, 751.0131, 29.6638))
  235. { //return SendClientMessage(playerid, -1,"You need to stay max 5metres from the capture checkpoint.!");
  236. if(PlayerInfo[playerid][Gangid] == 1)
  237. {
  238. GangZoneStopFlashForAll(Zone1);
  239. GangZoneShowForAll(Zone1,0xFF000096);
  240. capture1 = 1;
  241. capture1start =0;
  242. }
  243. if(PlayerInfo[playerid][Gangid] == 2)
  244. {
  245. GangZoneStopFlashForAll(Zone1);
  246. GangZoneShowForAll(Zone1,0xFFFFFF96);
  247. capture1 = 2;
  248. capture1start =0;
  249. }
  250. if(PlayerInfo[playerid][Gangid] == 3)
  251. {
  252. GangZoneStopFlashForAll(Zone1);
  253. GangZoneShowForAll(Zone1,0xFFFF009A);
  254. capture1 = 3;
  255. capture1start =0;
  256. }
  257. }
  258. else
  259. if(capture1start >= 1)
  260. {
  261. if(!IsPlayerInRangeOfPoint(playerid, 5.0, 1493.9996, 751.0131, 29.6638))
  262. {
  263. SendClientMessage(playerid, -1,"You need to stay max 5metres from the capture checkpoint.!");
  264. GangZoneStopFlashForAll(Zone1);
  265. if(capture1start == 1 && capture1 == 1) return capture1 = 1;
  266. if(capture1start == 1 && capture1 == 2) return capture1 = 2;
  267. if(capture1start == 1 && capture1 == 3) return capture1 = 3;
  268. if(capture1start == 2 && capture1 == 1) return capture1 = 1;
  269. if(capture1start == 2 && capture1 == 2) return capture1 = 2;
  270. if(capture1start == 2 && capture1 == 3) return capture1 = 3;
  271. if(capture1start == 3 && capture1 == 1) return capture1 = 1;
  272. if(capture1start == 3 && capture1 == 2) return capture1 = 2;
  273. if(capture1start == 3 && capture1 == 3) return capture1 = 3;
  274. }
  275. }
  276. //}
  277. ///////////////////////////////capture 2
  278. //if(capture2 >= 4)
  279. if (IsPlayerInRangeOfPoint(playerid, 5.0, 1089.1531, 1073.2957, 11.3150))
  280. { //return SendClientMessage(playerid, -1,"You need to stay max 5metres from the capture checkpoint.!");
  281. if(PlayerInfo[playerid][Gangid] == 1)
  282. {
  283. GangZoneStopFlashForAll(Zone2);
  284. GangZoneShowForAll(Zone2,0xFF000096);
  285. capture2 = 1;
  286. capture2start =0;
  287. }
  288. if(PlayerInfo[playerid][Gangid] == 2)
  289. {
  290. GangZoneStopFlashForAll(Zone2);
  291. GangZoneShowForAll(Zone2,0xFFFFFF96);
  292. capture2 = 2;
  293. capture2start =0;
  294. }
  295. if(PlayerInfo[playerid][Gangid] == 3)
  296. {
  297. GangZoneStopFlashForAll(Zone2);
  298. GangZoneShowForAll(Zone2,0xFFFF009A);
  299. capture2 = 3;
  300. capture2start =0;
  301. }
  302. }
  303. else
  304. if(capture2start >= 1)
  305. {
  306. if(!IsPlayerInRangeOfPoint(playerid, 5.0, 1089.1531, 1073.2957, 11.3150))
  307. {
  308. SendClientMessage(playerid, -1,"You need to stay max 5metres from the capture checkpoint.!");
  309. GangZoneStopFlashForAll(Zone2);
  310. capture2start = 0;
  311. if(capture2start == 1 && capture2 == 1) return capture2 = 1;
  312. if(capture2start == 1 && capture2 == 2) return capture2 = 2;
  313. if(capture2start == 1 && capture2 == 3) return capture2 = 3;
  314. if(capture2start == 2 && capture2 == 1) return capture2 = 1;
  315. if(capture2start == 2 && capture2 == 2) return capture2 = 2;
  316. if(capture2start == 2 && capture2 == 3) return capture2 = 3;
  317. if(capture2start == 3 && capture2 == 1) return capture2 = 1;
  318. if(capture2start == 3 && capture2 == 2) return capture2 = 2;
  319. if(capture2start == 3 && capture2 == 3) return capture2 = 3;
  320. }
  321. }
  322. ///////////////////////////////////capture 3
  323. if (IsPlayerInRangeOfPoint(playerid, 5.0, 983.0714, 1733.2091, 9.3417))
  324. { //return SendClientMessage(playerid, -1,"You need to stay max 5metres from the capture checkpoint.!");
  325. if(PlayerInfo[playerid][Gangid] == 1)
  326. {
  327. GangZoneStopFlashForAll(Zone3);
  328. GangZoneShowForAll(Zone3,0xFF000096);
  329. capture3 = 1;
  330. capture3start =0;
  331. }
  332. if(PlayerInfo[playerid][Gangid] == 2)
  333. {
  334. GangZoneStopFlashForAll(Zone3);
  335. GangZoneShowForAll(Zone3,0xFFFFFF96);
  336. capture3 = 2;
  337. capture3start =0;
  338. }
  339. if(PlayerInfo[playerid][Gangid] == 3)
  340. {
  341. GangZoneStopFlashForAll(Zone3);
  342. GangZoneShowForAll(Zone3,0xFFFF009A);
  343. capture3 = 3;
  344. capture3start =0;
  345. }
  346. }
  347. else
  348. {
  349. if(capture3start >= 4)
  350. {
  351. if(!IsPlayerInRangeOfPoint(playerid, 5.0, 983.0714, 1733.2091, 9.3417))
  352. {
  353. SendClientMessage(playerid, -1,"You need to stay max 5metres from the capture checkpoint.!");
  354. GangZoneStopFlashForAll(Zone3);
  355. if(capture3start == 1 && capture3 == 1) return capture3 = 1;
  356. if(capture3start == 1 && capture3 == 2) return capture3 = 2;
  357. if(capture3start == 1 && capture3 == 3) return capture3 = 3;
  358. if(capture3start == 2 && capture3 == 1) return capture3 = 1;
  359. if(capture3start == 2 && capture3 == 2) return capture3 = 2;
  360. if(capture3start == 2 && capture3 == 3) return capture3 = 3;
  361. if(capture3start == 3 && capture3 == 1) return capture3 = 1;
  362. if(capture3start == 3 && capture3 == 2) return capture3 = 2;
  363. if(capture3start == 3 && capture3 == 3) return capture3 = 3;
  364. }
  365. }
  366. }
  367. return 1;
  368. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement