Guest User

Matthias

a guest
Apr 1st, 2009
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.79 KB | None | 0 0
  1.  
  2. /*---------------------------------------------------------------------------------------------------\*
  3. || ||
  4. || | | | _____| | \ / | ||
  5. || | | | |_____ | |\ \ / /| | ||
  6. || | | | _____ | | | \ \ / / | | ||
  7. || | |_____ ______| | | | \ \ / | | ||
  8. || |_______| |________| |_| \__/ |_| ||
  9. || ||
  10. ||-------------------------------------------------------------------------------------------------- ||
  11. ||===================================================================================================||
  12. || Los Santos Madness has been created by Matthias aka GTA_Rules ||
  13. || You are not allowed to edit and republish it without my permission! ||
  14. \*===================================================================================================*/
  15.  
  16. #include <a_samp>
  17. #include <core>
  18. #include <float>
  19.  
  20. #pragma tabsize 0
  21.  
  22. #define COLOR_GREEN 0x33AA33AA
  23. #define COLOR_RED 0xAA3333AA
  24. #define COLOR_YELLOW 0xFFFF00AA
  25. #define COLOR_WHITE 0xFFFFFFAA
  26. #define COLOR_BRIGHTRED 0xFF0000AA
  27. #define COLOR_LIGHTBLUE 0x33CCFFAA
  28. #define COLOR_PURPLE 0x800080AA
  29. #define COLOR_GREEN 0x33AA33AA
  30. #define COLOR_GRAD1 0xB4B5B7FF
  31.  
  32. #define INACTIVE_PLAYER_ID 255
  33. #define NUMVALUES 4
  34.  
  35. #define TEAM_GROVE 1
  36. #define TEAM_BALLA 2
  37. #define TEAM_GROVE_COLOR 0x33AA33AA
  38. #define TEAM_BALLA_COLOR 0x800080AA
  39.  
  40. forward SetupPlayerForClassSelection(playerid);
  41. forward GameModeExitFunc();
  42. forward SendPlayerFormattedText(playerid, const str[], define);
  43. forward public SendAllFormattedText(playerid, const str[], define);
  44. forward GetPlayersScores();
  45. forward ResetScore();
  46. forward BlastBomb();
  47. forward gmxtimer();
  48. forward GlobalAnnouncement();
  49.  
  50. new Float:X, Float:Y, Float:Z;
  51. new gClass[MAX_PLAYERS];
  52. new gTeam[MAX_PLAYERS];
  53. new Text:Textdraw0;
  54. new Text:Score;
  55. new GroveVeh;
  56. new BallasVeh;
  57. new grovescore;
  58. new ballasscore;
  59. new dynamite;
  60.  
  61. new Msg;
  62. new Announcements[5][128] = {
  63. "| Announcement: | This gamemode has been created by Matthias aka GTA_Rules!",
  64. "| Announcement: | Feel like blowing something? Use /bomb!",
  65. "| Announcement: | To fully enjoy LSM, read /help!",
  66. "| Announcement: | Make sure you check /goal!",
  67. "| Announcement: | Check /info if you have any questions about the gamemode!"
  68. };
  69.  
  70. main()
  71. {
  72. print("\n|---------------------------------------------|");
  73. print("\n|------- Los Santos Madness - [ V 1.0 ] ------|");
  74. print("\n|---- Scripted by Matthias aka. GTA_Rules ----|");
  75. print("\n|---------------------------------------------|");
  76. }
  77.  
  78. // ----------------------------------------------------------------------------------------------------------------------//
  79. // ----------------------------------------------------------------------------------------------------------------------//
  80.  
  81. public OnPlayerConnect(playerid)
  82. {
  83. new string[64], name[24];
  84. SendClientMessage(playerid, COLOR_YELLOW, "Welcome to Los Santos Madness, make sure you check out /help!");
  85. GameTextForPlayer(playerid,"~g~Los Santos Madness ~r~ ~n~ [V 1.0] ~n~ ~b~ by ~w~ Matthias Van Eeghem!",5000,5);
  86. ScoreUpdate();
  87. GetPlayerName( playerid, name, 24 );
  88. format( string, sizeof( string ), "%s (ID: %d) has joined the server.", name, playerid );
  89. SendClientMessageToAll( COLOR_GRAD1, string );
  90. return 1;
  91.  
  92. }
  93.  
  94. // ----------------------------------------------------------------------------------------------------------------------//
  95. // ----------------------------------------------------------------------------------------------------------------------//
  96.  
  97. public OnPlayerDisconnect(playerid,reason)
  98. {
  99. new string[64], name[24];
  100. GetPlayerName( playerid, name, 24 );
  101. switch (reason)
  102. {
  103. case 0: { format(string, 256, "*** %s has left the server (Timeout)", name); SendClientMessageToAll(COLOR_GRAD1, string); }
  104. case 1: { format(string, 256, "*** %s has left the server (Leaving)", name); SendClientMessageToAll(COLOR_GRAD1, string); }
  105. case 2: { format(string, 256, "*** %s has left the server (Kicked)", name); SendClientMessageToAll(COLOR_GRAD1, string); }
  106. }
  107. TextDrawHideForPlayer(playerid, Textdraw0);
  108. TextDrawHideForPlayer(playerid, Score);
  109. }
  110.  
  111. // ----------------------------------------------------------------------------------------------------------------------//
  112. // ----------------------------------------------------------------------------------------------------------------------//
  113.  
  114. public OnPlayerCommandText(playerid, cmdtext[])
  115. {
  116. new cmd[256];
  117. new idx, tString[256];
  118. new tmp[256];
  119. cmd = strtok(cmdtext, idx);
  120.  
  121.  
  122. // ----------------------------------------------------------------------------------------------------------------------//
  123.  
  124. if(strcmp(cmd, "/help", true) == 0) {
  125. SendClientMessage(playerid, COLOR_YELLOW, "--- Los Santos Madness: Help ---");
  126. SendClientMessage(playerid, COLOR_WHITE, "Make sure you follow all the /rules");
  127. SendClientMessage(playerid, COLOR_WHITE, "Have any questions about the gamemode? Read /info!");
  128. SendClientMessage(playerid, COLOR_WHITE, "Read the commandlist in /commands!");
  129. return 1;
  130. }
  131.  
  132. // ----------------------------------------------------------------------------------------------------------------------//
  133.  
  134. if(strcmp(cmd, "/info", true) == 0)
  135. {
  136. tmp = strtok(cmdtext, idx);
  137. if(!strlen(tmp))
  138. {
  139. SendClientMessage(playerid,COLOR_YELLOW, "Usage: /info [info topic]");
  140. SendClientMessage(playerid,COLOR_BRIGHTRED, "Info topics: goal, bomb, ending, credits, gangcar.");
  141. return 1;
  142. }
  143. if(strcmp(tmp, "goal", true) == 0){
  144. SendClientMessage(playerid, COLOR_YELLOW, "--- Goal info ---");
  145. SendClientMessage(playerid, COLOR_WHITE, "Your goal is to kill as much enemy gang members as possible.");
  146. SendClientMessage(playerid, COLOR_WHITE, "For any info about the gang car check /info gangcar!");
  147. }else if(strcmp(tmp, "bomb", true) == 0){
  148. SendClientMessage(playerid, COLOR_YELLOW, "--- Bomb info ----");
  149. SendClientMessage(playerid, COLOR_WHITE, "Use /bomb to create a bomb. It will set a timer from 10 seconds.");
  150. SendClientMessage(playerid, COLOR_WHITE, "Afer those seconds it will blow anything in that area. You need 10.000$ to buy a bomb!");
  151. }else if(strcmp(tmp, "ending", true) == 0){
  152. SendClientMessage(playerid, COLOR_YELLOW, "--- Ending of the gamemode ---");
  153. SendClientMessage(playerid, COLOR_WHITE, "The gamemode ends when one of the teams has 50 kills. It will automatically restart after that.");
  154. }else if(strcmp(tmp, "credits", true) == 0){
  155. SendClientMessage(playerid, COLOR_YELLOW, "--- Credits ---");
  156. SendClientMessage(playerid, COLOR_WHITE, "The gamemode and its idea has been created by GTA_Rules aka Matthias");
  157. SendClientMessage(playerid, COLOR_WHITE, "I would like to thank a few people for their help though:");
  158. SendClientMessage(playerid, COLOR_WHITE, "Fireburn, Marcel, Wesley, Boylett, Westie, MenaceX, Pandabeer, TheAlpha, Pugwipe, Ry5a.");
  159. }else if(strcmp(tmp, "gangcar", true) == 0){
  160. SendClientMessage(playerid, COLOR_YELLOW, "--- Gang car info ---");
  161. SendClientMessage(playerid, COLOR_WHITE, "It's quite simple, you just need to steal the other gang's car and get it to the checkpoint.");
  162. }
  163. return 1;
  164. }
  165.  
  166. // ----------------------------------------------------------------------------------------------------------------------//
  167.  
  168. if(strcmp(cmd, "/rules", true) == 0) {
  169. SendClientMessage(playerid, COLOR_RED, "--- The rules ---");
  170. SendClientMessage(playerid, COLOR_WHITE,"1. Do not flame any other player / admin.");
  171. SendClientMessage(playerid, COLOR_WHITE,"2. Don't cheat or you'll get banned.");
  172. SendClientMessage(playerid, COLOR_WHITE,"3. Do not bug abuse.");
  173. SendClientMessage(playerid, COLOR_WHITE,"4. Make sure you only speak English in mainchat!");
  174. SendClientMessage(playerid, COLOR_WHITE,"5. Do not teamkill!");
  175.  
  176. return 1;
  177. }
  178.  
  179. // ----------------------------------------------------------------------------------------------------------------------//
  180.  
  181. if(strcmp(cmd, "/commands", true) == 0) {
  182. if(IsPlayerAdmin(playerid))
  183. {
  184. SendClientMessage(playerid, COLOR_YELLOW, "--- Commands ---");
  185. SendClientMessage(playerid, COLOR_WHITE,"/kill /switchteam /help /info /bomb /adminhelp");
  186. }
  187. else
  188. {
  189. SendClientMessage(playerid, COLOR_YELLOW, "--- Commands ---");
  190. SendClientMessage(playerid, COLOR_WHITE,"/kill /switchteam /help /info /bomb");
  191. }
  192. return 1;
  193. }
  194.  
  195. // ----------------------------------------------------------------------------------------------------------------------//
  196.  
  197. if(strcmp(cmd, "/adminhelp", true) == 0) {
  198. if(IsPlayerAdmin(playerid))
  199. {
  200. SendClientMessage(playerid, COLOR_YELLOW, "Admin commands:");
  201. SendClientMessage(playerid, COLOR_WHITE, "/resetgrove /resetballas /resetscores /givegrove /giveballas");
  202. }
  203. return 1;
  204. }
  205.  
  206. // ----------------------------------------------------------------------------------------------------------------------//
  207.  
  208. new playercash;
  209. playercash = GetPlayerMoney(playerid);
  210. if(strcmp(cmd, "/bomb", true) == 0) {
  211. if (playercash < 10000) {
  212. SendClientMessage(playerid, COLOR_BRIGHTRED, "You need at least 10.000$ to buy a bomb!");
  213. }
  214. else
  215. {
  216. GetPlayerPos(playerid, X, Y, Z);
  217. dynamite = CreateObject( 1654, X, Y, Z, 0, 0, 96 );
  218. GivePlayerMoney(playerid,-10000);
  219. SendClientMessage(playerid, COLOR_BRIGHTRED, "Bomb planted! 10 seconds till detonation!");
  220. SetTimer("BlastBomb", 10000, 0);
  221. }
  222. return 1;
  223. }
  224.  
  225. // ----------------------------------------------------------------------------------------------------------------------//
  226.  
  227. if(strcmp(cmd, "/announce", true) == 0)
  228. {
  229. if(IsPlayerAdmin(playerid))
  230. {
  231. new length = strlen(cmdtext);
  232. while ((idx < length) && (cmdtext[idx] <= ' '))
  233. {
  234. idx++;
  235. }
  236. new offset = idx;
  237. new result[64];
  238. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  239. {
  240. result[idx - offset] = cmdtext[idx];
  241. idx++;
  242. }
  243. result[idx - offset] = EOS;
  244. if(!strlen(result))
  245. {
  246. SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /announce [TEXT]");
  247. return 1;
  248. }
  249. format(tString,sizeof(tString), "| Announcement: | %s", result);
  250. SendClientMessageToAll(COLOR_YELLOW,tString);
  251. return 1;
  252. }
  253. }
  254.  
  255.  
  256. // ----------------------------------------------------------------------------------------------------------------------//
  257.  
  258. if(strcmp(cmd, "/resetgrove", true) == 0) {
  259. {
  260. if(IsPlayerAdmin(playerid))
  261. {
  262. grovescore = 0;
  263. ScoreUpdate();
  264. SendClientMessage(playerid, COLOR_GREEN, "You have reset the Grove's score!");
  265. }
  266. }
  267. return 1;
  268. }
  269.  
  270. // ----------------------------------------------------------------------------------------------------------------------//
  271.  
  272. if(strcmp(cmd, "/resetballas", true) == 0) {
  273. {
  274. if(IsPlayerAdmin(playerid))
  275. {
  276. ballasscore = 0;
  277. ScoreUpdate();
  278. SendClientMessage(playerid, COLOR_GREEN, "You have reset the Ballas' score!");
  279. }
  280. }
  281. return 1;
  282. }
  283.  
  284. // ----------------------------------------------------------------------------------------------------------------------//
  285.  
  286. if(strcmp(cmd, "/giveballas", true) == 0) {
  287. {
  288. if(IsPlayerAdmin(playerid))
  289. {
  290. ballasscore ++;
  291. ScoreUpdate();
  292. SendClientMessage(playerid, COLOR_GREEN, "You haven given the Ballas gang one point!");
  293. }
  294. }
  295. return 1;
  296. }
  297.  
  298. // ----------------------------------------------------------------------------------------------------------------------//
  299.  
  300. if(strcmp(cmd, "/givegrove", true) == 0) {
  301. {
  302. if(IsPlayerAdmin(playerid))
  303. {
  304. grovescore ++;
  305. ScoreUpdate();
  306. SendClientMessage(playerid, COLOR_GREEN, "You haven given the Grove gang one point!");
  307. }
  308. }
  309. return 1;
  310. }
  311.  
  312. // ----------------------------------------------------------------------------------------------------------------------//
  313.  
  314. if(strcmp(cmd, "/resetscores", true) == 0) {
  315. {
  316. if(IsPlayerAdmin(playerid))
  317. {
  318. grovescore = 0, ballasscore = 0;
  319. ScoreUpdate();
  320. SendClientMessage(playerid, COLOR_GREEN, "You have reset the team scores!");
  321. SendClientMessageToAll(0xFF0000AA, "An admin has reset the team scores!");
  322. }
  323. }
  324. return 1;
  325. }
  326.  
  327. // ----------------------------------------------------------------------------------------------------------------------//
  328.  
  329. if(strcmp(cmd, "/kill", true) == 0) {
  330. {
  331. SetPlayerHealth(playerid,0.0);
  332. }
  333. return 1;
  334. }
  335.  
  336. // ----------------------------------------------------------------------------------------------------------------------//
  337.  
  338. if (strcmp(cmdtext, "/changeteam", true) == 0)
  339. {
  340. ForceClassSelection(playerid);
  341. SetPlayerHealth(playerid,0);
  342. return 1;
  343. }
  344.  
  345. return 0;
  346. }
  347.  
  348. // ----------------------------------------------------------------------------------------------------------------------//
  349. // ----------------------------------------------------------------------------------------------------------------------//
  350.  
  351. public OnPlayerSpawn(playerid)
  352. {
  353.  
  354.  
  355. new Data[MAX_PLAYER_NAME];
  356. GetPlayerName(playerid, Data, sizeof(Data));
  357. if(strcmp(Data, "adminname1") == 0)
  358. // This function gives admins special spawnstuff, now he spawns with another colour (yellow) and the same weapons as players have.
  359. // Add or changes names here EG: Uncomment the line below if you want to add another admin's name.
  360. // if(strcmp(Data, "adminname2") == 0)
  361. {
  362. SetPlayerColor(playerid,0xFFFF00AA);
  363. GivePlayerWeapon(playerid, 24, 500);
  364. GivePlayerWeapon(playerid, 27, 500);
  365. GivePlayerWeapon(playerid, 29, 500);
  366. GivePlayerWeapon(playerid, 31, 500);
  367. GivePlayerWeapon(playerid, 34, 500);
  368. SetPlayerHealth(playerid, 100.0);
  369. SetPlayerArmour(playerid, 100.0);
  370. }
  371. else
  372. {
  373. GivePlayerWeapon(playerid, 24, 500);
  374. GivePlayerWeapon(playerid, 27, 500);
  375. GivePlayerWeapon(playerid, 29, 500);
  376. GivePlayerWeapon(playerid, 31, 500);
  377. GivePlayerWeapon(playerid, 34, 500);
  378. SetPlayerHealth(playerid, 100.0);
  379. SetPlayerArmour(playerid, 100.0);
  380. SetPlayerToTeamColor(playerid);
  381. }
  382.  
  383. if(gTeam[playerid] == TEAM_GROVE)
  384. {
  385. SetPlayerTeam(playerid, 1 );
  386. }
  387. if(gTeam[playerid] == TEAM_BALLA)
  388. {
  389. SetPlayerTeam(playerid, 2 );
  390. }
  391.  
  392. Textdraw0 = TextDrawCreate(455.000000,6.000000,"Los Santos Madness");
  393. TextDrawAlignment(Textdraw0,0);
  394. TextDrawBackgroundColor(Textdraw0,0x000000ff);
  395. TextDrawFont(Textdraw0,3);
  396. TextDrawLetterSize(Textdraw0,0.499999,1.500000);
  397. TextDrawColor(Textdraw0,0xffffffff);
  398. TextDrawSetOutline(Textdraw0,1);
  399. TextDrawSetProportional(Textdraw0,1);
  400. TextDrawSetShadow(Textdraw0,7);
  401.  
  402. for(new i=0; i<MAX_PLAYERS; i++ )
  403. {
  404. TextDrawShowForPlayer( i , Textdraw0);
  405. }
  406.  
  407. SetPlayerMapIcon( playerid, 0, 2529.4207,-1667.4916,15.1687, 62, 0 );
  408. SetPlayerMapIcon( playerid, 1, 2277.2932,-1644.9403,15.2888, 59, 0 );
  409.  
  410. SetVehicleParamsForPlayer(GroveVeh,playerid,1,0);
  411. SetVehicleParamsForPlayer(BallasVeh,playerid,1,0);
  412.  
  413. return 1;
  414. }
  415.  
  416. // ----------------------------------------------------------------------------------------------------------------------//
  417. // ----------------------------------------------------------------------------------------------------------------------//
  418.  
  419. public OnPlayerDeath(playerid, killerid, reason)
  420. {
  421.  
  422. // ----------------------------------------------------------------------------------------------------------------------//
  423. // The killboard on the right side of your screen.
  424.  
  425. new playercash;
  426. if(killerid == INVALID_PLAYER_ID) {
  427. SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
  428. ResetPlayerMoney(playerid);
  429. }
  430. else
  431. {
  432. SendDeathMessage(killerid,playerid,reason);
  433. SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
  434. playercash = GetPlayerMoney(playerid);
  435. if (playercash > 0) {
  436. GivePlayerMoney(killerid, playercash);
  437. ResetPlayerMoney(playerid);
  438. }
  439. }
  440.  
  441. // ----------------------------------------------------------------------------------------------------------------------//
  442. // Anti-Team kill.
  443.  
  444. if(gTeam[killerid] == gTeam[playerid])
  445. {
  446. SetPlayerHealth(killerid,0.0);
  447. return 1;
  448. }
  449.  
  450. // ----------------------------------------------------------------------------------------------------------------------//
  451. // Score board.
  452.  
  453. if (gTeam[playerid] == TEAM_GROVE)
  454. {
  455. ballasscore++;
  456. ScoreUpdate();
  457. if (ballasscore > 49)
  458. {
  459. GameTextForAll("~w~Team: ~r~ Ballas ~g~ has won the battle!",5000,5);
  460. SendClientMessageToAll(COLOR_BRIGHTRED, "-------------------------------------------------");
  461. SendClientMessageToAll(COLOR_YELLOW, "*** The ballas have won the battle! ***");
  462. SendClientMessageToAll(COLOR_BRIGHTRED, "-------------------------------------------------");
  463. SendClientMessageToAll(COLOR_GREEN, "The gamemode will restart in 10 seconds!");
  464. SetTimer("gmxtimer", 10000, 0);
  465. }
  466.  
  467. }
  468. else if(gTeam[playerid] == TEAM_BALLA)
  469. {
  470. grovescore++;
  471. ScoreUpdate();
  472. if (grovescore > 49)
  473. {
  474. GameTextForAll("~w~Team: ~r~ Grove ~g~ has won the battle!",5000,5);
  475. SendClientMessageToAll(COLOR_BRIGHTRED, "----------------------------------------------------");
  476. SendClientMessageToAll(COLOR_YELLOW, "*** Grove Street has won the battle! ***");
  477. SendClientMessageToAll(COLOR_BRIGHTRED, "----------------------------------------------------");
  478. SendClientMessageToAll(COLOR_GREEN, "The gamemode will restart in 10 seconds!");
  479. SetTimer("gmxtimer", 10000, 0);
  480. }
  481. }
  482.  
  483. // ----------------------------------------------------------------------------------------------------------------------//
  484. // Give money to the killer and send him a message telling him he's real pro.
  485.  
  486. new name[MAX_PLAYER_NAME];
  487. new string[256];
  488. GetPlayerName(playerid, name, sizeof(name));
  489. GivePlayerMoney(killerid, 2500);
  490. format(string, sizeof(string), "You have recieved 2500$ because you have killed %s", name);
  491. SendClientMessage(killerid, COLOR_GREEN, string);
  492.  
  493. return 1;
  494. }
  495.  
  496. // ----------------------------------------------------------------------------------------------------------------------//
  497. // ----------------------------------------------------------------------------------------------------------------------//
  498.  
  499. public OnPlayerText(playerid, text[])
  500. {
  501. new string[256];
  502. new playername[MAX_PLAYER_NAME];
  503. if(text[0] == '!' && text[1] != 0)
  504. {
  505. GetPlayerName( playerid, playername, MAX_PLAYER_NAME );
  506. format( string, 128, "(Team) %s: %s", playername, text[1] );
  507. for(new i = 0; i < MAX_PLAYERS; i++ )
  508. {
  509. if( IsPlayerConnected(i) && gTeam[playerid] == gTeam[i] )
  510. SendClientMessage( i, COLOR_LIGHTBLUE, string );
  511. }
  512. return 0;
  513. }
  514.  
  515. return 1;
  516. }
  517.  
  518.  
  519. // ----------------------------------------------------------------------------------------------------------------------//
  520. // ----------------------------------------------------------------------------------------------------------------------//
  521.  
  522. public OnPlayerRequestClass(playerid, classid)
  523. {
  524.  
  525. SetPlayerTeamFromClass(playerid, classid);
  526. {
  527. if(classid == 0 || classid == 1 || classid == 2)
  528. {
  529. gTeam[playerid] = TEAM_GROVE;
  530. }
  531. if(classid == 3 || classid == 4 || classid == 5)
  532. {
  533. gTeam[playerid] = TEAM_BALLA;
  534. }
  535.  
  536. // ----------------------------------------------------------------------------------------------------------------------//
  537.  
  538. }
  539. SetupPlayerForClassSelection(playerid);
  540. gClass[playerid] = classid;
  541. if(classid==0||classid==1||classid==2) {
  542. SetPlayerTeam( playerid, 1 );
  543. SetPlayerInterior(playerid,0);
  544. SetPlayerPos(playerid,2473.2205,-1686.0530,13.5078);
  545. SetPlayerFacingAngle(playerid,140.4312);
  546. SetPlayerCameraPos(playerid,2470.3530,-1689.5225,15.0139);
  547. SetPlayerCameraLookAt(playerid,2473.2205,-1686.0530,13.5078);}
  548. else if(classid==3||classid==4||classid==5){
  549. SetPlayerTeam( playerid, 2 );
  550. SetPlayerInterior(playerid,0);
  551. SetPlayerPos(playerid,2304.0139,-1666.7949,14.6378);
  552. SetPlayerFacingAngle(playerid, 234.2924);
  553. SetPlayerCameraPos(playerid,2306.7917,-1668.7916,16.1490);
  554. SetPlayerCameraLookAt(playerid,2304.0139,-1666.7949,14.6378);
  555. }
  556. return 1;
  557. }
  558.  
  559. // ----------------------------------------------------------------------------------------------------------------------//
  560. // ----------------------------------------------------------------------------------------------------------------------//
  561.  
  562. public SetupPlayerForClassSelection(playerid)
  563. {
  564. SetPlayerInterior(playerid,0);
  565. SetPlayerPos(playerid,2304.0139,-1666.7949,14.6378);
  566. SetPlayerFacingAngle(playerid, 234.2924);
  567. SetPlayerCameraPos(playerid,2306.7917,-1668.7916,16.1490);
  568. SetPlayerCameraLookAt(playerid,2304.0139,-1666.7949,14.6378);
  569. }
  570.  
  571. // ----------------------------------------------------------------------------------------------------------------------//
  572. // ----------------------------------------------------------------------------------------------------------------------//
  573.  
  574. public GameModeExitFunc()
  575. {
  576. GameModeExit();
  577. TextDrawDestroy(Score);
  578. return 1;
  579. }
  580.  
  581. // ----------------------------------------------------------------------------------------------------------------------//
  582. // ----------------------------------------------------------------------------------------------------------------------//
  583.  
  584. public OnGameModeInit()
  585. {
  586. UsePlayerPedAnims();
  587.  
  588. DisableInteriorEnterExits();
  589.  
  590. SetTeamCount( 2 );
  591.  
  592. SetGameModeText("LSM [V 1.0]");
  593.  
  594. Msg = 0;
  595. SetTimer("GlobalAnnouncement",240000,true);
  596.  
  597. {
  598. Score = TextDrawCreate(430.000000,426.000000,"Grove: 0 Ballas: 0");
  599. TextDrawUseBox(Score,1);
  600. TextDrawBoxColor(Score,0x000000ff);
  601. TextDrawTextSize(Score,630.000000,-63.000000);
  602. TextDrawAlignment(Score,0);
  603. TextDrawBackgroundColor(Score,0x000000ff);
  604. TextDrawFont(Score,3);
  605. TextDrawLetterSize(Score,0.499999,1.600000);
  606. TextDrawColor(Score,0xffffffff);
  607. TextDrawSetOutline(Score,1);
  608. TextDrawSetProportional(Score,1);
  609. TextDrawSetShadow(Score,1);
  610. }
  611.  
  612. SetDisabledWeapons( 35, 36, 37, 38 );
  613.  
  614. // ----------------------------------------------------------------------------------------------------------------------//
  615.  
  616. AddPlayerClass(105,2522.6033,-1686.5757,13.5559,129.4222,0,0,0,0,0,0); // Class 0
  617. AddPlayerClass(106,2510.7986,-1652.9185,13.7826,129.4222,0,0,0,0,0,0); // Class 1
  618. AddPlayerClass(107,2505.8765,-1671.9095,13.3707,129.4222,0,0,0,0,0,0); // Class 2
  619. AddPlayerClass(102,2317.2354,-1641.3617,18.5078,129.4222,0,0,0,0,0,0); // Class 3
  620. AddPlayerClass(103,2286.0066,-1677.5298,14.4154,129.4222,0,0,0,0,0,0); // Class 4
  621. AddPlayerClass(104,2282.0984,-1646.5436,15.1955,129.4222,0,0,0,0,0,0); // Class 5
  622.  
  623. // Ballas vehicles
  624.  
  625. AddStaticVehicle(487,2315.7729,-1638.7750,18.5078,129.4222,5,5);
  626. AddStaticVehicle(492,2304.7229,-1644.6184,14.5144,177.9258,5,5);
  627. AddStaticVehicle(466,2289.6328,-1677.7441,14.3119,0.2875,5,5);
  628. AddStaticVehicle(474,2281.3538,-1676.5109,14.6565,357.4675,5,5);
  629. AddStaticVehicle(463,2271.2124,-1645.9006,15.3752,176.6958,5,5);
  630. AddStaticVehicle(474,2326.4841,-1665.2937,13.5664,356.7219,5,5);
  631. AddStaticVehicle(474,2327.5735,-1651.6378,13.5306,181.8045,5,5);
  632.  
  633. // Grove Vehicles
  634.  
  635. AddStaticVehicle(487,2530.3992,-1677.9027,20.1067,89.1924,16,16);
  636. AddStaticVehicle(492,2505.9202,-1694.8972,13.5577,2.6050,16,16);
  637. AddStaticVehicle(466,2509.5576,-1672.7853,13.3953,358.0190,16,16);
  638. AddStaticVehicle(474,2502.4800,-1655.3014,13.4876,96.0932,16,16);
  639. AddStaticVehicle(463,2472.8840,-1691.9714,13.5145,358.0189,16,16);
  640. AddStaticVehicle(474,2462.9023,-1665.8018,13.2103,1.1254,16,16);
  641. AddStaticVehicle(466,2463.9902,-1653.0697,13.1279,179.8575,16,16);
  642. AddStaticVehicle(474,2494.6772,-1683.8680,13.1655,95.1767,16,16);
  643.  
  644.  
  645. // The important black cars
  646.  
  647. GroveVeh = AddStaticVehicleEx(529,2529.4207,-1667.4916,15.1687,89.9236,0,0,90);
  648. BallasVeh = AddStaticVehicleEx(529,2277.2932,-1644.9403,15.2888,176.8414,0,0,90);
  649.  
  650. return 1;
  651. }
  652.  
  653. // ----------------------------------------------------------------------------------------------------------------------//
  654. // ----------------------------------------------------------------------------------------------------------------------//
  655.  
  656. public OnPlayerStateChange(playerid, newstate, oldstate)
  657. {
  658. if(newstate == PLAYER_STATE_DRIVER)
  659. {
  660. new numero = GetPlayerVehicleID(playerid);
  661. if(numero == BallasVeh)
  662. {
  663. if(gTeam[playerid] == TEAM_BALLA)
  664. {
  665. SendClientMessage(playerid,0xFF0000AA, "You can't steal your own gang car!");
  666. RemovePlayerFromVehicle(playerid);
  667. }
  668. else if(gTeam[playerid] == TEAM_GROVE)
  669. {
  670. new grovename[MAX_PLAYER_NAME];
  671. new str[256];
  672. GetPlayerName(playerid, grovename, sizeof(grovename));
  673. SetPlayerCheckpoint(playerid, 2412.2483,-1854.1670,1.1559, 6.5);
  674. SendClientMessage(playerid, 0x33AA33AA, "You have stolen Ballas' gang vehicle! Get it to the checkpoint!");
  675. format(str, sizeof(str), "*** %s (Gang Grove) is stealing Ballas' gang vehicle! ***", grovename);
  676. SendClientMessageToAll(COLOR_BRIGHTRED, "----------------------------------------------------------------------------------------");
  677. SendClientMessageToAll(COLOR_YELLOW, str);
  678. SendClientMessageToAll(COLOR_BRIGHTRED, "----------------------------------------------------------------------------------------");
  679. }
  680. }
  681. else if(numero == GroveVeh)
  682. {
  683. if(gTeam[playerid] == TEAM_GROVE)
  684. {
  685. SendClientMessage(playerid,0xFF0000AA, "You can't steal your own gang car!");
  686. RemovePlayerFromVehicle(playerid);
  687. }
  688. else if(gTeam[playerid] == TEAM_BALLA)
  689. {
  690. new ballasname[MAX_PLAYER_NAME];
  691. new str[256];
  692. GetPlayerName(playerid, ballasname, sizeof(ballasname));
  693. SendClientMessage(playerid, 0x33AA33AA, "You have stolen the Grove's gang vehicle! Get it to the checkpoint!");
  694. SetPlayerCheckpoint(playerid, 2412.2483,-1854.1670,1.1559, 6.5);
  695. format(str, sizeof(str), "*** %s (Gang Ballas) is stealing Grove's gang vehicle! ***", ballasname);
  696. SendClientMessageToAll(COLOR_BRIGHTRED, "-----------------------------------------------------------------------------------------");
  697. SendClientMessageToAll(COLOR_YELLOW, str);
  698. SendClientMessageToAll(COLOR_BRIGHTRED, "-----------------------------------------------------------------------------------------");
  699. }
  700. }
  701. }
  702. else if(newstate == PLAYER_STATE_ONFOOT)
  703. {
  704. DisablePlayerCheckpoint(playerid);
  705. SetVehicleParamsForPlayer(GroveVeh,playerid,0,0);
  706. SetVehicleParamsForPlayer(BallasVeh,playerid,0,0);
  707. }
  708. return 1;
  709. }
  710.  
  711. // ----------------------------------------------------------------------------------------------------------------------//
  712. // ----------------------------------------------------------------------------------------------------------------------//
  713.  
  714. public SendPlayerFormattedText(playerid, const str[], define)
  715. {
  716. new tmpbuf[256];
  717. format(tmpbuf, sizeof(tmpbuf), str, define);
  718. SendClientMessage(playerid, 0xFF004040, tmpbuf);
  719. }
  720.  
  721. // ----------------------------------------------------------------------------------------------------------------------//
  722. // ----------------------------------------------------------------------------------------------------------------------//
  723.  
  724. public SendAllFormattedText(playerid, const str[], define)
  725. {
  726. new tmpbuf[256];
  727. format(tmpbuf, sizeof(tmpbuf), str, define);
  728. SendClientMessageToAll(0xFFFF00AA, tmpbuf);
  729. }
  730.  
  731. // ----------------------------------------------------------------------------------------------------------------------//
  732. // ----------------------------------------------------------------------------------------------------------------------//
  733.  
  734. public OnPlayerEnterCheckpoint(playerid)
  735. {
  736. new currentveh;
  737. new str[256];
  738. new playername[MAX_PLAYER_NAME];
  739. if(IsPlayerInAnyVehicle(playerid)){
  740. {
  741. GivePlayerMoney(playerid, 10000);
  742. GetPlayerName(playerid, playername, sizeof(playername));
  743. SendClientMessage(playerid, 0x33AA33AA, "You have succesfully stolen the other gang's vehicle and therefore you earned 10.000$!");
  744. currentveh = GetPlayerVehicleID(playerid);
  745. SetVehicleToRespawn(currentveh);
  746. DisablePlayerCheckpoint(playerid);
  747. PlayerPlaySound(playerid, 1058, 2412.2483,-1854.1670,1.1559);
  748. format(str, sizeof(str), "*** %s has stolen the other gang's vehicle! ***", playername);
  749. SendClientMessageToAll(COLOR_BRIGHTRED, "----------------------------------------------------------------------------");
  750. SendClientMessageToAll(COLOR_YELLOW, str);
  751. SendClientMessageToAll(COLOR_BRIGHTRED, "----------------------------------------------------------------------------");
  752.  
  753. }
  754. }
  755. return 1;
  756. }
  757.  
  758. // ----------------------------------------------------------------------------------------------------------------------//
  759. // ----------------------------------------------------------------------------------------------------------------------//
  760.  
  761. SetPlayerTeamFromClass(playerid, classid)
  762. {
  763. if(classid == 0 || classid == 1 || classid == 2)
  764. {
  765. gTeam[playerid] = TEAM_GROVE;
  766. }
  767. if(classid == 3 || classid == 4 || classid == 5)
  768. {
  769. gTeam[playerid] = TEAM_BALLA;
  770. }
  771. }
  772.  
  773. // ----------------------------------------------------------------------------------------------------------------------//
  774.  
  775. SetPlayerToTeamColor(playerid)
  776. {
  777. if (gTeam[playerid] == TEAM_GROVE)
  778. {
  779. SetPlayerColor(playerid, TEAM_GROVE_COLOR);
  780. }
  781. else if (gTeam[playerid] == TEAM_BALLA)
  782. {
  783. SetPlayerColor(playerid, TEAM_BALLA_COLOR);
  784. }
  785. }
  786.  
  787. // ----------------------------------------------------------------------------------------------------------------------//
  788.  
  789. strtok(const string[], &index)
  790. {
  791. new length = strlen(string);
  792. while ((index < length) && (string[index] <= ' '))
  793. {
  794. index++;
  795. }
  796.  
  797. new offset = index;
  798. new result[20];
  799. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  800. {
  801. result[index - offset] = string[index];
  802. index++;
  803. }
  804. result[index - offset] = EOS;
  805. return result;
  806. }
  807.  
  808. // ----------------------------------------------------------------------------------------------------------------------//
  809.  
  810. ScoreUpdate()
  811. {
  812. new string[256];
  813. format(string, sizeof(string), "Grove: %d Ballas: %d", grovescore, ballasscore);
  814. TextDrawSetString(Score, string);
  815. TextDrawShowForAll(Score);
  816. }
  817.  
  818. // ----------------------------------------------------------------------------------------------------------------------//
  819. // ----------------------------------------------------------------------------------------------------------------------//
  820.  
  821. public BlastBomb() // The /bomb timer
  822. {
  823. CreateExplosion(X, Y, Z, 10, 38.0);
  824. DestroyObject(dynamite);
  825. return 1;
  826. }
  827.  
  828. // ----------------------------------------------------------------------------------------------------------------------//
  829. // ----------------------------------------------------------------------------------------------------------------------//
  830.  
  831. public gmxtimer() // Server restart timer after one of the teams reaches 50 points.
  832. {
  833. SendRconCommand("gmx");
  834. return 1;
  835. }
  836.  
  837. // ----------------------------------------------------------------------------------------------------------------------//
  838. // ----------------------------------------------------------------------------------------------------------------------//
  839.  
  840. public GlobalAnnouncement()
  841. {
  842. switch (Msg)
  843. {
  844. case 0: {SendClientMessageToAll(COLOR_YELLOW,Announcements[0]); Msg++;}
  845. case 1: {SendClientMessageToAll(COLOR_YELLOW,Announcements[1]); Msg++;}
  846. case 2: {SendClientMessageToAll(COLOR_YELLOW,Announcements[2]); Msg++;}
  847. case 3: {SendClientMessageToAll(COLOR_YELLOW,Announcements[3]); Msg++;}
  848. case 4: {SendClientMessageToAll(COLOR_YELLOW,Announcements[4]); Msg = 0;}
  849. }
  850. return 1;
  851. }
  852.  
  853.  
  854. // ----------------------------------------------------------------------------------------------------------------------//
  855. // ----------------------------------------------------------------------------------------------------------------------//
  856. // ----------------------------------- End of the Gamemode -------------------------------------------------------//
  857. // ----------------------------------------------------------------------------------------------------------------------//
  858. // ----------------------------------------------------------------------------------------------------------------------//
Advertisement
Add Comment
Please, Sign In to add comment