Advertisement
Kwarde

MiniDM v1.1 [FIX]

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