Kwarde

Mini DM v1.1

Sep 27th, 2010
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 12.41 KB | None | 0 0
  1. /*
  2.     MiniDM v11.1 - A simple DM GameMode, but it's funny (A)
  3.     Every round has a duration of 10 minutes, and there are 2 rounds:
  4.     in round 1 you have light weapons, and in round 2 heavier weapons :')
  5.    
  6.     Enjoy the script
  7.    
  8.     CHANGELOG:
  9.     v1
  10.         - All Objects added
  11.         - Commands added: /help /rules /warn /kick /ban
  12.         - Basic Script Created
  13.     v1.1
  14.         - Some objects fixed (They where floating in the air)
  15.         - Command added: /nextround
  16.        
  17.     KNOWN BUGS:
  18.         - If you spam the command /nextround you will be spam spawned :P
  19. */
  20.  
  21. #include <a_samp>
  22. #include <dcmd>
  23.  
  24. #define COLOR_WHITE 0xFFFFFFAA
  25. #define COLOR_RED 0xFF0000AA
  26. #define COLOR_GREEN 0x00FF00AA
  27. #define COLOR_LIGHTBLUE 0x00FFFFAA
  28.  
  29. new Score[MAX_PLAYERS];
  30. new Warnings[MAX_PLAYERS];
  31. new RoundID = 0;
  32. new NewGameTimer;
  33.  
  34. new Float:RandomSpawns[7][4] = {
  35. {1435.382934,2280.698242,13.033525,344.327789},
  36. {1415.960937,2096.947998,11.001707,180.533401},
  37. {1315.572387,2111.987304,11.015625,131.966842},
  38. {1303.281738,2196.681884,11.037096,277.331512},
  39. {1410.766845,2102.556884,12.015625,1.073378},
  40. {1370.210083,2194.327636,9.757812,358.108337},
  41. {1330.223266,2215.177490,19.406250,184.223739}
  42. };
  43.  
  44. new RandomMsgs[][] = {
  45. "* Are you new here? Use /help",
  46. "* Please follow our /rules",
  47. "* This GameMode has been created by Kwarde",
  48. "* If you don't follow our /rules you will be banned/kicked/warned!"
  49. };
  50.  
  51. forward ShowCamera(playerid);
  52. forward ResetPlayer(playerid);
  53. forward SendRandomMsg();
  54. forward ResetGame();
  55. forward StartNewRound();
  56.  
  57. main()
  58. {
  59.     print("\n");
  60.     print("** MiniDM LasVenturas - Football Field loaded");
  61.     print("** Created by Kwarde, please don't remove any credits");
  62.     print(" ");
  63.     print("**** Enjoy the GameMode :D");
  64.     print("\n");
  65.     return 1;
  66. }
  67.  
  68. public OnGameModeInit()
  69. {
  70.     SetGameModeText("MiniDM v1");
  71.     SendRconCommand("mapname LV - Football Field");
  72.    
  73.     ShowPlayerMarkers(true);
  74.     ShowNameTags(true);
  75.     DisableInteriorEnterExits();
  76.    
  77.     CreateObject(8263, 1318.149536, 2063.798340, 12.821341, 0.0000, 0.0000, 0.0000);
  78.     CreateObject(8263, 1438.042725, 2063.778076, 12.795986, 0.0000, 0.0000, 0.0000);
  79.     CreateObject(8263, 1497.476196, 2123.434082, 12.771341, 0.0000, 0.0000, 90.2409);
  80.     CreateObject(8263, 1498.739746, 2243.222168, 12.871340, 0.0000, 0.0000, 88.5220);
  81.     CreateObject(8263, 1440.653809, 2302.424072, 12.896339, 0.0000, 0.0000, 180.4818);
  82.     CreateObject(8263, 1334.415405, 2264.187988, 12.913771, 0.0000, 0.0000, 219.1565);
  83.     CreateObject(8263, 1278.840332, 2166.981201, 12.932245, 0.0000, 0.0000, 261.2688);
  84.     CreateObject(8263, 1270.986328, 2122.315918, 12.791477, 0.0000, 0.0000, 257.8311);
  85.     CreateObject(11443, 1492.566284, 2293.657227, 9.992058, 0.0000, 0.0000, 271.4780);
  86.     CreateObject(11428, 1312.393311, 2113.099121, 14.919098, 0.0000, 0.0000, 219.0523);
  87.     CreateObject(16093, 1303.785156, 2196.073730, 9.904284, 0.0000, 0.0000, 0.0000);
  88.     CreateObject(16782, 1300.760742, 2197.145508, 10.979322, 0.0000, 0.8594, 359.9999);
  89.     CreateObject(4724, 1302.832397, 2196.314453, 11.800414, 0.0000, 0.0000, 269.8631);
  90.     CreateObject(4724, 1305.940308, 2196.336426, 11.814077, 0.0000, 0.0000, 269.8631);
  91.     CreateObject(4724, 1309.259033, 2196.355713, 11.825418, 0.0000, 0.0000, 269.8631);
  92.     CreateObject(4724, 1314.312378, 2197.133057, 8.376222, 0.0000, 271.4780, 269.8631);
  93.     CreateObject(4724, 1311.080811, 2197.123535, 8.375280, 0.0000, 271.4780, 269.8631);
  94.     CreateObject(4724, 1307.792114, 2197.312256, 8.389070, 0.0000, 271.4780, 269.8631);
  95.     CreateObject(4724, 1301.155151, 2196.976563, 8.414076, 0.0000, 271.4780, 90.3447);
  96.     CreateObject(4724, 1308.573730, 2191.544434, 8.035886, 0.0000, 271.4780, 179.7262);
  97.     CreateObject(4724, 1305.310425, 2191.531494, 8.089073, 0.0000, 271.4780, 179.7262);
  98.     CreateObject(4724, 1302.463013, 2191.543945, 8.420501, 0.0000, 271.4780, 179.7262);
  99.     CreateObject(1411, 1312.945557, 2190.937500, 11.632692, 0.0000, 0.0000, 0.8594);
  100.     CreateObject(1411, 1318.079468, 2190.931152, 11.682692, 0.0000, 0.0000, 0.8594);
  101.     CreateObject(1411, 1315.623291, 2198.974121, 15.200565, 0.0000, 0.0000, 177.9035);
  102.     CreateObject(1411, 1310.533081, 2198.892334, 15.216631, 0.0000, 0.0000, 180.4818);
  103.     CreateObject(1411, 1305.330200, 2198.895996, 15.303722, 0.0000, 0.0000, 180.4818);
  104.     CreateObject(1411, 1300.103394, 2198.820557, 15.234255, 0.0000, 0.0000, 180.4818);
  105.     CreateObject(1411, 1320.679077, 2193.446777, 11.632692, 0.0000, 0.0000, 85.9437);
  106.     CreateObject(3586, 1330.500488, 2192.587158, 11.050318, 0.0000, 0.0000, 180.3776);
  107.     CreateObject(17061, 1382.349121, 2139.080322, 9.932911, 0.0000, 0.0000, 87.6625);
  108.     CreateObject(12920, 1383.289429, 2124.404297, 10.001697, 0.0000, 0.0000, 178.7628);
  109.     CreateObject(17059, 1376.500854, 2127.575439, 13.372147, 0.0000, 0.0000, 0.0000);
  110.     CreateObject(18267, 1436.013916, 2284.692139, 11.955400, 0.0000, 0.0000, 356.5623);
  111.     CreateObject(16326, 1421.181274, 2099.179443, 7.388551, 0.0000, 0.0000, 90.2409);
  112.     CreateObject(6965, 1341.116089, 2155.819580, 13.728113, 0.0000, 0.0000, 0.0000);
  113.    
  114.     for(new skins = 0; skins < 299; skins++)
  115.     {
  116.         AddPlayerClass(skins, 0, 0, 0, 270, 0, 0, 0, 0, 0, 0);
  117.     }
  118.    
  119.     SetTimer("SendRandomMsg", 60000, true);
  120.     NewGameTimer = SetTimer("ResetGame", 600000, true);
  121.     return 1;
  122. }
  123.  
  124. public OnPlayerRequestClass(playerid)
  125. {
  126.     ShowCamera(playerid);
  127.     return 1;
  128. }
  129.  
  130. public OnPlayerUpdate(playerid)
  131. {
  132.     new string[128],pName[MAX_PLAYER_NAME];
  133.     GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
  134.  
  135.     if(GetPlayerMoney(playerid) > 0 || GetPlayerMoney(playerid) < 0)
  136.     {
  137.         format(string, sizeof(string), "** %s has been banned: Money Hack", pName);
  138.         SendClientMessageToAll(COLOR_RED, string);
  139.         BanEx(playerid, "Money Hack");
  140.     }
  141.     if(GetPlayerScore(playerid) > Score[playerid])
  142.     {
  143.         format(string, sizeof(string), "** %s has been banned: Score Hack", pName);
  144.         SendClientMessageToAll(COLOR_RED, string);
  145.         BanEx(playerid, "Score Hack");
  146.     }
  147.     if(GetPlayerWeapon(playerid) == 38)
  148.     {
  149.         format(string, sizeof(string), "** %s has been banned: Minigun", pName);
  150.         SendClientMessageToAll(COLOR_RED, string);
  151.         BanEx(playerid, "Minigun");
  152.     }
  153.     return 1;
  154. }
  155.  
  156. public OnPlayerSpawn(playerid)
  157. {
  158.     new rand = random(sizeof(RandomSpawns));
  159.     SetPlayerPos(playerid, RandomSpawns[rand][0], RandomSpawns[rand][1], RandomSpawns[rand][2]);
  160.     SetPlayerFacingAngle(playerid, RandomSpawns[rand][3]);
  161.    
  162.     if(RoundID == 0)
  163.     {
  164.         SetPlayerHealth(playerid, 100);
  165.         SetPlayerArmour(playerid, 0);
  166.  
  167.         GivePlayerWeapon(playerid, 4, 1);
  168.         GivePlayerWeapon(playerid, 16, 4);
  169.         GivePlayerWeapon(playerid, 22, 450);
  170.         GivePlayerWeapon(playerid, 33, 150);
  171.         return 1;
  172.     }
  173.     if(RoundID == 1)
  174.     {
  175.         SetPlayerHealth(playerid, 100);
  176.         SetPlayerArmour(playerid, 150);
  177.        
  178.         GivePlayerWeapon(playerid, 4, 1);
  179.         GivePlayerWeapon(playerid, 18, 15);
  180.         GivePlayerWeapon(playerid, 24, 250);
  181.         GivePlayerWeapon(playerid, 27, 75);
  182.         GivePlayerWeapon(playerid, 35, 2);
  183.     }
  184.     return 1;
  185. }
  186.  
  187. public OnPlayerCommandText(playerid, cmdtext[])
  188. {
  189.     dcmd(help, 4, cmdtext);
  190.     dcmd(rules, 5, cmdtext);
  191.    
  192.     dcmd(ah, 2, cmdtext);
  193.     dcmd(kick, 4, cmdtext);
  194.     dcmd(ban, 3, cmdtext);
  195.     dcmd(warn, 4, cmdtext);
  196.     dcmd(nextround, 9, cmdtext);
  197.     return 1;
  198. }
  199.  
  200. public OnPlayerDeath(playerid, killerid, reason)
  201. {
  202.     SendDeathMessage(killerid, playerid, reason);
  203.    
  204.     Score[killerid] ++;
  205.     SetPlayerScore(killerid, Score[killerid]);
  206.     return 1;
  207. }
  208.  
  209. public OnPlayerConnect(playerid)
  210. {
  211.     ResetPlayer(playerid);
  212.     return 1;
  213. }
  214.  
  215. public ShowCamera(playerid)
  216. {
  217.     SetPlayerInterior(playerid,0);
  218.     SetPlayerPos(playerid, -853.4641,-881.7031,149.6406);
  219.     SetPlayerCameraPos(playerid, -850.4641,-878.7031,149.6406);
  220.     SetPlayerCameraLookAt(playerid, -853.4641,-881.7031,149.6406);
  221.     return 1;
  222. }
  223.  
  224. public ResetPlayer(playerid)
  225. {
  226.     Score[playerid] = 0;
  227.     Warnings[playerid] = 0;
  228.     SetPlayerScore(playerid, 0);
  229.     SetPlayerHealth(playerid, 100);
  230.     return 1;
  231. }
  232.  
  233. public SendRandomMsg()
  234. {
  235.     new rand = random(sizeof(RandomMsgs));
  236.     SendClientMessageToAll(COLOR_LIGHTBLUE, RandomMsgs[rand][0]);
  237.     return 1;
  238. }
  239.  
  240. public ResetGame()
  241. {
  242.     for(new i = 0; i < MAX_PLAYERS; i++)
  243.     {
  244.         TogglePlayerControllable(i, false);
  245.     }
  246.    
  247.     if(RoundID == 0){
  248.         RoundID = 1;
  249.     }
  250.     else{
  251.         RoundID = 0;
  252.     }
  253.    
  254.     SendClientMessageToAll(COLOR_GREEN, "** This round has been ended! The new round will start in +- 5 seconds");
  255.     SetTimer("StartNewRound", 5000, false);
  256.     return 1;
  257. }
  258.  
  259. public StartNewRound()
  260. {
  261.     for(new i = 0; i < MAX_PLAYERS; i++)
  262.     {
  263.         TogglePlayerControllable(i, true);
  264.         SpawnPlayer(i);
  265.     }
  266.     SendClientMessageToAll(COLOR_GREEN, "** The new round has been started");
  267.     return 1;
  268. }
  269.  
  270. dcmd_help(playerid, params[])
  271. {
  272.     #pragma unused params
  273.    
  274.     SendClientMessage(playerid, COLOR_LIGHTBLUE, "|----- Help! -----|");
  275.     SendClientMessage(playerid, COLOR_WHITE, "All you have to do here is: Kill EVERYONE!");
  276.     SendClientMessage(playerid, COLOR_WHITE, "This is a DeathMatch server, no cheats allowed! And listen to the /rules");
  277.     if(IsPlayerAdmin(playerid)) SendClientMessage(playerid, COLOR_GREEN, "Admin Commands: /ah");
  278. }
  279.  
  280. dcmd_rules(playerid, params[])
  281. {
  282.     #pragma unused params
  283.    
  284.     SendClientMessage(playerid, COLOR_LIGHTBLUE, "|----- Rules -----|");
  285.     SendClientMessage(playerid, COLOR_WHITE, "1) Don't cheat/hack");
  286.     SendClientMessage(playerid, COLOR_WHITE, "2) Don't spawnkill please!");
  287.     SendClientMessage(playerid, COLOR_WHITE, "3) Don't spam or flood the server, making advertisements is forbidden too!");
  288.     SendClientMessage(playerid, COLOR_WHITE, "4) Play well, don't curse and threat everyone (except rules-breakers) with respect!");
  289. }
  290.  
  291. dcmd_ah(playerid, params[])
  292. {
  293.     #pragma unused params
  294.    
  295.     if(IsPlayerAdmin(playerid))
  296.     {
  297.         SendClientMessage(playerid, COLOR_RED, "|----- Admin Commands -----|");
  298.         SendClientMessage(playerid, COLOR_WHITE, "/kick [playerid] [reason]");
  299.         SendClientMessage(playerid, COLOR_WHITE, "/ban [playerid] [reason]");
  300.         SendClientMessage(playerid, COLOR_WHITE, "/warn [playerid] [reason]");
  301.         SendClientMessage(playerid, COLOR_WHITE, "/nextround");
  302.     }
  303. }
  304.  
  305. dcmd_kick(playerid, params[])
  306. {
  307.     if(IsPlayerAdmin(playerid))
  308.     {
  309.         new id,reason[50],string[128],aName[MAX_PLAYER_NAME],pName[MAX_PLAYER_NAME];
  310.         if(sscanf(params, "uz", id, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /kick [playerid] [reason]");
  311.         if(id == INVALID_PLAYER_ID || !IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "That player isn't connected");
  312.         GetPlayerName(playerid, aName, MAX_PLAYER_NAME); GetPlayerName(id, pName, MAX_PLAYER_NAME);
  313.         format(string, sizeof(string), "** %s has been kicked by %s, Reason: %s", pName, aName, reason);
  314.         SendClientMessageToAll(COLOR_RED, string);
  315.         Kick(id);
  316.     }
  317.     return 2;
  318. }
  319.  
  320. dcmd_ban(playerid, params[])
  321. {
  322.     if(IsPlayerAdmin(playerid))
  323.     {
  324.         new id,reason[50],string[128],aName[MAX_PLAYER_NAME],pName[MAX_PLAYER_NAME];
  325.         if(sscanf(params, "uz", id, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid] [reason]");
  326.         if(id == INVALID_PLAYER_ID || !IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "That player isn't connected");
  327.         GetPlayerName(playerid, aName, MAX_PLAYER_NAME); GetPlayerName(id, pName, MAX_PLAYER_NAME);
  328.         format(string, sizeof(string), "** %s has been banned by %s, Reason: %s", pName, aName, reason);
  329.         SendClientMessageToAll(COLOR_RED, string);
  330.         BanEx(id, reason);
  331.     }
  332.     return 1;
  333. }
  334.  
  335. dcmd_warn(playerid, params[])
  336. {
  337.     if(IsPlayerAdmin(playerid))
  338.     {
  339.         new id,reason[50],string[128],aName[MAX_PLAYER_NAME],pName[MAX_PLAYER_NAME];
  340.         if(sscanf(params, "uz", id, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid] [reason]");
  341.         if(id == INVALID_PLAYER_ID || !IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "That player isn't connected");
  342.         GetPlayerName(playerid, aName, MAX_PLAYER_NAME); GetPlayerName(id, pName, MAX_PLAYER_NAME);
  343.         format(string, sizeof(string), "** %s has been warned by %s, Reason: %s", pName, aName, reason);
  344.         SendClientMessageToAll(COLOR_RED, string);
  345.         Warnings[id] ++;
  346.         if(Warnings[id] >= 3){
  347.             format(string, sizeof(string), "** %s has been kicked by %s, Reason: Last Warnings [Last warn: %s]", pName, aName, reason);
  348.             Kick(id);
  349.             return 1;
  350.         }
  351.     }
  352.     return 1;
  353. }
  354.  
  355. dcmd_nextround(playerid, params[])
  356. {
  357.     #pragma unused params
  358.    
  359.     if(IsPlayerAdmin(playerid))
  360.     {
  361.         KillTimer(NewGameTimer);
  362.         ResetGame();
  363.         NewGameTimer = SetTimer("ResetGame", 600000, true);
  364.     }
  365.     return 1;
  366. }
Add Comment
Please, Sign In to add comment