Guest User

Grove Street vs Ballas

a guest
Jan 7th, 2015
986
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.58 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define ROUND_MINUTES 10
  4.  
  5. #define TEAM_GROVE_COLOR 0x00FF00AA
  6. #define TEAM_BALLA_COLOR 0xFF00FFAA
  7.  
  8. new Text:Timeleft;
  9. new Text:CurrentMap;
  10. new timeleft = ROUND_MINUTES;
  11. new roundtimer;
  12. new seconds=0;
  13. new MAP = 0;
  14. new maptimer;
  15.  
  16. new SPAWNED[MAX_PLAYERS];
  17. new Float:HEALTH[MAX_PLAYERS];
  18. new ALLOWCHAT[MAX_PLAYERS];
  19. new CHECKSPAM[MAX_PLAYERS];
  20.  
  21. forward Second();
  22. forward ChangeMap();
  23. forward FloodCheck(playerid);
  24.  
  25. main()
  26. {
  27. print("\n------------------------------------------");
  28. print("Grove Street vs Ballas by Remba031 loaded.");
  29. print("------------------------------------------\n");
  30. }
  31.  
  32.  
  33. public OnGameModeInit()
  34. {
  35. roundtimer = SetTimer("Second",1000,true);
  36.  
  37. DisableInteriorEnterExits();
  38. UsePlayerPedAnims();
  39. SetGameModeText("TDM");
  40. SendRconCommand("mapname RC Battlefield");
  41.  
  42. ShowPlayerMarkers(PLAYER_MARKERS_MODE_OFF);
  43.  
  44. AddPlayerClass(105,-1132.0251,1041.6741,1345.7401,271.0460,31,500,24,200,0,0); // G
  45. AddPlayerClass(106,-1132.0251,1041.6741,1345.7401,271.0460,31,500,24,200,0,0); // G
  46. AddPlayerClass(107,-1132.0251,1041.6741,1345.7401,271.0460,31,500,24,200,0,0); // G
  47.  
  48. AddPlayerClass(102,-973.3190,1077.4526,1344.9951,90.9010,31,500,24,200,0,0); // B
  49. AddPlayerClass(103,-973.3190,1077.4526,1344.9951,90.9010,31,500,24,200,0,0); // B
  50. AddPlayerClass(104,-973.3190,1077.4526,1344.9951,90.9010,31,500,24,200,0,0); // B
  51.  
  52. Timeleft = TextDrawCreate(550.0,100.0,"00:00");
  53. TextDrawFont(Timeleft,2);
  54. TextDrawUseBox(Timeleft,1);
  55. TextDrawBoxColor(Timeleft,0x000000AA);
  56. TextDrawTextSize(Timeleft,1.0,60.0);
  57. TextDrawAlignment(Timeleft,2);
  58.  
  59. CurrentMap = TextDrawCreate(550.0,80.0,"RC Battlefield");
  60. TextDrawFont(CurrentMap,2);
  61. TextDrawUseBox(CurrentMap,1);
  62. TextDrawBoxColor(CurrentMap,0x000000FF);
  63. TextDrawTextSize(CurrentMap,1.0,110.0);
  64. TextDrawAlignment(CurrentMap,2);
  65. TextDrawLetterSize(CurrentMap,0.25,1.75);
  66. return 1;
  67. }
  68.  
  69. public OnGameModeExit()
  70. {
  71. print("\n-------------------------------------------");
  72. print("Grove Street vs Ballas by Remba031 unloaded.");
  73. print("-------------------------------------------\n");
  74. return 1;
  75. }
  76.  
  77. public OnPlayerRequestClass(playerid, classid)
  78. {
  79. SPAWNED[playerid] = 0;
  80. TextDrawShowForPlayer(playerid,Timeleft);
  81. TextDrawShowForPlayer(playerid,CurrentMap);
  82.  
  83. SetPlayerInterior(playerid,1);
  84. SetPlayerPos(playerid,292.9160,-30.6521,1001.5156);
  85. SetPlayerCameraPos(playerid,293.1492,-37.2610,1001.5156);
  86. SetPlayerCameraLookAt(playerid,292.9160,-30.6521,1001.5156);
  87. SetPlayerFacingAngle(playerid,177.3484);
  88.  
  89. switch(classid)
  90. {
  91. case 0,1,2:
  92. {
  93. SetPlayerTeam(playerid,1);
  94. GameTextForPlayer(playerid,"~g~GROVE STREET",3000,4);
  95. SetPlayerColor(playerid,TEAM_GROVE_COLOR);
  96. }
  97. case 3,4,5:
  98. {
  99. SetPlayerTeam(playerid,2);
  100. GameTextForPlayer(playerid,"~p~BALLAS",3000,4);
  101. SetPlayerColor(playerid,TEAM_BALLA_COLOR);
  102. }
  103. }
  104.  
  105. return 1;
  106. }
  107.  
  108. public OnPlayerConnect(playerid)
  109. {
  110. SetPlayerColor(playerid,-1);
  111. SPAWNED[playerid] = 0;
  112. ALLOWCHAT[playerid] = 1;
  113. CHECKSPAM[playerid] = 0;
  114. SetTimerEx("FloodCheck",3000,true,"i",playerid);
  115. return 1;
  116. }
  117.  
  118. public OnPlayerDisconnect(playerid, reason)
  119. {
  120. SetPlayerColor(playerid,-1);
  121. SPAWNED[playerid] = 0;
  122. ALLOWCHAT[playerid] = 1;
  123. CHECKSPAM[playerid] = 0;
  124. return 1;
  125. }
  126.  
  127. public OnPlayerSpawn(playerid)
  128. {
  129. if(MAP == 0) // Default map(RC Battlefield)
  130. {
  131. SetPlayerInterior(playerid,10);
  132. }
  133. else if(MAP == 1) // Jefferson Motel
  134. {
  135. SetPlayerInterior(playerid,15);
  136. if(GetPlayerTeam(playerid) == 1)
  137. {
  138. SetPlayerPos(playerid,2217.5869,-1151.1071,1025.7969);
  139. SetPlayerFacingAngle(playerid,272.2993);
  140. }
  141. else if(GetPlayerTeam(playerid) == 2)
  142. {
  143. SetPlayerPos(playerid,2195.3025,-1143.9893,1029.7969);
  144. SetPlayerFacingAngle(playerid,181.1184);
  145. }
  146. }
  147. else if(MAP == 2) //Liberty City
  148. {
  149. SetPlayerInterior(playerid,1);
  150. if(GetPlayerTeam(playerid) == 1)
  151. {
  152. SetPlayerPos(playerid,-795.0522,495.1387,1376.1953);
  153. SetPlayerFacingAngle(playerid,356.2731);
  154. }
  155. else if(GetPlayerTeam(playerid) == 2)
  156. {
  157. SetPlayerPos(playerid,-830.9671,515.4208,1357.6854);
  158. SetPlayerFacingAngle(playerid,182.6851);
  159. }
  160. }
  161. else if(MAP == 3) //Pleasure Domes
  162. {
  163. SetPlayerInterior(playerid,3);
  164. if(GetPlayerTeam(playerid) == 1)
  165. {
  166. SetPlayerPos(playerid,-2647.0217,1423.9025,906.4609);
  167. SetPlayerFacingAngle(playerid,127.1440);
  168. }
  169. else if(GetPlayerTeam(playerid) == 2)
  170. {
  171. SetPlayerPos(playerid,-2667.2332,1426.8282,906.4609);
  172. SetPlayerFacingAngle(playerid,179.7845);
  173. }
  174. }
  175. else if(MAP == 4) // Planning Department
  176. {
  177. SetPlayerInterior(playerid,3);
  178. if(GetPlayerTeam(playerid) == 1)
  179. {
  180. SetPlayerPos(playerid,349.0134,163.6172,1025.7891);
  181. SetPlayerFacingAngle(playerid,271.4312);
  182. }
  183. else if(GetPlayerTeam(playerid) == 2)
  184. {
  185. SetPlayerPos(playerid,-372.1458,180.4995,1008.3828);
  186. SetPlayerFacingAngle(playerid,179.8669);
  187. }
  188. }
  189. SetPlayerHP(playerid,100.0);
  190. SPAWNED[playerid] = 1;
  191. return 1;
  192. }
  193.  
  194. public OnPlayerDeath(playerid, killerid, reason)
  195. {
  196. if(killerid != INVALID_PLAYER_ID) // Valid kill
  197. {
  198. SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
  199. SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
  200.  
  201. if(reason == 34)
  202. {
  203. BanEx(killerid,"Cheat");
  204. SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
  205. }
  206. else if(reason == 35)
  207. {
  208. BanEx(killerid,"Cheat");
  209. SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
  210. }
  211. else if(reason == 36)
  212. {
  213. BanEx(killerid,"Cheat");
  214. SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
  215. }
  216. else if(reason == 36)
  217. {
  218. BanEx(killerid,"Cheat");
  219. SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
  220. }
  221. else if(reason == 38)
  222. {
  223. BanEx(killerid,"Cheat");
  224. SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
  225. }
  226.  
  227. }
  228. else
  229. {
  230. SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
  231. }
  232. return 1;
  233. }
  234.  
  235. public OnPlayerText(playerid, text[])
  236. {
  237. if(ALLOWCHAT[playerid] == 1)
  238. {
  239. new sendername[MAX_PLAYER_NAME];
  240. GetPlayerName(playerid,sendername,sizeof(sendername));
  241. new string[256];
  242. if(GetPlayerTeam(playerid) == 1)
  243. {
  244. if(SPAWNED[playerid] == 1)
  245. {
  246. format(string,sizeof(string),"{FFFFFF}[MAIN CHAT] {6EF83C}%s: {FFFFFF}%s",sendername,text);
  247. SendClientMessageToAll(-1,string);
  248. CHECKSPAM[playerid]++;
  249. }
  250. }
  251. else if(GetPlayerTeam(playerid) == 2)
  252. {
  253. if(SPAWNED[playerid] == 1)
  254. {
  255. format(string,sizeof(string),"{FFFFFF}[MAIN CHAT] {B700FF}%s: {FFFFFF}%s",sendername,text);
  256. SendClientMessageToAll(-1,string);
  257. CHECKSPAM[playerid]++;
  258. }
  259. }
  260. }
  261. return 0;
  262. }
  263.  
  264. public OnPlayerCommandText(playerid, cmdtext[])
  265. {
  266. if (strcmp("/help", cmdtext, true, 5) == 0)
  267. {
  268. if(SPAWNED[playerid] == 1)
  269. {
  270. SendClientMessage(playerid,-1,"{F9E8B7}COMMANDS: {FFFFFF}/help, /resetscore");
  271. }
  272. CHECKSPAM[playerid]++;
  273. return 1;
  274. }
  275. if (strcmp("/resetscore", cmdtext, true, 11) == 0)
  276. {
  277. if(SPAWNED[playerid] == 1)
  278. {
  279. SetPlayerScore(playerid,0);
  280. SendClientMessage(playerid,-1,"{F9E8B7}Your score is set back to {FFFFFF}0{F9E8B7}.");
  281. }
  282. CHECKSPAM[playerid]++;
  283. return 1;
  284. }
  285. return 0;
  286. }
  287.  
  288. public OnPlayerUpdate(playerid)
  289. {
  290. if(SPAWNED[playerid] == 1)
  291. {
  292. if(GetPlayerWeapon(playerid) == 44) BanEx(playerid,"Cheat");
  293. else if(GetPlayerWeapon(playerid) == 45) BanEx(playerid,"Cheat");
  294. else if(GetPlayerWeapon(playerid) == 16) BanEx(playerid,"Cheat");
  295.  
  296. if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK) BanEx(playerid,"Cheat");
  297. if(GetPlayerMoney(playerid) > 0) BanEx(playerid,"Cheat");
  298.  
  299. new Float:pHealth;
  300. GetPlayerHealth(playerid,pHealth);
  301.  
  302. new Float:pArmor;
  303. GetPlayerArmour(playerid,pArmor);
  304.  
  305. if(pHealth != HEALTH[playerid])
  306. {
  307. if(pHealth > HEALTH[playerid])
  308. {
  309. BanEx(playerid,"Cheat");
  310. }
  311. else
  312. {
  313.  
  314. }
  315. }
  316.  
  317. else if(pArmor >= 1.0)
  318. {
  319. if(SPAWNED[playerid] == 1)
  320. {
  321. BanEx(playerid,"Cheat");
  322. }
  323. }
  324. }
  325. return 1;
  326. }
  327.  
  328. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
  329. {
  330. HEALTH[playerid] -= amount;
  331. return 1;
  332. }
  333. //==============================================================================
  334. public Second()
  335. {
  336. new timestr[32];
  337. seconds--;
  338. if(seconds <= 0)
  339. {
  340. if(timeleft <= 0)
  341. {
  342. KillTimer(roundtimer);
  343. seconds = 0;
  344. timeleft = 0;
  345. FreezeAll();
  346. SendClientMessageToAll(-1,"SERVER: {F9E8B7}Changing map...");
  347. maptimer = SetTimer("ChangeMap",5000,false);
  348. }
  349. else
  350. {
  351. seconds = 59;
  352. timeleft--;
  353. }
  354. }
  355. format(timestr,sizeof(timestr),"%02d:%02d",timeleft,seconds);
  356. TextDrawSetString(Timeleft,timestr);
  357. return 1;
  358. }
  359.  
  360. public ChangeMap()
  361. {
  362. KillTimer(maptimer);
  363. if(MAP == 0)
  364. {
  365. MAP = 1;
  366. timeleft = ROUND_MINUTES;
  367. roundtimer = SetTimer("Second",1000,true);
  368. RespawnAll();
  369. UnFreezeAll();
  370. TextDrawSetString(CurrentMap,"Jefferson Motel");
  371. SendRconCommand("mapname Jefferson Motel");
  372. SendClientMessageToAll(-1,"SERVER: {F9E8B7}Map changed.");
  373. }
  374. else if(MAP == 1)
  375. {
  376. MAP = 2;
  377. timeleft = ROUND_MINUTES;
  378. roundtimer = SetTimer("Second",1000,true);
  379. RespawnAll();
  380. UnFreezeAll();
  381. TextDrawSetString(CurrentMap,"Liberty City");
  382. SendRconCommand("mapname Liberty City");
  383. SendClientMessageToAll(-1,"SERVER: {F9E8B7}Map changed.");
  384. }
  385. else if(MAP == 2)
  386. {
  387. MAP = 3;
  388. timeleft = ROUND_MINUTES;
  389. roundtimer = SetTimer("Second",1000,true);
  390. RespawnAll();
  391. UnFreezeAll();
  392. TextDrawSetString(CurrentMap,"Pleasure Domes");
  393. SendRconCommand("mapname Pleasure Domes");
  394. SendClientMessageToAll(-1,"SERVER: {F9E8B7}Map changed.");
  395. }
  396. else if(MAP == 3)
  397. {
  398. MAP = 4;
  399. timeleft = ROUND_MINUTES;
  400. roundtimer = SetTimer("Second",1000,true);
  401. RespawnAll();
  402. UnFreezeAll();
  403. TextDrawSetString(CurrentMap,"Planning Dept.");
  404. SendRconCommand("mapname Planning Department");
  405. SendClientMessageToAll(-1,"SERVER: {F9E8B7}Map changed.");
  406. }
  407. else if(MAP == 4)
  408. {
  409. MAP = 0;
  410. timeleft = ROUND_MINUTES;
  411. roundtimer = SetTimer("Second",1000,true);
  412. RespawnAll();
  413. UnFreezeAll();
  414. TextDrawSetString(CurrentMap,"RC Battlefield");
  415. SendRconCommand("mapname RC Battlefield");
  416. SendClientMessageToAll(-1,"SERVER: {F9E8B7}Map changed.");
  417. }
  418. UnFreezeAll();
  419. }
  420.  
  421. public FloodCheck(playerid)
  422. {
  423. if(IsPlayerFlooding(playerid)) return Kick(playerid);
  424. else return 0;
  425. }
  426. //==============================================================================
  427. stock FreezeAll()
  428. {
  429. for(new i=0; i<MAX_PLAYERS; i++)
  430. {
  431. TogglePlayerControllable(i,0);
  432. }
  433. }
  434.  
  435. stock UnFreezeAll()
  436. {
  437. for(new i=0; i<MAX_PLAYERS; i++)
  438. {
  439. TogglePlayerControllable(i,1);
  440. }
  441. }
  442.  
  443. stock RespawnAll()
  444. {
  445. for(new i=0; i<MAX_PLAYERS; i++)
  446. {
  447. TogglePlayerSpectating(i,1);
  448. SPAWNED[i] = 0;
  449. TogglePlayerSpectating(i,0);
  450. }
  451. }
  452.  
  453. stock IsPlayerFlooding(playerid)
  454. {
  455. if(CHECKSPAM[playerid] >= 3) return 1;
  456. else return CHECKSPAM[playerid] = 0;
  457. }
  458.  
  459. stock SetPlayerHP(playerid,Float:amount)
  460. {
  461. HEALTH[playerid] = amount;
  462. SetPlayerHealth(playerid,amount);
  463. }
Advertisement
Add Comment
Please, Sign In to add comment