Advertisement
Guest User

Modern Team Death Match

a guest
Mar 6th, 2011
533
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 32.98 KB | None | 0 0
  1. // .:--------------------------------------------------------------:.
  2. // .:==============================================================:.
  3. //                { M - TDM V0.1 FOR 0.3C BY Soumi }
  4. //                 Credits : *Me for doing this :D
  5. //                           *cloudysky for mapping
  6. //                           *SA-MP team of course
  7. //          "and for everyone who helped me to make this script"
  8. // .:==============================================================:.
  9. // .:--------------------------------------------------------------:.
  10.  
  11. #include <a_samp>
  12.  
  13.  
  14. //Teams Define
  15. #define TEAM_POLICE 1
  16. #define TEAM_HOBOS 2
  17. #define TEAM_GROVE 3
  18. #define TEAM_MAFIA 4
  19. //Colours Define
  20. #define TEAM_POLICE_COLOUR 0x2641FEAA
  21. #define TEAM_HOBOS_COLOUR 0x800000AA
  22. #define TEAM_GROVE_COLOUR 0x33AA33AA
  23. #define TEAM_MAFIA_COLOUR 0xF5DEB3AA
  24. #define COLOR_WHITE 0xFFFFFFFF
  25. #define COLOR_GREEN 0x33AA33AA
  26. #define COLOR_RED 0xA10000AA
  27. #define COLOR_YELLOW 0xFFFF00AA
  28.  
  29. new gTeam[MAX_PLAYERS];
  30. new Menu:ammunationmenu;
  31. new Text:txt1;
  32. new ammunationenter;
  33. new ammunationexit;
  34. new drugpickup;
  35. new Float:pArmour;
  36. new pMoney;
  37. new Float:pHealth;
  38. new pScore;
  39. new wLevel;
  40.  
  41. forward HourTimer(playerid);
  42. #if defined FILTERSCRIPT
  43. #else
  44.  
  45. main()
  46. {
  47.     print("\n--------------------------------------");
  48.     print("               M-TDM V0.1               ");
  49.     print("               By {Soumi}               ");
  50.     print("--------------------------------------\n");
  51. }
  52.  
  53. #endif
  54.  
  55. public OnGameModeInit()
  56. {
  57.     //-----------------------------------------
  58.     AllowAdminTeleport(1);
  59.     AllowInteriorWeapons(1);
  60.     DisableInteriorEnterExits();
  61.     ShowPlayerMarkers(0);
  62.     SetTeamCount(4);
  63.     //-----------------------------------------
  64.     //Game mode
  65.     SetGameModeText("M-TDM V0.1");
  66.     //-----------------------------------------
  67.     //Teams spawn :
  68.     //Police :
  69.     AddPlayerClass(280,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
  70.     AddPlayerClass(281,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
  71.     AddPlayerClass(282,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
  72.     AddPlayerClass(283,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
  73.     AddPlayerClass(285,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
  74.     AddPlayerClass(288,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
  75.     AddPlayerClass(286,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
  76.     AddPlayerClass(192,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
  77.     //Hobos :
  78.     AddPlayerClass(134,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
  79.     AddPlayerClass(135,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
  80.     AddPlayerClass(137,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
  81.     AddPlayerClass(212,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
  82.     AddPlayerClass(230,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
  83.     AddPlayerClass(239,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
  84.     AddPlayerClass(77,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
  85.     //Grove :
  86.     AddPlayerClass(105,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
  87.     AddPlayerClass(106,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
  88.     AddPlayerClass(107,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
  89.     AddPlayerClass(269,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
  90.     AddPlayerClass(270,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
  91.     AddPlayerClass(271,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
  92.     AddPlayerClass(298,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
  93.     //Mafia :
  94.     AddPlayerClass(111,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
  95.     AddPlayerClass(113,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
  96.     AddPlayerClass(124,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
  97.     AddPlayerClass(125,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
  98.     AddPlayerClass(126,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
  99.     AddPlayerClass(127,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
  100.     AddPlayerClass(194,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
  101.     //-----------------------------------------
  102.     //Pickups
  103.     //Team Spawn Pickups
  104.     //With a 3D text in each spawn pickup
  105.     CreatePickup(1314,1,1305.4125,-786.8438,1084.0078);
  106.     Create3DTextLabel("Police Spawn",0xFF00FFFF,1305.4125,-786.8438,1084.0078,6.0,0);
  107.     CreatePickup(1314,1,1265.8604,-777.2852,1084.0078);
  108.     Create3DTextLabel("Hobos Spawn",0xFF00FFFF,1265.8604,-777.2852,1084.0078,6.0,0);
  109.     CreatePickup(1314,1,1267.8646,-810.1602,1084.0078);
  110.     Create3DTextLabel("Grove Spawn",0xFF00FFFF,1267.8646,-810.1602,1084.0078,6.0,0);
  111.     CreatePickup(1314,1,1282.1912,-824.7309,1085.6328);
  112.     Create3DTextLabel("Mafia Spawn",0xFF00FFFF,1282.1912,-824.7309,1085.6328,6.0,0);
  113.     //Drugs/Ammunation Pickups
  114.     //with 3D text in each pickup too , it helps the player to
  115.     //know what is that pickup for
  116.     drugpickup = CreatePickup(1279,1,1248.7208,-806.1448,1084.0078);
  117.     Create3DTextLabel("Drug Point",0x33AA33AA,1248.7208,-806.1448,1084.0078,6.0,0);
  118.     ammunationenter = CreatePickup(1318,1,1271.4468,-822.4473,1089.9375);
  119.     Create3DTextLabel("Ammu-Nation",0xFFFF00AA,1271.4468,-822.4473,1089.9375,6.0,0);
  120.     ammunationexit = CreatePickup(1318,1,286.0389,-29.8492,1001.5156);
  121.     //-----------------------------------------
  122.     //Menus
  123.     //The ammunation menu , you can type /buygun at the ammuation to
  124.     //see this menu that allows you to select the weapon you want to buy
  125.     ammunationmenu = CreateMenu("AmmuNation :", 2, 200.0, 100.0, 150.0, 150.0);
  126.     AddMenuItem(ammunationmenu, 0, "AK47             $8000");
  127.     AddMenuItem(ammunationmenu, 0, "M4               $9000");
  128.     AddMenuItem(ammunationmenu, 0, "MP5              $4000");
  129.     AddMenuItem(ammunationmenu, 0, "UZI              $4000");
  130.     AddMenuItem(ammunationmenu, 0, "SPAS12           $7500");
  131.     AddMenuItem(ammunationmenu, 0, "Deagle           $5000");
  132.     AddMenuItem(ammunationmenu, 0, "Sniper           $10.000");
  133.     AddMenuItem(ammunationmenu, 0, "Rocket launcher  $50.000");
  134.     //-----------------------------------------
  135.     //Timers
  136.     //Note : 3600000 = 1Hour
  137.     SetTimer("HourTimer",3600000,true);
  138.     //Objects By cloudysky
  139.     //Maddog Mansion Objects :
  140.     CreateObject(3015, 1283.4685058594, -783.25317382813, 1088.9375, 0, 0, 0);
  141.     CreateObject(18257, 1268.6064453125, -777.88317871094, 1090.90625, 0, 0, 0);
  142.     CreateObject(1685, 1280.4525146484, -782.69390869141, 1089.6875, 0, 0, 0);
  143.     CreateObject(1685, 1283.951171875, -787.72045898438, 1089.6875, 0, 0, 0);
  144.     CreateObject(1685, 1280.6843261719, -794.84375, 1089.6875, 0, 0, 0);
  145.     CreateObject(1685, 1283.6586914063, -802.11389160156, 1089.6875, 0, 0, 0);
  146.     CreateObject(1685, 1280.6539306641, -810.66033935547, 1089.6875, 0, 0, 0);
  147.     CreateObject(1685, 1283.9046630859, -816.2861328125, 1089.6875, 0, 0, 0);
  148.     CreateObject(944, 1282.9704589844, -832.66619873047, 1089.822265625, 0, 0, 0);
  149.     CreateObject(3013, 1282.4670410156, -833.52166748047, 1089.0847167969, 0, 0, 0);
  150.     CreateObject(18257, 1279.267578125, -836.28381347656, 1084.6328125, 0, 0, 270);
  151.     CreateObject(964, 1270.8817138672, -830.07318115234, 1084.6328125, 0, 0, 0);
  152.     CreateObject(964, 1270.9008789063, -830.06182861328, 1085.5985107422, 0, 0, 0);
  153.     CreateObject(964, 1270.8041992188, -828.09484863281, 1084.6328125, 0, 0, 0);
  154.     CreateObject(964, 1270.8045654297, -828.09490966797, 1085.5985107422, 0, 0, 0);
  155.     CreateObject(964, 1270.9875488281, -830.00482177734, 1086.5642089844, 0, 0, 0);
  156.     CreateObject(964, 1270.9973144531, -828.74108886719, 1086.5642089844, 0, 0, 0);
  157.     CreateObject(964, 1270.9912109375, -827.59020996094, 1086.5642089844, 0, 0, 0);
  158.     CreateObject(2974, 1288.6882324219, -832.89422607422, 1084.6328125, 0, 0, 0);
  159.     CreateObject(2912, 1262.5721435547, -831.54174804688, 1083.0148925781, 0, 0, 0);
  160.     CreateObject(2912, 1262.5548095703, -831.54541015625, 1083.71484375, 0, 0, 0);
  161.     CreateObject(930, 1262.7761230469, -832.22424316406, 1083.4907226563, 0, 0, 0);
  162.     CreateObject(1685, 1263.0493164063, -835.00860595703, 1083.7648925781, 0, 0, 0);
  163.     CreateObject(1685, 1263.0401611328, -838.27423095703, 1083.7578125, 0, 0, 0);
  164.     CreateObject(1685, 1281.0793457031, -822.1123046875, 1089.6875, 0, 0, 0);
  165.     CreateObject(2991, 1254.3442382813, -828.16259765625, 1083.6354980469, 0, 0, 0);
  166.     CreateObject(2991, 1235.5437011719, -833.06286621094, 1083.6354980469, 0, 0, 90);
  167.     CreateObject(2975, 1239.3370361328, -826.60205078125, 1082.15625, 0, 0, 0);
  168.     CreateObject(2975, 1249.0526123047, -831.75555419922, 1083.0148925781, 0, 0, 0);
  169.     CreateObject(2975, 1251.1234130859, -835.57684326172, 1083.0078125, 0, 0, 0);
  170.     CreateObject(2975, 1248.3004150391, -838.54870605469, 1083.0078125, 0, 0, 0);
  171.     CreateObject(925, 1229.7275390625, -836.10113525391, 1084.0697021484, 0, 0, 0);
  172.     CreateObject(925, 1235.4520263672, -838.2861328125, 1084.0697021484, 0, 0, 0);
  173.     CreateObject(1431, 1227.451171875, -830.45275878906, 1083.5554199219, 0, 0, 0);
  174.     CreateObject(1431, 1227.4953613281, -826.00225830078, 1083.5554199219, 0, 0, 0);
  175.     CreateObject(1685, 1229.1007080078, -815.25439453125, 1083.7578125, 0, 0, 0);
  176.     CreateObject(1685, 1229.1105957031, -817.37756347656, 1083.7578125, 0, 0, 0);
  177.     CreateObject(930, 1240.0802001953, -811.35986328125, 1083.4836425781, 0, 0, 90);
  178.     CreateObject(930, 1240.2679443359, -813.39324951172, 1083.4836425781, 0, 0, 0);
  179.     CreateObject(1431, 1232.015625, -812.86987304688, 1083.5554199219, 0, 0, 90);
  180.     CreateObject(1431, 1228.6192626953, -808.72845458984, 1083.5554199219, 0, 0, 0);
  181.     CreateObject(2567, 1249.3779296875, -811.3125, 1084.9354248047, 0, 0, 0);
  182.     CreateObject(942, 1271.5297851563, -798.40734863281, 1085.4510498047, 0, 0, 0);
  183.     CreateObject(935, 1260.9449462891, -802.34149169922, 1083.5710449219, 0, 0, 0);
  184.     CreateObject(935, 1261.9300537109, -802.35845947266, 1083.5710449219, 0, 0, 0);
  185.     CreateObject(935, 1262.9259033203, -802.33630371094, 1083.5710449219, 0, 0, 0);
  186.     CreateObject(935, 1263.9537353516, -802.25360107422, 1083.5710449219, 0, 0, 0);
  187.     CreateObject(1431, 1258.5804443359, -804.14392089844, 1083.5554199219, 0, 0, 90);
  188.     CreateObject(1431, 1281.3435058594, -800.90148925781, 1083.5554199219, 0, 0, 0);
  189.     CreateObject(1431, 1283.4188232422, -800.81677246094, 1083.5554199219, 0, 0, 0);
  190.     CreateObject(1685, 1284.7239990234, -798.10766601563, 1083.7578125, 0, 0, 0);
  191.     CreateObject(1685, 1283.6350097656, -792.51336669922, 1083.7578125, 0, 0, 0);
  192.     CreateObject(1685, 1267.0187988281, -793.64581298828, 1083.7578125, 0, 0, 0);
  193.     CreateObject(925, 1274.7543945313, -786.8017578125, 1084.0767822266, 0, 0, 0);
  194.     CreateObject(944, 1270.1082763672, -789.45581054688, 1083.892578125, 0, 0, 90);
  195.     CreateObject(935, 1275.0075683594, -790.5966796875, 1083.5710449219, 0, 0, 0);
  196.     CreateObject(935, 1274.9952392578, -789.80413818359, 1083.5710449219, 0, 0, 0);
  197.     CreateObject(935, 1253.4654541016, -791.03802490234, 1083.5710449219, 0, 0, 0);
  198.     CreateObject(935, 1254.0161132813, -790.20257568359, 1083.5710449219, 0, 0, 0);
  199.     CreateObject(1337, 1254.1267089844, -789.33032226563, 1083.6569824219, 0, 0, 0);
  200.     CreateObject(1299, 1250.0831298828, -787.16754150391, 1083.4636230469, 0, 0, 0);
  201.     CreateObject(1299, 1242.6888427734, -780.49841308594, 1083.470703125, 0, 0, 0);
  202.     CreateObject(1299, 1240.1783447266, -763.10949707031, 1083.4650878906, 0, 0, 0);
  203.     CreateObject(12957, 1235.8734130859, -763.90338134766, 1083.8853759766, 0, 0, 245);
  204.     CreateObject(1227, 1250.9050292969, -772.07415771484, 1083.8594970703, 0, 0, 0);
  205.     CreateObject(1224, 1248.5551757813, -767.53466796875, 1083.6291503906, 0, 0, 0);
  206.     CreateObject(1224, 1261.8525390625, -779.00042724609, 1083.6226806641, 0, 0, 0);
  207.     CreateObject(1224, 1266.3231201172, -778.13940429688, 1083.6226806641, 0, 0, 0);
  208.     CreateObject(3594, 1289.2827148438, -773.94354248047, 1083.6390380859, 0, 0, 0);
  209.     CreateObject(1440, 1283.6583251953, -783.63342285156, 1083.5269775391, 0, 0, 0);
  210.     CreateObject(2744, 1284.6867675781, -782.10870361328, 1085.0920410156, 0, 0, 270);
  211.     CreateObject(932, 1299.5815429688, -782.56298828125, 1083.0078125, 0, 0, 0);
  212.     CreateObject(932, 1298.8043212891, -782.55981445313, 1083.0078125, 0, 0, 0);
  213.     CreateObject(910, 1299.0833740234, -780.38854980469, 1084.2769775391, 0, 0, 90);
  214.     return 1;
  215. }
  216.  
  217. public OnGameModeExit()
  218. {
  219.     //it is showen when you exit the Gamemode
  220.     print("GTA-TDM By .:'{Soumi}':.");
  221.     return 1;
  222. }
  223.  
  224. public OnPlayerRequestClass(playerid, classid)
  225. {
  226.     //----------------------------------
  227.     //a sound will be playing while the player is choosing a class
  228.     PlayerPlaySound(playerid, 1062, 0.0, 0.0, 2.0);
  229.     ApplyAnimation(playerid,"PED","WALK_gang1",4.1,1,1,1,1,1);
  230.     SetPlayerTeamFromClass(playerid,classid); // This sets the palyer team from class
  231.     //----------------------------------
  232.     //This is what the player Position when he's selecting a class
  233.     SetPlayerPos(playerid,1286.1554,-774.1998,1091.9063);
  234.     SetPlayerFacingAngle(playerid,0.0);
  235.     SetPlayerCameraPos(playerid,1282.0900,-772.8223,1091.9063);
  236.     SetPlayerCameraLookAt(playerid,1286.1554,-774.1998,1091.9063);
  237.     SetPlayerInterior(playerid,5);
  238.     //-----------------------------------
  239.     return 1;
  240. }
  241.  
  242. public OnPlayerConnect(playerid)
  243. {
  244.     //-----------------------------------------
  245.     GameTextForPlayer(playerid,"~w~Modern Team Dm !",3000,4);
  246.     SendClientMessage(playerid,0xA10000AA,"Welcome to {88AA88}Modern{FFFFFF}-TDM");
  247.     //-----------------------------------------
  248.     //This sends a message to all the palyers when someone join the server
  249.     new str[128], pName[24];
  250.     GetPlayerName(playerid, pName, 24);
  251.     format(str, 128, "(Connecting) %s has Joined Modern TDM Server.", pName);
  252.     SendClientMessageToAll(0xA10000AA,str);
  253.     //----------------------------------------
  254.     return 1;
  255. }
  256.  
  257. public OnPlayerDisconnect(playerid, reason)
  258. {
  259.     //----------------------------------
  260.     //also this sends a message to all the players when someone exit the server
  261.     new str[128], pName[24];
  262.     GetPlayerName(playerid, pName, 24);
  263.     format(str, 128, "(Leaving) %s has left Modern TDM Server.", pName);
  264.     SendClientMessageToAll(0xA10000AA,str);
  265.     //-----------------------------------
  266.     return 1;
  267. }
  268.  
  269. public OnPlayerSpawn(playerid)
  270. {
  271.     //-----------------------------------
  272.     //when the player spawn , he'll see this text at the bottom of the screen
  273.     //near the mini-map
  274.     txt1 = TextDrawCreate(10.0, 415.0,"~r~Modern Team Deathmatch");
  275.     TextDrawBoxColor(txt1,0x222222BB);
  276.     TextDrawLetterSize(txt1,0.3,1.0);
  277.     TextDrawTextSize(txt1,400.0,40.0);
  278.     TextDrawFont(txt1, 2);
  279.     TextDrawShowForPlayer(playerid,txt1);
  280.     //-----------------------------------
  281.     //This stops the sound that was playing when player is selecting a class
  282.     PlayerPlaySound(playerid,1063, 0.0, 0.0, 2.0);
  283.     SetPlayerToTeamColour(playerid); //This sets the player color from his team
  284.     SetPlayerInterior(playerid,5);
  285.     SetPlayerHealth(playerid,100);
  286.     SetPlayerArmour(playerid,100);
  287.     //------------------------------------
  288.     //Player will have the Maximum of all the weapons that are used in the gamemode
  289.     SetPlayerSkillLevel(playerid,22,9999);
  290.     SetPlayerSkillLevel(playerid,23,9999);
  291.     SetPlayerSkillLevel(playerid,24,9999);
  292.     SetPlayerSkillLevel(playerid,25,9999);
  293.     SetPlayerSkillLevel(playerid,26,9999);
  294.     SetPlayerSkillLevel(playerid,27,9999);
  295.     SetPlayerSkillLevel(playerid,28,9999);
  296.     SetPlayerSkillLevel(playerid,29,9999);
  297.     SetPlayerSkillLevel(playerid,30,9999);
  298.     SetPlayerSkillLevel(playerid,31,9999);
  299.     SetPlayerSkillLevel(playerid,32,9999);
  300.     SetPlayerSkillLevel(playerid,34,9999);
  301.     //------------------------------------
  302.     return 1;
  303. }
  304.  
  305. public OnPlayerDeath(playerid, killerid, reason)
  306. {
  307.     //------------------------------------
  308.     //When player dies , He'll loose $500 and he'll respawn of course
  309.     //but the one who killed him will get $1000 and + wanted level
  310.     //also he'll get +1 score and death message will be send to the otehr players
  311.     wLevel = GetPlayerWantedLevel(playerid);
  312.     pMoney = GetPlayerMoney(playerid),
  313.     GivePlayerMoney(killerid, 1000);
  314.     SetPlayerWantedLevel(killerid, wLevel + 1);
  315.     ResetPlayerMoney(playerid);
  316.     GivePlayerMoney(playerid, pMoney -500),
  317.     //------------------------------------
  318.     SendDeathMessage(killerid, playerid, reason);
  319.     SendClientMessage(playerid, 0xFF6347AA ," You Died and Lost $500 !");
  320.     //------------------------------------
  321.     if(IsPlayerConnected(killerid))
  322.     {
  323.         SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
  324.     }
  325.     //------------------------------------
  326.     return 1;
  327. }
  328.  
  329. public OnPlayerCommandText(playerid, cmdtext[])
  330. {
  331.     //I Only used text commands here
  332.     if (strcmp("/help", cmdtext, true, 10) == 0)
  333.     {
  334.         SendClientMessage(playerid,0xFFFF00AA, "***---Modern TDM Help :---***");
  335.         SendClientMessage(playerid,0xFFFFFFFF, "Forums : http://www.m-tdm.com/ is our current forums");
  336.         SendClientMessage(playerid,0xFFFFFFFF, "Commands : Type /cmds For a list of the Server Commands");
  337.         SendClientMessage(playerid,0xFFFFFFFF, "Rules : Type /rules for a list of M-TDM server rules");
  338.         SendClientMessage(playerid,0xFFFFFFFF, "Money : When you kill a player you will earn $1000 , but when you die you'll loose $500 ");
  339.         SendClientMessage(playerid,0xFFFFFFFF, "Other : /weaponhelp *** /drughelp ");
  340.         SendClientMessage(playerid,0xFFFFFFFF, "That's all , Have fun !!");
  341.        
  342.         return 1;
  343.     }
  344.     if (strcmp("/rules", cmdtext, true, 10) == 0)
  345.     {
  346.         SendClientMessage(playerid,0xFFFF00AA, "***---Modern TDM Rules---***");
  347.         SendClientMessage(playerid,0xFFFFFFFF, "Hacks : Cheating is not allowed in this server , if you use any kind of hacks (Weapons, Health...) You'll be banned");
  348.         SendClientMessage(playerid,0xFFFFFFFF, "Flaming : Flaming is not allowed here , You'll be punished if you start insulting someone because he just killed you in game");
  349.         SendClientMessage(playerid,0xFFFFFFFF, "Spawn Killing : You are not allowed to kill other players when they spawn");
  350.         SendClientMessage(playerid,0xFFFFFFFF, "Bug Abuse : You Don't have the right abuse any bug ");
  351.         SendClientMessage(playerid,0xFFFFFFFF, "Adversing : You can not advertise other servers , sending any IP will get you banned");
  352.         SendClientMessage(playerid,0xFFFFFFFF, "Team Work : Work as a Team and Never fight with Players that are in your Team." );
  353.         SendClientMessage(playerid,0xFFFFFFFF, "Other : /weaponhelp *** /drughelp ");
  354.         SendClientMessage(playerid,0xFFFFFFFF, "That's all , Have fun !!");
  355.         return 1;
  356.     }
  357.     if (strcmp("/cmds", cmdtext, true, 10) == 0)
  358.     {
  359.         SendClientMessage(playerid,0xFFFF00AA, "***---Modern TDM Commands---***");
  360.         SendClientMessage(playerid,0xFFFFFFFF, "/stats --- /report [Reason] --- /kill --- /enter --- /exit --- @Text (Team Chat)");
  361.         SendClientMessage(playerid,0xFFFFFFFF, "Other : /weaponhelp *** /drughelp *** /help *** /rules ");
  362.         SendClientMessage(playerid,0xFFFFFFFF, "That's all , Have fun !!");
  363.         return 1;
  364.     }
  365.     ///enter and /exit allows you to TP from a place to another (from DM area to ammunation)
  366.     if (strcmp("/enter", cmdtext, true, 10) == 0)
  367.     {
  368.         if(IsPlayerInRangeOfPoint(playerid, 3, 1271.4468,-822.4473,1089.9375) )
  369.         {
  370.         SetPlayerInterior(playerid, 1);
  371.         SetPlayerPos(playerid, 286.0595,-32.6137,1001.5156);
  372.         GameTextForPlayer(playerid, "~w~The Ammu-Nation", 5000, 1);
  373.         }
  374.         else
  375.         {
  376.         }
  377.         return 1;
  378.     }
  379.     if (strcmp("/exit", cmdtext, true, 10) == 0)
  380.     {
  381.         if(IsPlayerInRangeOfPoint(playerid, 3, 286.0389,-29.8492,1001.5156) )
  382.         {
  383.         SetPlayerInterior(playerid, 5);
  384.         SetPlayerPos(playerid, 1273.1444,-822.4879,1089.9375);
  385.         }
  386.         else
  387.         {
  388.         }
  389.         return 1;
  390.     }
  391.     //This cmd will kill the player by setting his health to 0 and he'll be fined +$500
  392.     if (strcmp("/kill", cmdtext, true, 10) == 0)
  393.     {
  394.         SetPlayerHealth(playerid, 0);
  395.         SendClientMessage(playerid, 0xA10000AA, "You have been fined +$500 because You committed a suicide!");
  396.         GivePlayerMoney(playerid, -500);
  397.         return 1;
  398.     }
  399.     //the stats command only shows some information about the player
  400.     if (strcmp("/stats", cmdtext, true, 10) == 0)
  401.     {
  402.     new str[128], pName[24];
  403.     GetPlayerName(playerid, pName, 24);
  404.     pMoney = GetPlayerMoney(playerid),
  405.     GetPlayerHealth(playerid,pHealth);
  406.     GetPlayerArmour(playerid,pArmour);
  407.     pScore =GetPlayerScore(playerid),
  408.     format(str, 128, "%s Stats :", pName);
  409.     SendClientMessage(playerid,0xFFFFFFFF,str);
  410.     format(str,128, "Money : $%i --- Health : %0.f ",pMoney,pHealth);
  411.     SendClientMessage(playerid,0xFFFFFFFF,str);
  412.     format(str,128, "Armour : %0.f --- Score : %i",pArmour,pScore);
  413.     SendClientMessage(playerid,0xFFFFFFFF,str);
  414.     return 1;
  415.     }
  416.     if (strcmp("/weaponhelp", cmdtext, true, 10) == 0)
  417.     {
  418.         SendClientMessage(playerid,0xFFFF00AA, "***---Modern TDM Weapon Help---***");
  419.         SendClientMessage(playerid,0xFFFFFFFF, "You always get weapons when you spawn. But you can buy more weapons with more bullets");
  420.         SendClientMessage(playerid,0xFFFFFFFF, "You can buy weapons from AmmuNations :");
  421.         SendClientMessage(playerid,0xFFFFFFFF, "Type /buygun to purchase a weapon");
  422.         SendClientMessage(playerid,0xFFFFFFFF, "Other : /cmds *** /racehelp *** /drughelp *** /rules *** /help ");
  423.         SendClientMessage(playerid,0xFFFFFFFF, "That's all , Have fun !!");
  424.         return 1;
  425.     }
  426.     //This command can be used in ammunation only , it shows the ammunation menu that allows
  427.     //the player to select a weapon and buy it
  428.     if (strcmp("/buygun", cmdtext, true, 10) == 0)
  429.     {
  430.         if(GetPlayerInterior(playerid) == 1)
  431.         {
  432.         TogglePlayerControllable(playerid, 0);
  433.         ShowMenuForPlayer(ammunationmenu,playerid);
  434.         }
  435.         else
  436.         {
  437.         SendClientMessage(playerid, 0xFFFF00AA,"You are not at the Ammu Nation ! ");
  438.         }
  439.         return 1;
  440.     }
  441.     if (strcmp("/drughelp", cmdtext, true, 10) == 0)
  442.     {
  443.         SendClientMessage(playerid,0xFFFF00AA, "***---Modern TDM Drug Help---***");
  444.         SendClientMessage(playerid,0xFFFFFFFF, "You can buy drugs to get more armor ");
  445.         SendClientMessage(playerid,0xFFFFFFFF, "Type /buydrug to get 2g of drugs that will give you +20 Armour/Health ");
  446.         SendClientMessage(playerid,0xFFFFFFFF, "Meth will give you +20 Health and Armour and it costs $500 ");
  447.         SendClientMessage(playerid,0xFFFFFFFF, "Crack will give you +20 Armour and it costs $350 ");
  448.         SendClientMessage(playerid,0xFFFFFFFF, "Pot will give you +20 Health and it costs $200 ");
  449.         SendClientMessage(playerid,0xFFFFFFFF, "Other : /weaponhelp *** /cmds *** /rules *** /help ");
  450.         SendClientMessage(playerid,0xFFFFFFFF, "That's all , Have fun !!");
  451.         return 1;
  452.     }
  453.     //also this command can be used only near the drug point , it shows the
  454.     //dialog where can the player select a tye of drugs and buy it
  455.     if (strcmp("/buydrug", cmdtext, true, 10) == 0)
  456.     {
  457.         if(IsPlayerInRangeOfPoint(playerid, 3, 1248.7208,-806.1448,1084.0078) )
  458.         {
  459.         TogglePlayerControllable(playerid, 0);
  460.         ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Choose a Drug type :", "Pot\nCrack\nMeth", "Buy", "Cancel");
  461.         }
  462.         else
  463.         {
  464.         SendClientMessage(playerid,0x33AA33AA,"You are not at the Drug point right now !");
  465.         }
  466.         return 1;
  467.     }
  468.     //only RCON admins can use these cmds
  469.     if (strcmp("/ah", cmdtext, true, 10) == 0)
  470.     {
  471.         if(IsPlayerAdmin(playerid))
  472.         {
  473.         SendClientMessage(playerid,0xFFFF00AA, "***---Modern TDM Admin Help---***");
  474.         SendClientMessage(playerid,0xFFFFFFFF, "/adminduty --- /kick --- /ban --- /jail --- /spec --- /goto");
  475.         SendClientMessage(playerid,0xFFFFFFFF, "Do not abuse these Commands !");
  476.         }
  477.         else
  478.         {
  479.         SendClientMessage(playerid,0xFFFFFFFF,"You are not an admin !");
  480.         }
  481.         return 1;
  482.         //admins commands aren't set yet !
  483.     }
  484.     return 0;
  485. }
  486.  
  487. public OnPlayerSelectedMenuRow(playerid, row)
  488.  
  489. if(GetPlayerMenu(playerid) == ammunationmenu)
  490. {
  491.     switch(row)
  492.     {
  493.     //this menu will be showing only if player type /buygun inside the ammunation
  494.     //when player select a weapon , first it checks his money (< or > of the gun price)
  495.     //if it is < player money , player won't get the weapon and if it is > player money
  496.     //He'll get the weapon
  497.         case 0: //AK47
  498.         {
  499.           TogglePlayerControllable(playerid, 1);
  500.           if(GetPlayerMoney(playerid) < 8000)
  501.           {
  502.           SendClientMessage(playerid,0xFFFF00AA,"You Can not afford this");
  503.           }
  504.           else
  505.           {
  506.           GivePlayerWeapon(playerid,30,750);
  507.           SendClientMessage(playerid, 0xFFFF00AA, "You Bought an AK47 from the Ammu Nation!");
  508.           GivePlayerMoney(playerid, -8000);
  509.           }
  510.         }
  511.         case 1: //M4
  512.         {
  513.           TogglePlayerControllable(playerid, 1);
  514.           if(GetPlayerMoney(playerid) < 9000)
  515.           {
  516.           SendClientMessage(playerid,0xFFFF00AA,"You Can not afford this");
  517.           }
  518.           else
  519.           {
  520.           GivePlayerWeapon(playerid,31,750);
  521.           SendClientMessage(playerid, 0xFFFF00AA, "You Bought an M4 from the Ammu Nation!");
  522.           GivePlayerMoney(playerid, -9000);
  523.           }
  524.         }
  525.         case 2: //MP5
  526.         {
  527.           TogglePlayerControllable(playerid, 1);
  528.           if(GetPlayerMoney(playerid) < 4000)
  529.           {
  530.           SendClientMessage(playerid,0xFFFF00AA,"You Can not afford this");
  531.           }
  532.           else
  533.           {
  534.           GivePlayerWeapon(playerid,29,2400);
  535.           SendClientMessage(playerid, 0xFFFF00AA, "You Bought an MP5 from the Ammu Nation!");
  536.           GivePlayerMoney(playerid, -4000);
  537.           }
  538.         }
  539.         case 3: //UZI
  540.         {
  541.           TogglePlayerControllable(playerid, 1);
  542.           if(GetPlayerMoney(playerid) < 4000)
  543.           {
  544.           SendClientMessage(playerid,0xFFFF00AA,"You Can not afford this");
  545.           }
  546.           else
  547.           {
  548.           GivePlayerWeapon(playerid,28,2400);
  549.           SendClientMessage(playerid, 0xFFFF00AA, "You Bought a UZI from the Ammu Nation!");
  550.           GivePlayerMoney(playerid, -4000);
  551.           }
  552.         }
  553.         case 4: //SPAS12
  554.         {
  555.           TogglePlayerControllable(playerid, 1);
  556.           if(GetPlayerMoney(playerid) < 7500)
  557.           {
  558.           SendClientMessage(playerid,0xFFFF00AA,"You Can not afford this");
  559.           }
  560.           else
  561.           {
  562.           GivePlayerWeapon(playerid,27,500);
  563.           SendClientMessage(playerid, 0xFFFF00AA, "You Bought a SPAS12 from the Ammu Nation!");
  564.           GivePlayerMoney(playerid, -7500);
  565.           }
  566.         }
  567.         case 5: //Deagle
  568.         {
  569.          TogglePlayerControllable(playerid, 1);
  570.          if(GetPlayerMoney(playerid) < 5000)
  571.           {
  572.           SendClientMessage(playerid,0xFFFF00AA,"You Can not afford this");
  573.           }
  574.           else
  575.           {
  576.           GivePlayerWeapon(playerid,24,450);
  577.           SendClientMessage(playerid, 0xFFFF00AA, "You Bought a Deagle from the Ammu Nation!");
  578.           GivePlayerMoney(playerid, -5000);
  579.           }
  580.         }
  581.         case 6: //Sniper
  582.         {
  583.           TogglePlayerControllable(playerid, 1);
  584.           if(GetPlayerMoney(playerid) < 10000)
  585.           {
  586.           SendClientMessage(playerid,0xFFFF00AA,"You Can not afford this");
  587.           }
  588.           else
  589.           {
  590.           GivePlayerWeapon(playerid,34,25);
  591.           SendClientMessage(playerid, 0xFFFF00AA, "You Bought a Sniper Rifle from the Ammu Nation!");
  592.           GivePlayerMoney(playerid, -10000);
  593.           }
  594.         }
  595.         case 7: //Rocket launcher
  596.         {
  597.           TogglePlayerControllable(playerid, 1);
  598.           if(GetPlayerMoney(playerid) < 50000)
  599.           {
  600.           SendClientMessage(playerid,0xFFFF00AA,"You Can not afford this");
  601.           }
  602.           else
  603.           {
  604.           GivePlayerWeapon(playerid,35,5);
  605.           SendClientMessage(playerid, 0xFFFF00AA, "You Bought a Rocket Launcher from the Ammu Nation!");
  606.           GivePlayerMoney(playerid, -50000);
  607.           }
  608.           //Ammunation only sells the best weapons and with a lot of ammo !
  609.         }
  610.     }
  611. }
  612.  
  613.  
  614. public OnPlayerPickUpPickup(playerid, pickupid)
  615. {
  616.     //This sends a message when player is in a pickup (to inform him about the cmd to use)
  617.     if(pickupid == ammunationenter)
  618.     {
  619.     GameTextForPlayer(playerid,"~w~Type ~r~ /ENTER ~w~ to enter the Ammunation",3000,4);
  620.     }
  621.     if(pickupid == ammunationexit)
  622.     {
  623.     GameTextForPlayer(playerid,"~w~Type ~r~ /EXIT ~w~ to exit the Ammunation",3000,4);
  624.     }else if(pickupid == drugpickup)
  625.     {
  626.     GameTextForPlayer(playerid,"~w~Type ~r~ /BUYDRUG ~w~ to buy Drugs",3000,4);
  627.     }
  628.     return 1;
  629. }
  630.  
  631. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  632. {
  633.   //This is the dialog when player types /buydrug to purchase drugs
  634.   if (dialogid == 1)
  635.   {
  636.     if (response == 1)
  637.     {
  638.       TogglePlayerControllable(playerid, 1);
  639.       switch (listitem)
  640.       {
  641.         case 0://Pot : + 20 health
  642.         {
  643.           if(GetPlayerMoney(playerid) < 200)
  644.           {
  645.           SendClientMessage(playerid,0x33AA33AA,"You Can not afford this");
  646.           }
  647.           else
  648.           {
  649.           GetPlayerHealth(playerid,pHealth);
  650.           GivePlayerMoney(playerid,-200);
  651.           SetPlayerHealth(playerid,pHealth + 20);
  652.           }
  653.         }
  654.         case 1://Crack : + 20 armour
  655.         {
  656.           if(GetPlayerMoney(playerid) < 350)
  657.           {
  658.           SendClientMessage(playerid,0x33AA33AA,"You Can not afford this");
  659.           }
  660.           else
  661.           {
  662.           GetPlayerArmour(playerid,pArmour);
  663.           GivePlayerMoney(playerid,-350);
  664.           SetPlayerArmour(playerid,pArmour + 20);
  665.           }
  666.         }
  667.         case 2://Meth : + 20 health and armour
  668.         {
  669.           if(GetPlayerMoney(playerid) < 500)
  670.           {
  671.           SendClientMessage(playerid,0x33AA33AA,"You Can not afford this");
  672.           }
  673.           else
  674.           {
  675.           GetPlayerHealth(playerid,pHealth);
  676.           GetPlayerArmour(playerid,pArmour);
  677.           GivePlayerMoney(playerid,-500);
  678.           SetPlayerHealth(playerid,pHealth + 20);
  679.           SetPlayerArmour(playerid,pArmour + 20);
  680.           }
  681.         }
  682.       }
  683.     }
  684.     else
  685.     {
  686.       TogglePlayerControllable(playerid, 1);
  687.     }
  688.     return 1;
  689.   }
  690.   return 0;
  691. }
  692.  
  693. public HourTimer(playerid)
  694. {
  695.   //The Player will get money , score and rocket for playing 1Hour..
  696.   GivePlayerMoney(playerid,20000);
  697.   SetPlayerScore(playerid,GetPlayerScore(playerid)+20);
  698.   GivePlayerWeapon(playerid,35,5);
  699.   GameTextForPlayer(playerid,"~g~You Have Passed 1Hour playing in the Server",3000,4);
  700.   SendClientMessage(playerid,0x33AA33AA,"You won $20.000 , + 20 Score and a Rocket Launcher !! Enjoy !!");
  701.   SetTimer("HourTimer",3600000,true); //This will set the timer again and he'll
  702.   return 1;
  703. }
  704.  
  705. //We use @Text as team chat , it is a Channel where the team members can chat
  706. //Privatly to plan for attacking other teams etc..
  707. public OnPlayerText(playerid, text[])
  708. {
  709.     if( (text[0] == '@') && strlen(text) > 1)
  710.     {
  711.         new str[128];
  712.         new pName[MAX_PLAYER_NAME];
  713.         GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
  714.         format(str, 128, "*Team Chat* %s Says : %s", pName, text[1]);
  715.         for(new iPlayerID; iPlayerID < MAX_PLAYERS; iPlayerID++){
  716.             if(!IsPlayerConnected(iPlayerID)) continue;
  717.             if(GetPlayerTeam(playerid) == GetPlayerTeam(iPlayerID)) SendClientMessage(iPlayerID, 0xA10000AA, str);
  718.         }
  719.         return 0;
  720.     }
  721.     return 1;
  722. }
  723.  
  724.  
  725. //This is the callback that sets player team from class
  726.  
  727. SetPlayerTeamFromClass(playerid, classid)
  728. {
  729.  
  730.     if(classid == 0 || classid == 1 || classid == 2 || classid == 3 || classid == 4 || classid == 5 || classid == 6 || classid == 7 )
  731.     {
  732.         gTeam[playerid] = TEAM_POLICE;
  733.         GameTextForPlayer(playerid,"~b~Police",3000,4);
  734.     }
  735.     if(classid == 8 || classid == 9 || classid == 10 || classid == 11 || classid == 12 || classid == 13 || classid == 14)
  736.     {
  737.         gTeam[playerid] = TEAM_HOBOS;
  738.         GameTextForPlayer(playerid,"~W~Hobos",3000,4);
  739.  
  740.     }
  741.     if(classid == 15 || classid == 16 || classid == 17 || classid == 18 || classid == 19 || classid == 20 || classid == 21)
  742.     {
  743.         gTeam[playerid] = TEAM_GROVE;
  744.         GameTextForPlayer(playerid,"~g~Grove Street",3000,4);
  745.  
  746.     }
  747.     else if(classid == 22 || classid == 23 || classid == 24 || classid == 25 || classid == 26 || classid == 27 || classid == 28)
  748.     {
  749.         gTeam[playerid] = TEAM_MAFIA;
  750.         GameTextForPlayer(playerid,"~y~The Mafia",3000,4);
  751.  
  752.     }
  753. }
  754.  
  755. //This is the callback that sets player colour according to team when he spawns
  756.  
  757. SetPlayerToTeamColour(playerid)
  758. {
  759.     if(gTeam[playerid] == TEAM_POLICE)
  760.     {
  761.         SetPlayerColor(playerid,TEAM_POLICE_COLOUR);
  762.  
  763.     }
  764.     if(gTeam[playerid] == TEAM_HOBOS)
  765.     {
  766.         SetPlayerColor(playerid,TEAM_HOBOS_COLOUR);
  767.  
  768.     }
  769.     if(gTeam[playerid] == TEAM_GROVE)
  770.     {
  771.         SetPlayerColor(playerid,TEAM_GROVE_COLOUR);
  772.  
  773.     }
  774.     else if(gTeam[playerid] == TEAM_MAFIA)
  775.     {
  776.         SetPlayerColor(playerid,TEAM_MAFIA_COLOUR);
  777.  
  778.     }
  779. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement