Guest User

Joe Torran C

a guest
Jun 6th, 2010
627
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 8.03 KB | None | 0 0
  1. // [GM] Torran's Team Deathmatch
  2. // Made by Joe Torran C
  3. // DO NOT REMOVE THESE CREDITS
  4.  
  5. #include <a_samp>
  6.  
  7. #define TEAM_GROVE 1
  8. #define TEAM_BALLAS 2
  9.  
  10. #define colorRed 0xFF0000FF
  11. #define colorGrey 0x8F8F8F8F
  12. #define colorGreen 0x008000FF
  13. #define colorPurple 0x800080FF
  14. #define colorYellow 0xFFFF00FF
  15.  
  16. #define MINUTES 30 // Change this to how many minutes you want the server to last
  17.  
  18. forward UpdateTextdraw();
  19. forward EndRound();
  20. forward RestartServer();
  21.  
  22. new Float:GroveSpawns[][4] =
  23. {
  24.     {2473.3008, -1683.3898, 13.4502, 293.7029},
  25.     {2495.7344, -1686.4888, 13.5156, 346.3434},
  26.     {2510.3362, -1664.3955, 13.5796, 149.4711},
  27.     {2488.2644, -1646.2657, 14.0703, 141.4448}
  28. };
  29.  
  30. new Float:BallasSpawns[][4] =
  31. {
  32.     {2438.4995, -1221.7570, 25.1250, 122.8658},
  33.     {2442.0217, -1233.9084, 26.1863, 57.6919},
  34.     {2424.2144, -1249.0165, 23.8363, 57.3786},
  35.     {2402.0132, -1221.6392, 25.7077, 228.7735}
  36. };
  37.  
  38. new Text:ServerInfo;
  39.  
  40. new GroveKills;
  41. new BallasKills;
  42.  
  43. main()
  44. {
  45.     print("\n  >> || !! ** Torran's Team Deathmatch ** !! || <<  \n");
  46. }
  47.  
  48. public OnPlayerConnect(playerid)
  49. {
  50.     new str[128];
  51.     format(str, 128, "%s has joined Torrans TDM", GetName(playerid));
  52.     SendClientMessageToAll(colorYellow, str);
  53.    
  54.     TextDrawShowForPlayer(playerid, Text:ServerInfo);
  55.     return 1;
  56. }
  57.  
  58. public OnPlayerDisconnect(playerid, reason)
  59. {
  60.     new str[128];
  61.    
  62.     switch(reason)
  63.     {
  64.         case 0:
  65.         {
  66.             format(str, 128, "%s has left Torrans TDM - Reason: Lost Connection", GetName(playerid));
  67.             SendClientMessageToAll(colorYellow, str);
  68.         }
  69.         case 1:
  70.         {
  71.             format(str, 128, "%s has left Torrans TDM - Reason: Leaving", GetName(playerid));
  72.             SendClientMessageToAll(colorYellow, str);
  73.         }
  74.         case 2:
  75.         {
  76.             format(str, 128, "%s has left Torrans TDM - Reason: Kicked/Banned", GetName(playerid));
  77.             SendClientMessageToAll(colorYellow, str);
  78.         }
  79.     }
  80.     return 1;
  81. }
  82.  
  83. public OnPlayerRequestClass(playerid, classid)
  84. {
  85.     switch(classid)
  86.     {
  87.         case 0:
  88.         {
  89.             GameTextForPlayer(playerid, "~g~Team Grove", 1000, 4);
  90.         }
  91.         case 1:
  92.         {
  93.             GameTextForPlayer(playerid, "~g~Team Grove", 1000, 4);
  94.         }
  95.         case 2:
  96.         {
  97.             GameTextForPlayer(playerid, "~g~Team Grove", 1000, 4);
  98.         }
  99.         case 3:
  100.         {
  101.             GameTextForPlayer(playerid, "~p~Team Ballas", 1000, 4);
  102.         }
  103.         case 4:
  104.         {
  105.             GameTextForPlayer(playerid, "~p~Team Ballas", 1000, 4);
  106.         }
  107.         case 5:
  108.         {
  109.             GameTextForPlayer(playerid, "~p~Team Ballas", 1000, 4);
  110.         }
  111.     }
  112.    
  113.     SetPlayerColor(playerid, colorGrey);
  114.     return 1;
  115. }
  116.  
  117. public OnPlayerSpawn(playerid)
  118. {
  119.     switch(GetPlayerTeam(playerid))
  120.     {
  121.         case TEAM_GROVE:
  122.         {
  123.             new rand = random(sizeof GroveSpawns);
  124.  
  125.             SetPlayerFacingAngle(playerid, GroveSpawns[rand][3]);
  126.             SetPlayerPos(playerid, GroveSpawns[rand][0], GroveSpawns[rand][1], GroveSpawns[rand][2]);
  127.            
  128.             SetCameraBehindPlayer(playerid);
  129.             SetPlayerColor(playerid, colorGreen);
  130.         }
  131.         case TEAM_BALLAS:
  132.         {
  133.             new rand = random(sizeof BallasSpawns);
  134.  
  135.             SetPlayerFacingAngle(playerid, BallasSpawns[rand][3]);
  136.             SetPlayerPos(playerid, BallasSpawns[rand][0], BallasSpawns[rand][1], BallasSpawns[rand][2]);
  137.  
  138.             SetCameraBehindPlayer(playerid);
  139.             SetPlayerColor(playerid, colorPurple);
  140.         }
  141.     }
  142.     return 1;
  143. }
  144.  
  145. public OnPlayerDeath(playerid, killerid)
  146. {
  147.     if(IsPlayerConnected(killerid))
  148.     {
  149.         if(GetPlayerTeam(killerid) == TEAM_GROVE)
  150.         {
  151.             GroveKills ++;
  152.         }
  153.         else if(GetPlayerTeam(killerid) == TEAM_BALLAS)
  154.         {
  155.             BallasKills ++;
  156.         }
  157.     }
  158.     if(GetPlayerTeam(killerid) == GetPlayerTeam(playerid))
  159.     {
  160.         SendClientMessage(killerid, colorRed, "Do not teamkill, You have been punished");
  161.  
  162.         GivePlayerMoney(killerid, -1000);
  163.         SetPlayerScore(killerid, GetPlayerScore(playerid) -1);
  164.     }
  165.     else
  166.     {
  167.         GivePlayerMoney(killerid, 1000);
  168.         SetPlayerScore(killerid, GetPlayerScore(playerid) +1);
  169.     }
  170.     return 1;
  171. }
  172.  
  173. public OnGameModeInit()
  174. {
  175.     SetGameModeText("Torran's TDM");
  176.    
  177.     AddPlayerClassEx(TEAM_GROVE, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  178.     AddPlayerClassEx(TEAM_GROVE, 106, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  179.     AddPlayerClassEx(TEAM_GROVE, 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  180.     AddPlayerClassEx(TEAM_BALLAS, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  181.     AddPlayerClassEx(TEAM_BALLAS, 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  182.     AddPlayerClassEx(TEAM_BALLAS, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  183.  
  184.     AddStaticVehicle(579, 2443.5183, -1635.7461, 13.4134, 359.3588, 86, 86); // GroveVeh1
  185.     AddStaticVehicle(475, 2466.3037, -1655.0808, 13.1146, 90.0831, 86, 86); // GroveVeh2
  186.     AddStaticVehicle(567, 2468.5054, -1671.0854, 13.2716, 7.9673, 86, 86); // GroveVeh3
  187.     AddStaticVehicle(579, 2473.2747, -1693.1956, 13.5058, 0.5419, 86, 86); // GroveVeh4
  188.     AddStaticVehicle(567, 2486.3845, -1684.1335, 13.2882, 90.0206, 86, 86); // GroveVeh5
  189.     AddStaticVehicle(492, 2504.8928, -1680.0482, 13.2411, 319.2745, 86, 86); // GroveVeh6
  190.     AddStaticVehicle(579, 2508.9285, -1666.5764, 13.4543, 14.5889, 86, 86); // GroveVeh7
  191.     AddStaticVehicle(492, 2501.9983, -1656.5300, 13.2259, 242.1771, 86, 86); // GroveVeh8
  192.     AddStaticVehicle(412, 2485.2864, -1653.9381, 13.2178, 89.7112, 86, 86); // GroveVeh9
  193.     AddStaticVehicle(515, 2424.5168, -1641.3522, 14.5363, 181.0441, 86, 86); // GroveVeh10
  194.    
  195.     AddStaticVehicle(567, 2423.2512, -1242.9197, 23.9859, 3.7084, 99, 81); // BallasVehVeh1
  196.     AddStaticVehicle(567, 2426.5122, -1242.9724, 24.0399, 5.4733, 97, 96); // BallasVeh2
  197.     AddStaticVehicle(567, 2430.7012, -1242.7971, 24.1264, 4.1070, 93, 64); // BallasVeh3
  198.     AddStaticVehicle(567, 2434.9531, -1242.8007, 24.1783, 3.5572, 90, 96); // BallasVeh4
  199.     AddStaticVehicle(459, 2436.0439, -1223.5881, 25.1417, 180.4310, 28, 28); // BallasVeh5
  200.     AddStaticVehicle(459, 2431.1714, -1223.4000, 25.3555, 177.9173, 44, 44); // BallasVeh6
  201.     AddStaticVehicle(579, 2403.2712, -1222.2617, 25.3652, 265.4642, 53, 53); // BallasVeh7
  202.     AddStaticVehicle(579, 2403.0918, -1225.8868, 24.5954, 267.0836, 42, 42); // BallasVeh8
  203.     AddStaticVehicle(468, 2406.1084, -1230.6228, 23.5291, 266.9653, 6, 6); // BallasVeh9
  204.     AddStaticVehicle(468, 2406.2070, -1232.0331, 23.4677, 259.7325, 46, 46); // BallasVeh10
  205.     AddStaticVehicle(468, 2406.4124, -1233.1885, 23.4817, 269.7499, 53, 53); // BallasVeh11
  206.     AddStaticVehicle(461, 2406.3679, -1235.4971, 23.3928, 269.6771, 37, 1); // BallasVeh12
  207.     AddStaticVehicle(461, 2406.3005, -1238.1947, 23.4105, 270.2692, 53, 1); // BallasVeh13
  208.     AddStaticVehicle(461, 2405.8914, -1236.7000, 23.3766, 282.7488, 43, 1); // BallasVeh14
  209.    
  210.     ServerInfo = TextDrawCreate(500.000000, 110.000000, "~g~Server Info:~n~~n~~w~Players Online: %d~n~Kills by Grove: %d~n~Kills by Ballas: %d~n~~n~~g~Made by Joe Torran C");
  211.     TextDrawBackgroundColor(ServerInfo, 255);
  212.     TextDrawFont(ServerInfo, 1);
  213.     TextDrawLetterSize(ServerInfo, 0.300000, 1.000000);
  214.     TextDrawColor(ServerInfo, -1);
  215.     TextDrawSetOutline(ServerInfo, 1);
  216.     TextDrawSetProportional(ServerInfo, 1);
  217.     TextDrawUseBox(ServerInfo, 1);
  218.     TextDrawBoxColor(ServerInfo, 255);
  219.     TextDrawTextSize(ServerInfo, 620.000000, 0.000000);
  220.    
  221.     SetTimer("UpdateTextdraw", 1000, 1);
  222.     SetTimer("EndRound", MINUTES*60*1000, 0);
  223.     return 1;
  224. }
  225.  
  226. public UpdateTextdraw()
  227. {
  228.     new str[128];
  229.     format(str, 128, "~g~Server Info:~n~~n~~w~Players Online: %d~n~Kills by Grove: %d~n~Kills by BallasVeh: %d~n~~n~~g~Made by Joe Torran C", GetOnlinePlayers(), GroveKills, BallasKills);
  230.     return TextDrawSetString(Text:ServerInfo, str);
  231. }
  232.  
  233. public EndRound()
  234. {
  235.     if(GroveKills > BallasKills)
  236.     {
  237.         GameTextForAll("~g~Team Grove Wins!", 5000, 4);
  238.     }
  239.     else if(GroveKills < BallasKills)
  240.     {
  241.         GameTextForAll("~p~Team Ballas Wins!", 5000, 4);
  242.     }
  243.     else if(GroveKills == BallasKills)
  244.     {
  245.         GameTextForAll("~w~Its a draw!", 5000, 4);
  246.     }
  247.    
  248.     SetTimer("RestartServer", 5000, 0);
  249.     return 1;
  250. }
  251.  
  252. public RestartServer()
  253. {
  254.     SendRconCommand("gmx");
  255.     return 1;
  256. }
  257.  
  258. stock GetName(playerid)
  259. {
  260.     new name[MAX_PLAYER_NAME];
  261.     GetPlayerName(playerid, name, sizeof name);
  262.     return name;
  263. }
  264.  
  265. stock GetOnlinePlayers()
  266. {
  267.     new count, g = GetMaxPlayers();
  268.     for(new d; d < g; d++) if(IsPlayerConnected(d) && !IsPlayerNPC(d)) count++;
  269.     return count;
  270. }
Advertisement
Add Comment
Please, Sign In to add comment