Guest User

Modern Team Death Match v1.2

a guest
May 7th, 2011
844
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 82.38 KB | None | 0 0
  1. // .:--------------------------------------------------------------:.
  2. // .:==============================================================:.
  3. //                { M - TDM v1.2 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.  
  12. //Main Defines :
  13. #include <a_samp>
  14. #include <dini>
  15. #include <dudb>
  16. #pragma unused ret_memcpy
  17. #pragma unused strtok
  18.  
  19.  
  20. //Teams Defines :
  21. #define TEAM_POLICE 1
  22. #define TEAM_HOBOS 2
  23. #define TEAM_GROVE 3
  24. #define TEAM_MAFIA 4
  25. #define TEAM_POLICE_COLOUR      0x2641FEAA
  26. #define TEAM_HOBOS_COLOUR       0x800000AA
  27. #define TEAM_GROVE_COLOUR       0x33AA33AA
  28. #define TEAM_MAFIA_COLOUR       0xF5DEB3AA
  29. new gTeam[MAX_PLAYERS];
  30.  
  31.  
  32. //Colors Defines :
  33. #define COLOR_WHITE             0xFFFFFFFF
  34. #define COLOR_GREEN             0x33AA33AA
  35. #define COLOR_RED               0xA10000AA
  36. #define COLOR_YELLOW            0xFFFF00AA
  37.  
  38.  
  39. //ScriptFiles Defines :
  40. #define SERVER_USER_FILE "M-tdm/Players/%s.ini"
  41.  
  42.  
  43. //Pickups Defines :
  44. new AmmoNationEntrance;
  45. new AmmoNationExit;
  46. new DrugPlace;
  47.  
  48.  
  49. //Menus Defines :
  50. new Menu:AmmoNationMenu;
  51.  
  52.  
  53. //Texts Defines :
  54. new Text:ServerNameText;
  55.  
  56.  
  57. //Bools Defines :
  58. new bool:IsPlayerSpecing[MAX_PLAYERS];
  59. new bool:IsPlayerTypingKill[MAX_PLAYERS];
  60. new bool:IsChatOnOrOff[MAX_PLAYERS];
  61.  
  62.  
  63. //Timers Defines :
  64. new Afk;
  65. new Jail;
  66. forward HourTimer(playerid);
  67. forward AfkTimer(playerid);
  68. forward CountDown2(playerid);
  69. forward CountDown1(playerid);
  70. forward CountDownGo(playerid);
  71. forward Gmx(playerid);
  72. forward JailTimer(playerid);
  73.  
  74.  
  75. //Player Stats :
  76. enum PlayerStats
  77. {
  78.     AdminLevel,
  79.     TeamRank,
  80.     Cash,
  81.     Level,
  82.     Wanted,
  83.     Logged,
  84.     Mute,
  85.     AfkMute,
  86.     Afking,
  87.     Jailed,
  88.     Frozen,
  89. };
  90. new Player[MAX_PLAYERS][PlayerStats];
  91.  
  92.  
  93. //DCMD Define :
  94. #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  95.  
  96.  
  97. //Others
  98. new Float:pHealth;
  99. new Float:pArmour;
  100. new Money;
  101. new Score;
  102. new WantedLevel;
  103.  
  104.  
  105. #if defined FILTERSCRIPT
  106. #else
  107.  
  108. main()
  109. {
  110.     print("\n--------------------------------------");
  111.     print("               M-TDM v1.2               ");
  112.     print("               By {Soumi}               ");
  113.     print("--------------------------------------\n");
  114. }
  115.  
  116. #endif
  117.  
  118. public OnGameModeInit()
  119. {
  120.     //---------------------------------------------------------------------------------------
  121.     AllowAdminTeleport(1);
  122.     AllowInteriorWeapons(1);
  123.     DisableInteriorEnterExits();
  124.     ShowPlayerMarkers(0);
  125.     SetTeamCount(4);
  126.     //---------------------------------------------------------------------------------------
  127.     //Game mode
  128.     SetGameModeText("M-TDM v1.2");
  129.     //---------------------------------------------------------------------------------------
  130.     //Teams spawn :
  131.     //Police :
  132.     AddPlayerClass(280,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
  133.     AddPlayerClass(281,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
  134.     AddPlayerClass(282,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
  135.     AddPlayerClass(283,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
  136.     AddPlayerClass(285,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
  137.     AddPlayerClass(288,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
  138.     AddPlayerClass(286,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
  139.     AddPlayerClass(192,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
  140.     //Hobos :
  141.     AddPlayerClass(134,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
  142.     AddPlayerClass(135,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
  143.     AddPlayerClass(137,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
  144.     AddPlayerClass(212,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
  145.     AddPlayerClass(230,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
  146.     AddPlayerClass(239,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
  147.     AddPlayerClass(77,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
  148.     //Grove :
  149.     AddPlayerClass(105,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
  150.     AddPlayerClass(106,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
  151.     AddPlayerClass(107,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
  152.     AddPlayerClass(269,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
  153.     AddPlayerClass(270,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
  154.     AddPlayerClass(271,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
  155.     AddPlayerClass(298,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
  156.     //Mafia :
  157.     AddPlayerClass(111,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
  158.     AddPlayerClass(113,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
  159.     AddPlayerClass(124,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
  160.     AddPlayerClass(125,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
  161.     AddPlayerClass(126,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
  162.     AddPlayerClass(127,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
  163.     AddPlayerClass(194,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
  164.     //---------------------------------------------------------------------------------------
  165.     //Pickups
  166.     //Team Spawn Pickups
  167.     //With a 3D text in each spawn pickup
  168.     CreatePickup(1314,1,1305.4125,-786.8438,1084.0078);
  169.     Create3DTextLabel("Police Spawn",0xFF00FFFF,1305.4125,-786.8438,1084.0078,6.0,0);
  170.     CreatePickup(1314,1,1265.8604,-777.2852,1084.0078);
  171.     Create3DTextLabel("Hobos Spawn",0xFF00FFFF,1265.8604,-777.2852,1084.0078,6.0,0);
  172.     CreatePickup(1314,1,1267.8646,-810.1602,1084.0078);
  173.     Create3DTextLabel("Grove Spawn",0xFF00FFFF,1267.8646,-810.1602,1084.0078,6.0,0);
  174.     CreatePickup(1314,1,1282.1912,-824.7309,1085.6328);
  175.     Create3DTextLabel("Mafia Spawn",0xFF00FFFF,1282.1912,-824.7309,1085.6328,6.0,0);
  176.     //Drugs/Ammunation Pickups
  177.     //with 3D text in each pickup too , it helps the player to
  178.     //know what is that pickup for
  179.     DrugPlace = CreatePickup(1279,1,1248.7208,-806.1448,1084.0078);
  180.     Create3DTextLabel("Drug Point",COLOR_GREEN,1248.7208,-806.1448,1084.0078,6.0,0);
  181.     AmmoNationEntrance = CreatePickup(1318,1,1271.4468,-822.4473,1089.9375);
  182.     Create3DTextLabel("Ammu-Nation",COLOR_YELLOW,1271.4468,-822.4473,1089.9375,6.0,0);
  183.     AmmoNationExit = CreatePickup(1318,1,286.0389,-29.8492,1001.5156);
  184.     //---------------------------------------------------------------------------------------
  185.     //Menus
  186.     //The ammunation menu , you can type /buygun at the ammuation to
  187.     //see this menu that allows you to select the weapon you want to buy
  188.     AmmoNationMenu = CreateMenu("AmmuNation :", 2, 200.0, 100.0, 150.0, 150.0);
  189.     AddMenuItem(AmmoNationMenu, 0, "AK47             $8000");
  190.     AddMenuItem(AmmoNationMenu, 0, "M4               $9000");
  191.     AddMenuItem(AmmoNationMenu, 0, "MP5              $4000");
  192.     AddMenuItem(AmmoNationMenu, 0, "UZI              $4000");
  193.     AddMenuItem(AmmoNationMenu, 0, "SPAS12           $7500");
  194.     AddMenuItem(AmmoNationMenu, 0, "Deagle           $5000");
  195.     AddMenuItem(AmmoNationMenu, 0, "Sniper           $10.000");
  196.     AddMenuItem(AmmoNationMenu, 0, "Rocket launcher  $50.000");
  197.     //---------------------------------------------------------------------------------------
  198.     //Timers
  199.     //Note : 3600000 = 1Hour
  200.     SetTimer("HourTimer",3600000,true);
  201.     //Objects By cloudysky
  202.     //Maddog Mansion Objects :
  203.     CreateObject(3015, 1283.4685058594, -783.25317382813, 1088.9375, 0, 0, 0);
  204.     CreateObject(18257, 1268.6064453125, -777.88317871094, 1090.90625, 0, 0, 0);
  205.     CreateObject(1685, 1280.4525146484, -782.69390869141, 1089.6875, 0, 0, 0);
  206.     CreateObject(1685, 1283.951171875, -787.72045898438, 1089.6875, 0, 0, 0);
  207.     CreateObject(1685, 1280.6843261719, -794.84375, 1089.6875, 0, 0, 0);
  208.     CreateObject(1685, 1283.6586914063, -802.11389160156, 1089.6875, 0, 0, 0);
  209.     CreateObject(1685, 1280.6539306641, -810.66033935547, 1089.6875, 0, 0, 0);
  210.     CreateObject(1685, 1283.9046630859, -816.2861328125, 1089.6875, 0, 0, 0);
  211.     CreateObject(944, 1282.9704589844, -832.66619873047, 1089.822265625, 0, 0, 0);
  212.     CreateObject(3013, 1282.4670410156, -833.52166748047, 1089.0847167969, 0, 0, 0);
  213.     CreateObject(18257, 1279.267578125, -836.28381347656, 1084.6328125, 0, 0, 270);
  214.     CreateObject(964, 1270.8817138672, -830.07318115234, 1084.6328125, 0, 0, 0);
  215.     CreateObject(964, 1270.9008789063, -830.06182861328, 1085.5985107422, 0, 0, 0);
  216.     CreateObject(964, 1270.8041992188, -828.09484863281, 1084.6328125, 0, 0, 0);
  217.     CreateObject(964, 1270.8045654297, -828.09490966797, 1085.5985107422, 0, 0, 0);
  218.     CreateObject(964, 1270.9875488281, -830.00482177734, 1086.5642089844, 0, 0, 0);
  219.     CreateObject(964, 1270.9973144531, -828.74108886719, 1086.5642089844, 0, 0, 0);
  220.     CreateObject(964, 1270.9912109375, -827.59020996094, 1086.5642089844, 0, 0, 0);
  221.     CreateObject(2974, 1288.6882324219, -832.89422607422, 1084.6328125, 0, 0, 0);
  222.     CreateObject(2912, 1262.5721435547, -831.54174804688, 1083.0148925781, 0, 0, 0);
  223.     CreateObject(2912, 1262.5548095703, -831.54541015625, 1083.71484375, 0, 0, 0);
  224.     CreateObject(930, 1262.7761230469, -832.22424316406, 1083.4907226563, 0, 0, 0);
  225.     CreateObject(1685, 1263.0493164063, -835.00860595703, 1083.7648925781, 0, 0, 0);
  226.     CreateObject(1685, 1263.0401611328, -838.27423095703, 1083.7578125, 0, 0, 0);
  227.     CreateObject(1685, 1281.0793457031, -822.1123046875, 1089.6875, 0, 0, 0);
  228.     CreateObject(2991, 1254.3442382813, -828.16259765625, 1083.6354980469, 0, 0, 0);
  229.     CreateObject(2991, 1235.5437011719, -833.06286621094, 1083.6354980469, 0, 0, 90);
  230.     CreateObject(2975, 1239.3370361328, -826.60205078125, 1082.15625, 0, 0, 0);
  231.     CreateObject(2975, 1249.0526123047, -831.75555419922, 1083.0148925781, 0, 0, 0);
  232.     CreateObject(2975, 1251.1234130859, -835.57684326172, 1083.0078125, 0, 0, 0);
  233.     CreateObject(2975, 1248.3004150391, -838.54870605469, 1083.0078125, 0, 0, 0);
  234.     CreateObject(925, 1229.7275390625, -836.10113525391, 1084.0697021484, 0, 0, 0);
  235.     CreateObject(925, 1235.4520263672, -838.2861328125, 1084.0697021484, 0, 0, 0);
  236.     CreateObject(1431, 1227.451171875, -830.45275878906, 1083.5554199219, 0, 0, 0);
  237.     CreateObject(1431, 1227.4953613281, -826.00225830078, 1083.5554199219, 0, 0, 0);
  238.     CreateObject(1685, 1229.1007080078, -815.25439453125, 1083.7578125, 0, 0, 0);
  239.     CreateObject(1685, 1229.1105957031, -817.37756347656, 1083.7578125, 0, 0, 0);
  240.     CreateObject(930, 1240.0802001953, -811.35986328125, 1083.4836425781, 0, 0, 90);
  241.     CreateObject(930, 1240.2679443359, -813.39324951172, 1083.4836425781, 0, 0, 0);
  242.     CreateObject(1431, 1232.015625, -812.86987304688, 1083.5554199219, 0, 0, 90);
  243.     CreateObject(1431, 1228.6192626953, -808.72845458984, 1083.5554199219, 0, 0, 0);
  244.     CreateObject(2567, 1249.3779296875, -811.3125, 1084.9354248047, 0, 0, 0);
  245.     CreateObject(942, 1271.5297851563, -798.40734863281, 1085.4510498047, 0, 0, 0);
  246.     CreateObject(935, 1260.9449462891, -802.34149169922, 1083.5710449219, 0, 0, 0);
  247.     CreateObject(935, 1261.9300537109, -802.35845947266, 1083.5710449219, 0, 0, 0);
  248.     CreateObject(935, 1262.9259033203, -802.33630371094, 1083.5710449219, 0, 0, 0);
  249.     CreateObject(935, 1263.9537353516, -802.25360107422, 1083.5710449219, 0, 0, 0);
  250.     CreateObject(1431, 1258.5804443359, -804.14392089844, 1083.5554199219, 0, 0, 90);
  251.     CreateObject(1431, 1281.3435058594, -800.90148925781, 1083.5554199219, 0, 0, 0);
  252.     CreateObject(1431, 1283.4188232422, -800.81677246094, 1083.5554199219, 0, 0, 0);
  253.     CreateObject(1685, 1284.7239990234, -798.10766601563, 1083.7578125, 0, 0, 0);
  254.     CreateObject(1685, 1283.6350097656, -792.51336669922, 1083.7578125, 0, 0, 0);
  255.     CreateObject(1685, 1267.0187988281, -793.64581298828, 1083.7578125, 0, 0, 0);
  256.     CreateObject(925, 1274.7543945313, -786.8017578125, 1084.0767822266, 0, 0, 0);
  257.     CreateObject(944, 1270.1082763672, -789.45581054688, 1083.892578125, 0, 0, 90);
  258.     CreateObject(935, 1275.0075683594, -790.5966796875, 1083.5710449219, 0, 0, 0);
  259.     CreateObject(935, 1274.9952392578, -789.80413818359, 1083.5710449219, 0, 0, 0);
  260.     CreateObject(935, 1253.4654541016, -791.03802490234, 1083.5710449219, 0, 0, 0);
  261.     CreateObject(935, 1254.0161132813, -790.20257568359, 1083.5710449219, 0, 0, 0);
  262.     CreateObject(1337, 1254.1267089844, -789.33032226563, 1083.6569824219, 0, 0, 0);
  263.     CreateObject(1299, 1250.0831298828, -787.16754150391, 1083.4636230469, 0, 0, 0);
  264.     CreateObject(1299, 1242.6888427734, -780.49841308594, 1083.470703125, 0, 0, 0);
  265.     CreateObject(1299, 1240.1783447266, -763.10949707031, 1083.4650878906, 0, 0, 0);
  266.     CreateObject(12957, 1235.8734130859, -763.90338134766, 1083.8853759766, 0, 0, 245);
  267.     CreateObject(1227, 1250.9050292969, -772.07415771484, 1083.8594970703, 0, 0, 0);
  268.     CreateObject(1224, 1248.5551757813, -767.53466796875, 1083.6291503906, 0, 0, 0);
  269.     CreateObject(1224, 1261.8525390625, -779.00042724609, 1083.6226806641, 0, 0, 0);
  270.     CreateObject(1224, 1266.3231201172, -778.13940429688, 1083.6226806641, 0, 0, 0);
  271.     CreateObject(3594, 1289.2827148438, -773.94354248047, 1083.6390380859, 0, 0, 0);
  272.     CreateObject(1440, 1283.6583251953, -783.63342285156, 1083.5269775391, 0, 0, 0);
  273.     CreateObject(2744, 1284.6867675781, -782.10870361328, 1085.0920410156, 0, 0, 270);
  274.     CreateObject(932, 1299.5815429688, -782.56298828125, 1083.0078125, 0, 0, 0);
  275.     CreateObject(932, 1298.8043212891, -782.55981445313, 1083.0078125, 0, 0, 0);
  276.     CreateObject(910, 1299.0833740234, -780.38854980469, 1084.2769775391, 0, 0, 90);
  277.     //Wooow , you should try the GameMode and check those awsome Objetcs
  278.     return 1;
  279. }
  280.  
  281. public OnGameModeExit()
  282. {
  283.     //it is showen when you exit the Gamemode
  284.     print("You have turned off M-TDM Game Mode By .:'{Soumi}':.");
  285.     return 1;
  286. }
  287.  
  288. public OnPlayerRequestClass(playerid, classid)
  289. {
  290.     //---------------------------------------------------------------------------------------
  291.     //a sound will be playing while the player is choosing a class
  292.     PlayerPlaySound(playerid, 1062, 0.0, 0.0, 2.0);
  293.     ApplyAnimation(playerid,"PED","WALK_gang1",4.1,1,1,1,1,1); //This will apply an animation on the player while choosing the class
  294.     SetPlayerTeamFromClass(playerid,classid); // This sets the palyer team from class
  295.     //---------------------------------------------------------------------------------------
  296.     //This is what the player Position when he's selecting a class
  297.     SetPlayerPos(playerid,1286.1554,-774.1998,1091.9063);
  298.     SetPlayerFacingAngle(playerid,0.0);
  299.     SetPlayerCameraPos(playerid,1282.0900,-772.8223,1091.9063);
  300.     SetPlayerCameraLookAt(playerid,1286.1554,-774.1998,1091.9063);
  301.     SetPlayerInterior(playerid,5);
  302.     //---------------------------------------------------------------------------------------
  303.     return 1;
  304. }
  305.  
  306. public OnPlayerConnect(playerid)
  307. {
  308.     //---------------------------------------------------------------------------------------
  309.     GameTextForPlayer(playerid,"~w~Modern Team Dm !",3000,4);
  310.     SendClientMessage(playerid,COLOR_WHITE,"Welcome to {88AA88}Modern{FFFFFF}-TDM");
  311.     //---------------------------------------------------------------------------------------
  312.     //This sends a message to all the palyers when someone join the server
  313.     new str[128], pName[24];
  314.     GetPlayerName(playerid, pName, 24);
  315.     format(str, 128, "(Connecting) %s has Joined Modern TDM Server.", pName);
  316.     SendClientMessageToAll(COLOR_WHITE,str);
  317.     //---------------------------------------------------------------------------------------
  318.     Player[playerid][Afking] = false; //If the player left when he's afk , he won't be anymore
  319.     Player[playerid][AfkMute] = false; //and for the AfkMute and frozen and specing all off..
  320.     Player[playerid][Frozen] = false;
  321.     IsPlayerSpecing[playerid] = false;
  322.     Player[playerid][Logged] = 0;
  323.     //The Register/Login system , added in the version 1.3.
  324.     new playersfile[256];
  325.     format(playersfile, sizeof(playersfile), SERVER_USER_FILE, pName);
  326.     if (!dini_Exists(playersfile))
  327.     {
  328.         ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Welcome to Modern TDM" , "you're not registered , type your Password below.", "Register", "Exit");
  329.     }
  330.     if(fexist(playersfile))
  331.     {
  332.         ShowPlayerDialog(playerid, 3, DIALOG_STYLE_INPUT, "Welcome Back to Modern TDM", "Type your Password below to login", "Login", "Exit");
  333.     }
  334.     return 1;
  335. }
  336.  
  337. public OnPlayerDisconnect(playerid, reason)
  338. {
  339.     //---------------------------------------------------------------------------------------
  340.     //also this sends a message to all the players when someone exit the server
  341.     new str[128], pName[24];
  342.     GetPlayerName(playerid, pName, 24);
  343.     format(str, 128, "%s has left Modern TDM Server.", pName);
  344.     SendClientMessageToAll(COLOR_WHITE,str);
  345.     //---------------------------------------------------------------------------------------
  346.     Player[playerid][Afking] = false;
  347.     Player[playerid][AfkMute] = false;
  348.     Player[playerid][Frozen] = false;
  349.     IsPlayerSpecing[playerid] = false;
  350.     new playersfile[256];
  351.     format(playersfile, sizeof(playersfile), SERVER_USER_FILE, pName);
  352.     if(Player[playerid][Logged] == 1)
  353.     {
  354.         dini_IntSet(playersfile, "Level", GetPlayerScore(playerid));
  355.         dini_IntSet(playersfile, "Cash", GetPlayerMoney(playerid));
  356.         dini_IntSet(playersfile, "AdminLevel",Player[playerid][AdminLevel]);
  357.         dini_IntSet(playersfile, "TeamRank",Player[playerid][TeamRank]);
  358.         dini_IntSet(playersfile, "Muted",Player[playerid][Mute]);
  359.         dini_IntSet(playersfile, "Jailed",Player[playerid][Jailed]);
  360.         dini_IntSet(playersfile, "Wanted",GetPlayerWantedLevel(playerid));
  361.     }
  362.     Player[playerid][Logged] = 0;
  363.     return 1;
  364. }
  365.  
  366. public OnPlayerSpawn(playerid)
  367. {
  368.     //---------------------------------------------------------------------------------------
  369.     //when the player spawn , he'll see this text at the bottom of the screen
  370.     //near the mini-map
  371.     ServerNameText = TextDrawCreate(10.0, 415.0,"~r~Modern Team Deathmatch");
  372.     TextDrawBoxColor(ServerNameText,0x222222BB);
  373.     TextDrawLetterSize(ServerNameText,0.3,1.0);
  374.     TextDrawTextSize(ServerNameText,400.0,40.0);
  375.     TextDrawFont(ServerNameText, 2);
  376.     TextDrawShowForPlayer(playerid,ServerNameText);
  377.     //---------------------------------------------------------------------------------------
  378.     PlayerPlaySound(playerid,1063, 0.0, 0.0, 2.0);
  379.     SetPlayerToTeamColour(playerid);
  380.     SetPlayerInterior(playerid,5);
  381.     SetPlayerHealth(playerid,100);
  382.     SetPlayerArmour(playerid,100);
  383.     IsPlayerTypingKill[playerid] = false;
  384.     //---------------------------------------------------------------------------------------
  385.     //Player will have the Maximum of all the weapons that are used in the gamemode
  386.     SetPlayerSkillLevel(playerid,22,9999);
  387.     SetPlayerSkillLevel(playerid,23,9999);
  388.     SetPlayerSkillLevel(playerid,24,9999);
  389.     SetPlayerSkillLevel(playerid,25,9999);
  390.     SetPlayerSkillLevel(playerid,26,9999);
  391.     SetPlayerSkillLevel(playerid,27,9999);
  392.     SetPlayerSkillLevel(playerid,28,9999);
  393.     SetPlayerSkillLevel(playerid,29,9999);
  394.     SetPlayerSkillLevel(playerid,30,9999);
  395.     SetPlayerSkillLevel(playerid,31,9999);
  396.     SetPlayerSkillLevel(playerid,32,9999);
  397.     SetPlayerSkillLevel(playerid,34,9999);
  398.     //---------------------------------------------------------------------------------------
  399.     if(Player[playerid][Jailed] == 1)
  400.     {
  401.     SendClientMessage(playerid,COLOR_RED,"Back To Jail !!");
  402.     SetPlayerPos(playerid, 264.6288,77.5742,1001.0391);
  403.     SetPlayerInterior(playerid, 6);
  404.     ResetPlayerWeapons(playerid);
  405.     Jail = SetTimer("JailTimer",300000,false);
  406.     }
  407.     return 1;
  408. }
  409.  
  410. public OnPlayerDeath(playerid, killerid, reason)
  411. {
  412.     //---------------------------------------------------------------------------------------
  413.     //When player dies , He'll loose $500 and he'll respawn of course
  414.     //but the one who killed him will get $1000 and + wanted level
  415.     //also he'll get +1 score and death message will be send to the otehr players
  416.     WantedLevel = GetPlayerWantedLevel(playerid);
  417.     Money = GetPlayerMoney(playerid),
  418.     GivePlayerMoney(killerid, 1000);
  419.     SetPlayerWantedLevel(killerid, WantedLevel + 1);
  420.     ResetPlayerMoney(playerid);
  421.     GivePlayerMoney(playerid, Money -500),
  422.     //---------------------------------------------------------------------------------------
  423.     SendDeathMessage(killerid, playerid, reason);
  424.     SendClientMessage(playerid, 0xFF6347AA ," You Died and Lost $500 !");
  425.     //---------------------------------------------------------------------------------------
  426.     if(IsPlayerConnected(killerid))
  427.     {
  428.         SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
  429.     }
  430.     //---------------------------------------------------------------------------------------
  431.     return 1;
  432. }
  433.  
  434. public OnPlayerCommandText(playerid, cmdtext[])
  435. {
  436.     new cmd[30], params[30];
  437.     sscanf(cmdtext, "ss", cmd, params);
  438.     //I Made these cmds when i didn't know how to use params , etc..
  439.     //But all the new ones are in DCMD !!
  440.     //---------------------------------------------------------------------------------------
  441.     if (strcmp("/help", cmdtext, true, 10) == 0)
  442.     {
  443.         SendClientMessage(playerid,COLOR_YELLOW, "***---Modern TDM Help :---***");
  444.         SendClientMessage(playerid,COLOR_WHITE, "Forums : http://www.m-tdm.com/ is our current forums");
  445.         SendClientMessage(playerid,COLOR_WHITE, "Commands : Type /cmds For a list of the Server Commands");
  446.         SendClientMessage(playerid,COLOR_WHITE, "Rules : Type /rules for a list of M-TDM server rules");
  447.         SendClientMessage(playerid,COLOR_WHITE, "Money : When you kill a player you will earn $1000 , but when you die you'll loose $500 ");
  448.         SendClientMessage(playerid,COLOR_WHITE, "Other : /weaponhelp *** /drughelp ");
  449.         SendClientMessage(playerid,COLOR_WHITE, "That's all , Have fun !!");
  450.        
  451.         return 1;
  452.     }
  453.     if (strcmp("/rules", cmdtext, true, 10) == 0)
  454.     {
  455.         SendClientMessage(playerid,COLOR_YELLOW, "***---Modern TDM Rules---***");
  456.         SendClientMessage(playerid,COLOR_WHITE, "Hacks : Cheating is not allowed in this server , if you use any kind of hacks (Weapons, Health...) You'll be banned");
  457.         SendClientMessage(playerid,COLOR_WHITE, "Flaming : Flaming is not allowed here , You'll be punished if you start insulting someone because he just killed you in game");
  458.         SendClientMessage(playerid,COLOR_WHITE, "Spawn Killing : You are not allowed to kill other players when they spawn");
  459.         SendClientMessage(playerid,COLOR_WHITE, "Bug Abuse : You Don't have the right abuse any bug ");
  460.         SendClientMessage(playerid,COLOR_WHITE, "Adversing : You can not advertise other servers , sending any IP will get you banned");
  461.         SendClientMessage(playerid,COLOR_WHITE, "Team Work : Work as a Team and Never fight with Players that are in your Team." );
  462.         SendClientMessage(playerid,COLOR_WHITE, "Other : /weaponhelp *** /drughelp ");
  463.         SendClientMessage(playerid,COLOR_WHITE, "That's all , Have fun !!");
  464.         return 1;
  465.     }
  466.     if (strcmp("/cmds", cmdtext, true, 10) == 0)
  467.     {
  468.         SendClientMessage(playerid,COLOR_YELLOW, "***---Modern TDM Commands---***");
  469.         SendClientMessage(playerid,COLOR_WHITE, "General Cmds : /stats --- /report [Reason] --- /kill --- /enter --- /exit --- @Text (Team Chat)");
  470.         SendClientMessage(playerid,COLOR_WHITE, "/pay --- /savestats --- /giverank Afk : /goafk --- /back ");
  471.         SendClientMessage(playerid,COLOR_WHITE, "Other : /weaponhelp *** /drughelp *** /help *** /rules ");
  472.         SendClientMessage(playerid,COLOR_WHITE, "That's all , Have fun !!");
  473.         return 1;
  474.     }
  475.     ///enter and /exit allows you to TP from a place to another (from DM area to ammunation)
  476.     if (strcmp("/enter", cmdtext, true, 10) == 0)
  477.     {
  478.         if(IsPlayerInRangeOfPoint(playerid, 3, 1271.4468,-822.4473,1089.9375) )
  479.         {
  480.         SetPlayerInterior(playerid, 1);
  481.         SetPlayerPos(playerid, 286.0595,-32.6137,1001.5156);
  482.         GameTextForPlayer(playerid, "~w~The Ammu-Nation", 5000, 1);
  483.         }
  484.         else
  485.         {
  486.         }
  487.         return 1;
  488.     }
  489.     if (strcmp("/exit", cmdtext, true, 10) == 0)
  490.     {
  491.         if(IsPlayerInRangeOfPoint(playerid, 3, 286.0389,-29.8492,1001.5156) )
  492.         {
  493.         SetPlayerInterior(playerid, 5);
  494.         SetPlayerPos(playerid, 1273.1444,-822.4879,1089.9375);
  495.         }
  496.         else
  497.         {
  498.         }
  499.         return 1;
  500.     }
  501.     //This cmd will kill the player by setting his health to 0 and he'll be fined +$500
  502.     if (strcmp("/kill", cmdtext, true, 10) == 0)
  503.     {
  504.         if(IsPlayerTypingKill[playerid] == false)
  505.         {
  506.             SetPlayerHealth(playerid, 0);
  507.             SendClientMessage(playerid, COLOR_RED, "You have been fined +$500 because You committed a suicide!");
  508.             GivePlayerMoney(playerid, -500);
  509.             IsPlayerTypingKill[playerid] = true;
  510.         }
  511.         else if(IsPlayerTypingKill[playerid] == true) return SendClientMessage(playerid, COLOR_RED, "You Can not do this at the moment!");
  512.         return 1;
  513.     }
  514.     //the stats command only shows some information about the player
  515.     if (strcmp("/stats", cmdtext, true, 10) == 0)
  516.     {
  517.     new str[128], pName[24];
  518.     GetPlayerName(playerid, pName, 24);
  519.     Money = GetPlayerMoney(playerid),
  520.     GetPlayerHealth(playerid,pHealth);
  521.     GetPlayerArmour(playerid,pArmour);
  522.     Score =GetPlayerScore(playerid);
  523.     Player[playerid][Wanted] = GetPlayerWantedLevel(playerid),
  524.     format(str, 128, "%s Stats :", pName);
  525.     SendClientMessage(playerid,COLOR_WHITE,str);
  526.     format(str,128, "Money : $%i --- Health : %0.f ",Money,pHealth);
  527.     SendClientMessage(playerid,COLOR_WHITE,str);
  528.     format(str,128, "Armour : %0.f --- Score : %i --- Wanted : %i",pArmour,Score,Player[playerid][Wanted]);
  529.     SendClientMessage(playerid,COLOR_WHITE,str);
  530.     format(str,128, "AdminLevel : %i --- Team rank : %i",Player[playerid][AdminLevel],Player[playerid][TeamRank]);
  531.     SendClientMessage(playerid,COLOR_WHITE,str);
  532.     return 1;
  533.     }
  534.     if (strcmp("/weaponhelp", cmdtext, true, 10) == 0)
  535.     {
  536.         SendClientMessage(playerid,COLOR_YELLOW, "***---Modern TDM Weapon Help---***");
  537.         SendClientMessage(playerid,COLOR_WHITE, "You always get weapons when you spawn. But you can buy more weapons with more bullets");
  538.         SendClientMessage(playerid,COLOR_WHITE, "You can buy weapons from AmmuNations :");
  539.         SendClientMessage(playerid,COLOR_WHITE, "Type /buygun to purchase a weapon");
  540.         SendClientMessage(playerid,COLOR_WHITE, "Other : /cmds *** /racehelp *** /drughelp *** /rules *** /help ");
  541.         SendClientMessage(playerid,COLOR_WHITE, "That's all , Have fun !!");
  542.         return 1;
  543.     }
  544.     //This command can be used in ammunation only , it shows the ammunation menu that allows
  545.     //the player to select a weapon and buy it
  546.     if (strcmp("/buygun", cmdtext, true, 10) == 0)
  547.     {
  548.         if(GetPlayerInterior(playerid) == 1)
  549.         {
  550.         TogglePlayerControllable(playerid, 0);
  551.         ShowMenuForPlayer(AmmoNationMenu,playerid);
  552.         }
  553.         else
  554.         {
  555.         SendClientMessage(playerid, COLOR_YELLOW,"You are not at the Ammu Nation ! ");
  556.         }
  557.         return 1;
  558.     }
  559.     if (strcmp("/drughelp", cmdtext, true, 10) == 0)
  560.     {
  561.         SendClientMessage(playerid,COLOR_YELLOW, "***---Modern TDM Drug Help---***");
  562.         SendClientMessage(playerid,COLOR_WHITE, "You can buy drugs to get more armor ");
  563.         SendClientMessage(playerid,COLOR_WHITE, "Type /buydrug to get 2g of drugs that will give you +20 Armour/Health ");
  564.         SendClientMessage(playerid,COLOR_WHITE, "Meth will give you +20 Health and Armour and it costs $500 ");
  565.         SendClientMessage(playerid,COLOR_WHITE, "Crack will give you +20 Armour and it costs $350 ");
  566.         SendClientMessage(playerid,COLOR_WHITE, "Pot will give you +20 Health and it costs $200 ");
  567.         SendClientMessage(playerid,COLOR_WHITE, "Other : /weaponhelp *** /cmds *** /rules *** /help ");
  568.         SendClientMessage(playerid,COLOR_WHITE, "That's all , Have fun !!");
  569.         return 1;
  570.     }
  571.     //also this command can be used only near the drug point , it shows the
  572.     //dialog where can the player select a tye of drugs and buy it
  573.     if (strcmp("/buydrug", cmdtext, true, 10) == 0)
  574.     {
  575.         if(IsPlayerInRangeOfPoint(playerid, 3, 1248.7208,-806.1448,1084.0078) )
  576.         {
  577.         TogglePlayerControllable(playerid, 0);
  578.         ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Choose a Drug type :", "Pot\nCrack\nMeth", "Buy", "Cancel");
  579.         }
  580.         else
  581.         {
  582.         SendClientMessage(playerid,COLOR_GREEN,"You are not at the Drug point right now !");
  583.         }
  584.         return 1;
  585.     }
  586.     //---------------------------------------------------------------------------------------
  587.     //Now to the afk system !!
  588.     //This commands sets you to afk mode , you'll be TPed out of the DM area
  589.     //and you won't be able to move or to chat..
  590.     if (strcmp("/goafk", cmdtext, true, 10) == 0)
  591.     {
  592.         if(Player[playerid][Afking] == 0)
  593.         {
  594.         TogglePlayerControllable(playerid, 0);
  595.         Player[playerid][Afking] = 1;
  596.         new str[128], pName[24];
  597.         GetPlayerName(playerid, pName, 24);
  598.         format(str,sizeof str,"%s is now AFK (Away from Keyboard)",pName);
  599.         SendClientMessageToAll(COLOR_RED,str);
  600.         GameTextForPlayer(playerid,"~r~ You are Now Afk",4000,3);
  601.         SetPlayerInterior(playerid,0);
  602.         SetPlayerPos(playerid,1544.2355,-1352.9237,329.4750);//Sets the player pos outside the DM area
  603.         Player[playerid][AfkMute] = true;
  604.         SetPlayerColor(playerid,0x000000AA);//It will set the player to black color
  605.         Afk = SetTimer("AfkTimer",900000,false);
  606.         }
  607.         else if(Player[playerid][Afking] == 1)
  608.         {
  609.         SendClientMessage(playerid,COLOR_RED,"You are already Afk , please use /back");
  610.         }
  611.         return 1;
  612.     }
  613.     //if you were afk , this cmd will make spawn , and you'll be
  614.     //able to chat with other players and move again !!
  615.     if (strcmp("/back", cmdtext, true, 10) == 0)
  616.     {
  617.         if(Player[playerid][Afking] == 1)
  618.         {
  619.         TogglePlayerControllable(playerid, 1);
  620.         Player[playerid][Afking] = 0;
  621.         new str[128], pName[24];
  622.         GetPlayerName(playerid, pName, 24);
  623.         format(str,sizeof str,"%s is no longer Afk (Away from Keyboard)",pName);
  624.         SendClientMessageToAll(COLOR_RED,str);//A Message will be sent to all players
  625.         GameTextForPlayer(playerid,"~r~ You are No Longer Afk",4000,3);
  626.         SetPlayerInterior(playerid,5);
  627.         SpawnPlayer(playerid);//Player will re-spawn
  628.         Player[playerid][AfkMute] = false;
  629.         SetPlayerToTeamColour(playerid);//Sets the player to his team color again
  630.         KillTimer(Afk);
  631.         }
  632.         else if(Player[playerid][Afking] == 0)
  633.         {
  634.         SendClientMessage(playerid,COLOR_RED,"You are not Afk , So you can't use this cmd , please type /goafk to be afk ");
  635.         }
  636.         return 1;
  637.     }
  638.     //---------------------------------------------------------------------------------------
  639.     if(!strcmp(cmd, "/pay"))
  640.     {
  641.   {
  642.   new targetid, cash, string[128];
  643.   if(sscanf(params, "ui", targetid,cash)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /pay [playerid/partofname] [cash]");
  644.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID !");
  645.   if (playerid == targetid) return SendClientMessage(playerid, COLOR_WHITE, "You can not give money to yourself.");
  646.   Money = GetPlayerMoney(playerid);
  647.   if(Money < cash) if (playerid == targetid) return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much");
  648.   else
  649.   {
  650.   PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  651.   new pTargetName[24], pName[24];
  652.   GetPlayerName(targetid,pTargetName,24);
  653.   GetPlayerName(playerid,pName,24);
  654.   GivePlayerMoney(targetid, cash);
  655.   GivePlayerMoney(playerid, (0 - cash));
  656.   format(string, sizeof(string), "You received %i from %s", cash,pName);
  657.   SendClientMessage(targetid, 0xFFC0CBFF,string);
  658.   format(string, sizeof(string), "You transfered %i to %s", cash,pTargetName);
  659.   SendClientMessage(playerid, 0xFFC0CBFF,string);
  660.   }
  661.   }
  662.   return 1;
  663. }
  664.  
  665.     if(!strcmp(cmd, "/savestats"))
  666.     {
  667.   {
  668.     new playersfile[256], pName[24];
  669.     GetPlayerName(playerid, pName, 24);
  670.     format(playersfile, sizeof(playersfile), SERVER_USER_FILE, pName);
  671.     if(Player[playerid][Logged] == 1)
  672.     {
  673.         dini_IntSet(playersfile, "Level", GetPlayerScore(playerid));
  674.         dini_IntSet(playersfile, "Cash", GetPlayerMoney(playerid));
  675.         dini_IntSet(playersfile, "AdminLevel",Player[playerid][AdminLevel]);
  676.         dini_IntSet(playersfile, "TeamRank",Player[playerid][TeamRank]);
  677.         dini_IntSet(playersfile, "Muted",Player[playerid][Mute]);
  678.         dini_IntSet(playersfile, "Jailed",Player[playerid][Jailed]);
  679.         dini_IntSet(playersfile, "Wanted",GetPlayerWantedLevel(playerid));
  680.         SendClientMessage(playerid, 0xFFC0CBFF,"Stats Saved");
  681.         Player[playerid][Logged] = 0;
  682.     }
  683.   }
  684.   return 1;
  685. }
  686.  
  687.     if(!strcmp(cmd, "/giverank"))
  688.     {
  689.   {
  690.   new targetid, rank, string[128];
  691.   if(Player[playerid][TeamRank] < 5) return SendClientMessage(playerid, COLOR_WHITE, "You are not able to use this Command (only rank 6)");
  692.   if(sscanf(params, "ui", targetid,rank)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /givernak [playerid/partofname] [rank]");
  693.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID !");
  694.   if (playerid == targetid) return SendClientMessage(playerid, COLOR_WHITE, "You can not give money to yourself.");
  695.   else
  696.   {
  697.   new pTargetName[24], pName[24];
  698.   GetPlayerName(targetid,pTargetName,24);
  699.   GetPlayerName(playerid,pName,24);
  700.   format(string, sizeof(string), "Leader/Co-Leader %s has made you Rank %i ", pName,rank);
  701.   SendClientMessage(targetid, 0xFFC0CBFF,string);
  702.   format(string, sizeof(string), "You Made %s rank %i",pTargetName, rank);
  703.   SendClientMessage(playerid, 0xFFC0CBFF,string);
  704.   }
  705.   }
  706.   return 1;
  707. }
  708.  
  709.  
  710.     if(!strcmp(cmd, "/report"))
  711.     {
  712.   {
  713.   new string[128], reason[64];
  714.   if(sscanf(params, "z", reason)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /report [reason]");
  715.   else
  716.   {
  717.   new pName[24];
  718.   GetPlayerName(playerid, pName, 128);
  719.   for (new i = 0; i < MAX_PLAYERS; i++)
  720.     {
  721.         if(IsPlayerConnected(i))
  722.         {
  723.             if(Player[i][AdminLevel] >= 1)
  724.             {
  725.                 format(string, sizeof(string), "Report : %s , Reason : %s", pName, reason);
  726.                 SendClientMessage(i, COLOR_RED, string);
  727.             }
  728.         }
  729.     }
  730.   }
  731.   }
  732.   return 1;
  733. }
  734.     //---------------------------------------------------------------------------------------
  735.     if (strcmp("/cc", cmdtext, true, 10) == 0)
  736.     {
  737.         if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  738.         for(new i=0; i<49; i++)
  739.         {
  740.              SendClientMessageToAll(0x33FF33AA, " "); return 1;
  741.         }
  742.         return 1;
  743.     }
  744.     if (strcmp("/countdown", cmdtext, true, 10) == 0)
  745.     {
  746.         if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  747.         else
  748.         {
  749.         GameTextForAll("~w~3",3000, 4);
  750.         SetTimer("CountDown2",3500,false);
  751.         }
  752.         return 1;
  753.     }
  754.     if(!strcmp(cmd, "/payday"))
  755.     {
  756.   {
  757.   if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  758.   new money;
  759.   if(sscanf(params, "i", money)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /payday [money]");
  760.   else
  761.   {
  762.   for(new i; i< MAX_PLAYERS; i++)
  763.             {
  764.                 GivePlayerMoney(i,money);
  765.                 SendClientMessage(i,COLOR_RED,"an Admin has sent an ammount of money to all the Players");
  766.             }
  767.   }
  768.   }
  769.   return 1;
  770. }
  771.     //Kick cmd :
  772.     if(!strcmp(cmd, "/kick"))
  773.     {
  774.   {
  775.   if(Player[playerid][AdminLevel] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  776.   new targetid, reason[64], string[128];
  777.   if(sscanf(params, "uz", targetid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /kick [playerid/partofname] [reason]");
  778.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  779.   if(Player[targetid][AdminLevel] > Player[playerid][AdminLevel])
  780.   {
  781.   new pName[24];
  782.   GetPlayerName(playerid,pName,24);
  783.   format(string, sizeof(string), "%s have been Kicked for attempting to kick a Higher level admin!", pName);
  784.   SendClientMessageToAll(COLOR_RED,string);
  785.   Kick(playerid);
  786.   }
  787.   else
  788.   {
  789.   new pTargetName[24], pName[24];
  790.   GetPlayerName(playerid,pName,24);
  791.   GetPlayerName(targetid,pTargetName,24);
  792.   format(string, sizeof(string), "%s have been Kicked By Admin %s ! Reason: %s", pTargetName, pName, reason);
  793.   SendClientMessageToAll(COLOR_RED,string);
  794.   Kick(targetid);
  795.   }
  796.   }
  797.   return 1;
  798. }
  799.  
  800.  
  801.     if(!strcmp(cmd, "/getstats"))
  802.     {
  803.   {
  804.   if(Player[playerid][AdminLevel] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  805.   new targetid;
  806.   if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /getstats [playerid/partofname]");
  807.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  808.   else
  809.   {
  810.     new str[128], pName[24];
  811.     GetPlayerName(targetid, pName, 24);
  812.     Money = GetPlayerMoney(targetid),
  813.     GetPlayerHealth(targetid,pHealth);
  814.     GetPlayerArmour(targetid,pArmour);
  815.     Score =GetPlayerScore(targetid);
  816.     Player[targetid][Wanted] = GetPlayerWantedLevel(targetid),
  817.     format(str, 128, "%s Stats :", pName);
  818.     SendClientMessage(playerid,COLOR_WHITE,str);
  819.     format(str,128, "Money : $%i --- Health : %0.f ",Money,pHealth);
  820.     SendClientMessage(playerid,COLOR_WHITE,str);
  821.     format(str,128, "Armour : %0.f --- Score : %i --- Wanted : %i",pArmour,Score,Player[targetid][Wanted]);
  822.     SendClientMessage(playerid,COLOR_WHITE,str);
  823.     format(str,128, "AdminLevel : %i --- Team rank : %i",Player[targetid][AdminLevel],Player[targetid][TeamRank]);
  824.     SendClientMessage(playerid,COLOR_WHITE,str);
  825.   }
  826.   }
  827.   return 1;
  828. }
  829.  
  830.  
  831.     //Ban cmd
  832.     if(!strcmp(cmd, "/ban"))
  833.     {
  834.   {
  835.   if(Player[playerid][AdminLevel] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  836.   new targetid, reason[64], string[128];
  837.   if(sscanf(params, "uz", targetid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /ban [playerid/partofname] [reason]");
  838.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  839.   if(Player[targetid][AdminLevel] > Player[playerid][AdminLevel])
  840.   {
  841.   new pName[24];
  842.   GetPlayerName(playerid,pName,24);
  843.   format(string, sizeof(string), "%s have been Banned for attempting to ban a Higher level admin!", pName);
  844.   SendClientMessageToAll(COLOR_RED,string);
  845.   Ban(playerid);
  846.   }
  847.   {
  848.   new pTargetName[24], pName[24];
  849.   GetPlayerName(playerid,pName,24);
  850.   GetPlayerName(targetid,pTargetName,24);
  851.   format(string, sizeof(string), "%s have been Banned By Admin %s ! Reason: %s", pTargetName, pName, reason);
  852.   SendClientMessageToAll(COLOR_RED,string);
  853.   Ban(targetid);
  854.   }
  855.   }
  856.   return 1;
  857. }
  858.  
  859.  
  860.     //Mute cmd
  861.     if(!strcmp(cmd, "/mute"))
  862.     {
  863.   {
  864.   if(Player[playerid][AdminLevel] < 2) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  865.   new targetid, reason[64], string[128];
  866.   if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /mute [playerid/partofname] [reason]");
  867.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  868.   if(Player[targetid][Mute] == 1)
  869.   {
  870.   SendClientMessage(playerid, COLOR_WHITE, "Player is Already Muted");
  871.   }
  872.   else
  873.   {
  874.   new pTargetName[24], pName[24];
  875.   GetPlayerName(playerid,pName,24);
  876.   GetPlayerName(targetid,pTargetName,24);
  877.   format(string, sizeof(string), "%s have been Muted By Admin %s ! Reason: %s",pTargetName, pName, reason);
  878.   SendClientMessageToAll(COLOR_RED,string);
  879.   Player[targetid][Mute] = 1;
  880.   }
  881.   }
  882.   return 1;
  883. }
  884.  
  885.     //Unmute cmd
  886.     if(!strcmp(cmd, "/unmute"))
  887.     {
  888.   {
  889.   if(Player[playerid][AdminLevel] < 2) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  890.   new targetid, string[128];
  891.   if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /unmute [playerid/partofname]");
  892.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  893.   if(Player[targetid][Mute] == 0)
  894.   {
  895.   SendClientMessage(playerid, COLOR_WHITE, "Player isn't Muted");
  896.   }
  897.   else
  898.   {
  899.   new pTargetName[24], pName[24];
  900.   GetPlayerName(playerid,pName,24);
  901.   GetPlayerName(targetid,pTargetName,24);
  902.   format(string, sizeof(string), "%s have been unmuted By Admin %s ! ",pTargetName, pName);
  903.   SendClientMessageToAll(COLOR_RED,string);
  904.   Player[targetid][Mute] = 0;
  905.   }
  906.   }
  907.   return 1;
  908. }
  909.  
  910.  
  911.     //Freeze cmd
  912.     if(!strcmp(cmd, "/freeze"))
  913.     {
  914.   {
  915.   if(Player[playerid][AdminLevel] < 2) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  916.   new targetid, string[128];
  917.   if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /freeze [playerid/partofname]");
  918.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  919.   if(Player[targetid][Frozen] == 1)
  920.   {
  921.   SendClientMessage(playerid, COLOR_WHITE, "Player is already Frozen");
  922.   }
  923.   else
  924.   {
  925.   new pTargetName[24], pName[24];
  926.   GetPlayerName(playerid,pName,24);
  927.   GetPlayerName(targetid,pTargetName,24);
  928.   format(string, sizeof(string), "%s have been Freezed By Admin %s !",pTargetName, pName);
  929.   SendClientMessageToAll(COLOR_RED,string);
  930.   Player[targetid][Frozen] = 1;
  931.   TogglePlayerControllable(targetid, 0);
  932.   }
  933.   }
  934.   return 1;
  935. }
  936.  
  937.  
  938.     //Unfreeze cmd
  939.     if(!strcmp(cmd, "/unfreeze"))
  940.     {
  941.   {
  942.   if(Player[playerid][AdminLevel] < 2) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  943.   new targetid, string[128];
  944.   if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /unfreeze [playerid/partofname]");
  945.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  946.   if(Player[targetid][Frozen] == 0)
  947.   {
  948.   SendClientMessage(playerid, COLOR_WHITE, "Player isn't Frozen");
  949.   }
  950.   else
  951.   {
  952.   new pTargetName[24], pName[24];
  953.   GetPlayerName(playerid,pName,24);
  954.   GetPlayerName(targetid,pTargetName,24);
  955.   format(string, sizeof(string), "%s have been unfreezed By Admin %s !",pTargetName, pName);
  956.   SendClientMessageToAll(COLOR_RED,string);
  957.   Player[targetid][Frozen] = 0;
  958.   TogglePlayerControllable(targetid, 1);
  959.   }
  960.   }
  961.   return 1;
  962. }
  963.  
  964.     //Jail cmd
  965.     if(!strcmp(cmd, "/jail"))
  966.     {
  967.   {
  968.   if(Player[playerid][AdminLevel] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  969.   new targetid, reason[64], string[128];
  970.   if(sscanf(params, "uz", targetid,reason)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /jail [playerid/partofname] [reason]");
  971.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  972.   if(Player[targetid][Jailed] == 1)
  973.   {
  974.   SendClientMessage(playerid, COLOR_WHITE, "Player is already inside the jail");
  975.   }
  976.   else
  977.   {
  978.   new pName[24], pTargetName[24];
  979.   GetPlayerName(targetid,pTargetName,128);
  980.   GetPlayerName(playerid,pName,128);
  981.   format(string, sizeof(string), "%s have been Jailed By Admin %s ! Reason : %s ",pTargetName, pName, reason);
  982.   SendClientMessageToAll(COLOR_RED,string);
  983.   Player[targetid][Jailed] = 1;
  984.   SetPlayerPos(targetid, 264.6288,77.5742,1001.0391);
  985.   SetPlayerInterior(targetid, 6);
  986.   ResetPlayerWeapons(targetid);
  987.   Jail = SetTimer("JailTimer",300000,false);
  988.   }
  989.   }
  990.   return 1;
  991. }
  992.  
  993.     //Unjail cmd
  994.     if(!strcmp(cmd, "/unjail"))
  995.     {
  996.   {
  997.   if(Player[playerid][AdminLevel] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  998.   new targetid, string[128];
  999.   if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /unjail [playerid/partofname]");
  1000.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  1001.   if(Player[targetid][Jailed] == 0)
  1002.   {
  1003.   SendClientMessage(playerid, COLOR_WHITE, "Player isn't inside the jail");
  1004.   }
  1005.   else
  1006.   {
  1007.   new pName[24], pTargetName[24];
  1008.   GetPlayerName(targetid,pTargetName,128);
  1009.   GetPlayerName(playerid,pName,128);
  1010.   format(string, sizeof(string), "%s have been unjailed By Admin %s !",pTargetName, pName);
  1011.   SendClientMessageToAll(COLOR_RED,string);
  1012.   Player[targetid][Jailed] = 0;
  1013.   SpawnPlayer(targetid);
  1014.   SetPlayerInterior(targetid, 5);
  1015.   KillTimer(Jail);
  1016.   }
  1017.   }
  1018.   return 1;
  1019. }
  1020.     //Spec cmd
  1021.     if(!strcmp(cmd, "/spec"))
  1022.     {
  1023.   {
  1024.   if(Player[playerid][AdminLevel] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  1025.   new targetid;
  1026.   if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /spec [playerid/partofname]");
  1027.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  1028.   if(IsPlayerSpecing[playerid] == true)
  1029.   {
  1030.   SendClientMessage(playerid, COLOR_WHITE, "You are already specing someone , please type /stopspec");
  1031.   }
  1032.   else
  1033.   {
  1034.   SendClientMessage(playerid, COLOR_RED,"You Are Now specing , type /stopspec to stop specing this player ! ");
  1035.   IsPlayerSpecing[playerid] = true;
  1036.   TogglePlayerSpectating(playerid, 1);
  1037.   PlayerSpectatePlayer(playerid, targetid);
  1038.   SetPlayerInterior(playerid,GetPlayerInterior(targetid));
  1039.   }
  1040.   }
  1041.   return 1;
  1042. }
  1043.  
  1044.     //specoff cmd
  1045.     if(!strcmp(cmd, "/stopspec"))
  1046.     {
  1047.   {
  1048.   if(Player[playerid][AdminLevel] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  1049.   if(IsPlayerSpecing[playerid] == false)
  1050.   {
  1051.   SendClientMessage(playerid, COLOR_WHITE, "You are not specing anyone right now ! ");
  1052.   }
  1053.   else
  1054.   {
  1055.   SendClientMessage(playerid, COLOR_RED,"You aren't specing that Player anymore ! ");
  1056.   IsPlayerSpecing[playerid] = false;
  1057.   TogglePlayerSpectating(playerid, 0);
  1058.   }
  1059.   }
  1060.   return 1;
  1061. }
  1062.  
  1063.     //Goto cmd
  1064.     if(!strcmp(cmd, "/goto"))
  1065.     {
  1066.   {
  1067.   if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  1068.   new targetid, string[128];
  1069.   if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /goto [playerid/partofname]");
  1070.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  1071.   else
  1072.   {
  1073.   new pName[24];
  1074.   GetPlayerName(targetid,pName,128);
  1075.   format(string, sizeof(string), "You Have been Teleported to %s ",pName);
  1076.   SendClientMessage(playerid,COLOR_RED,string);
  1077.   SetPlayerInterior(playerid,GetPlayerInterior(targetid));
  1078.   new Float:TPX, Float:TPY, Float:TPZ;
  1079.   GetPlayerPos(targetid, TPX, TPY, TPZ);
  1080.   SetPlayerPos(playerid, TPX, TPY, TPZ+1);
  1081.   }
  1082.   }
  1083.   return 1;
  1084. }
  1085.  
  1086.  
  1087.     //Get here cmd
  1088.     if(!strcmp(cmd, "/gethere"))
  1089.     {
  1090.   {
  1091.   if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  1092.   new targetid, string[128];
  1093.   if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /gethere [playerid/partofname]");
  1094.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  1095.   else
  1096.   {
  1097.   new pName[24];
  1098.   GetPlayerName(playerid,pName,128);
  1099.   format(string, sizeof(string), "You Have been Teleported to %s ",pName);
  1100.   SendClientMessage(targetid,COLOR_RED,string);
  1101.   SetPlayerInterior(targetid,GetPlayerInterior(playerid));
  1102.   new Float:TPX, Float:TPY, Float:TPZ;
  1103.   GetPlayerPos(playerid, TPX, TPY, TPZ);
  1104.   SetPlayerPos(targetid, TPX, TPY, TPZ+1);
  1105.   }
  1106.   }
  1107.   return 1;
  1108. }
  1109.  
  1110.     //admin announcement cmd 1
  1111.     if(!strcmp(cmd, "/asay1"))
  1112.   {
  1113.   if(Player[playerid][AdminLevel] < 2) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  1114.   new text[64];
  1115.   if(sscanf(params, "z",text)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /asay [text]");
  1116.   new string[128];
  1117.   new pName[24];
  1118.   GetPlayerName(playerid,pName,128);
  1119.   format(string,sizeof string,"[ADMIN]%s: %s",pName,text);
  1120.   SendClientMessageToAll(COLOR_RED,string);
  1121.   return 1;
  1122. }
  1123.  
  1124.  
  1125.     if(!strcmp(cmd, "/asay2"))
  1126.   {
  1127.   if(Player[playerid][AdminLevel] < 2) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  1128.   new text[64];
  1129.   if(sscanf(params, "z",text)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /asay [text]");
  1130.   new string[128];
  1131.   new pName[24];
  1132.   GetPlayerName(playerid,pName,128);
  1133.   format(string,sizeof string,"[ADMIN]%s: %s",pName,text);
  1134.   GameTextForAll(string, 500, 6);
  1135.   return 1;
  1136. }
  1137.  
  1138.     //Admin kill cmd
  1139.     if(!strcmp(cmd, "/akill"))
  1140.     {
  1141.   if(Player[playerid][AdminLevel] < 2) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  1142.   new targetid;
  1143.   if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /akill [playerid/partofname]");
  1144.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  1145.   SendClientMessage(targetid, COLOR_RED,"You Have been Killed by an Admin ! ");
  1146.   SetPlayerHealth(targetid,0);
  1147.   return 1;
  1148. }
  1149.  
  1150.     //Admin spawn cmd
  1151.     if(!strcmp(cmd, "/aspawn"))
  1152.     {
  1153.   {
  1154.   if(Player[playerid][AdminLevel] < 2) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  1155.   new targetid;
  1156.   if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /aspawn [playerid/partofname]");
  1157.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  1158.   else
  1159.   {
  1160.   SendClientMessage(targetid, COLOR_RED,"You Have been Spawned by an Admin ! ");
  1161.   SpawnPlayer(targetid);
  1162.   }
  1163.   }
  1164.   return 1;
  1165. }
  1166.  
  1167.     //Setscore , hp , money , armour cmds
  1168.     if(!strcmp(cmd, "/setscore"))
  1169.   {
  1170.   if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  1171.   new targetid, score;
  1172.   if(sscanf(params, "ui", targetid,score)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /setscore [playerid/partofname] [score]");
  1173.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  1174.   SetPlayerScore(targetid, score);
  1175.   SendClientMessage(targetid, COLOR_RED, "an Admin has changed your Score.");
  1176.   return 1;
  1177. }
  1178.  
  1179.  
  1180.     if(!strcmp(cmd, "/sethp"))
  1181.     {
  1182.   {
  1183.   if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  1184.   new targetid, hp;
  1185.   if(sscanf(params, "ui", targetid,hp)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /sethp [playerid/partofname] [health]");
  1186.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  1187.   else
  1188.   {
  1189.   SetPlayerHealth(targetid, hp);
  1190.   SendClientMessage(targetid, COLOR_RED, "an Admin has setted your Health. " );
  1191.   }
  1192.   }
  1193.   return 1;
  1194. }
  1195.  
  1196.  
  1197.     if(!strcmp(cmd, "/setarmour"))
  1198.     {
  1199.   {
  1200.   if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  1201.   new targetid, armour;
  1202.   if(sscanf(params, "ui", targetid,armour)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /setarmour [playerid/partofname] [armour]");
  1203.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  1204.   else
  1205.   {
  1206.   SetPlayerArmour(targetid, armour);
  1207.   SendClientMessage(targetid, COLOR_RED, "an Admin has setted your Armour. ");
  1208.   }
  1209.   }
  1210.   return 1;
  1211. }
  1212.  
  1213.  
  1214.     if(!strcmp(cmd, "/setmoney"))
  1215.     {
  1216.   {
  1217.   if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  1218.   new targetid, money;
  1219.   if(sscanf(params, "ui", targetid,money)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /setmoney [playerid/partofname] [money]");
  1220.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  1221.   else
  1222.   {
  1223.   GivePlayerMoney(targetid, money);
  1224.   SendClientMessage(targetid, COLOR_RED, "an Admin Has changed your Money");
  1225.   }
  1226.   }
  1227.   return 1;
  1228. }
  1229.  
  1230.     //Slap cmd
  1231.     if(!strcmp(cmd, "/slap"))
  1232.     {
  1233.   {
  1234.   if(Player[playerid][AdminLevel] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  1235.   new targetid;
  1236.   if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /slap [playerid/partofname]");
  1237.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  1238.   if(Player[targetid][AdminLevel] > Player[playerid][AdminLevel])
  1239.   {
  1240.   SendClientMessage(targetid, COLOR_RED,"You Have been Slapped for attempting to slap a higher level admin ! ");
  1241.   new Float:SLX, Float:SLY, Float:SLZ;
  1242.   GetPlayerHealth(playerid, pHealth);
  1243.   SetPlayerHealth(playerid, pHealth-5);
  1244.   GetPlayerPos(playerid, SLX, SLY, SLZ);
  1245.   SetPlayerPos(playerid, SLX, SLY, SLZ+5);
  1246.   PlayerPlaySound(playerid, 1130, SLX, SLY, SLZ+5);
  1247.   }
  1248.   else
  1249.   {
  1250.   SendClientMessage(targetid, COLOR_RED,"You Have been Slapped By an admin ! ");
  1251.   new Float:SLX, Float:SLY, Float:SLZ;
  1252.   GetPlayerHealth(targetid, pHealth);
  1253.   SetPlayerHealth(targetid, pHealth-5);
  1254.   GetPlayerPos(targetid, SLX, SLY, SLZ);
  1255.   SetPlayerPos(targetid, SLX, SLY, SLZ+5);
  1256.   PlayerPlaySound(targetid, 1130, SLX, SLY, SLZ+5);
  1257.   }
  1258.   }
  1259.   return 1;
  1260. }
  1261.  
  1262.     if(!strcmp(cmd, "/nochat"))
  1263.     {
  1264.   {
  1265.   if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  1266.   new pName[24], string[128];
  1267.   GetPlayerName(playerid,pName,24);
  1268.   if (IsChatOnOrOff[playerid] == false)
  1269.   {
  1270.   for(new i; i< MAX_PLAYERS; i++)
  1271.   {
  1272.       IsChatOnOrOff[i] = true;
  1273.       format(string,128,"Admin %s Has turned off the Chat channel", pName);
  1274.       SendClientMessage(i, COLOR_RED,string);
  1275.   }
  1276.   }
  1277.   else if(IsChatOnOrOff[playerid] == true)
  1278.   {
  1279.   for(new i; i< MAX_PLAYERS; i++)
  1280.   {
  1281.       IsChatOnOrOff[i] = false;
  1282.       format(string,128,"Admin %s Has turned on the Chat channel", pName);
  1283.       SendClientMessage(i, COLOR_RED,string);
  1284.   }
  1285.   }
  1286.   }
  1287.   return 1;
  1288. }
  1289.  
  1290.     if(!strcmp(cmd, "/makeadmin"))
  1291.     {
  1292.   {
  1293.   if(Player[playerid][AdminLevel] < 9998) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this command !");
  1294.   new targetid, adminlevel;
  1295.   if(sscanf(params, "ui", targetid, adminlevel)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /makeadmin [playerid/partofname] [level]");
  1296.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  1297.   if(adminlevel >= 1 && adminlevel <= 9999)
  1298.   {
  1299.   new pName[64], string[128];
  1300.   GetPlayerName(playerid,pName,64);
  1301.   Player[targetid][AdminLevel] = adminlevel;
  1302.   format(string, sizeof(string), "You have been promoted to level %d admin by %s", adminlevel, pName);
  1303.   SendClientMessage(targetid, COLOR_RED, string);
  1304.   return 1;
  1305.   }
  1306.   else
  1307.   {
  1308.   SendClientMessage(playerid, COLOR_RED, "Admin levels are from 1 to 9999");
  1309.   }
  1310.   }
  1311.   return 1;
  1312. }
  1313.  
  1314.  
  1315.     if(!strcmp(cmd, "/gmx"))
  1316.     {
  1317.   {
  1318.   if(Player[playerid][AdminLevel] < 9998) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this command !");
  1319.   else
  1320.   {
  1321.   GameTextForAll("Server Restart in 15seconds , Type /savestats , to save all of your Stats",3000,6);
  1322.   SetTimer("Gmx",15000,false);
  1323.   }
  1324.   }
  1325.   return 1;
  1326. }
  1327.  
  1328.     if(!strcmp(cmd, "/setrank"))
  1329.     {
  1330.   {
  1331.   if(Player[playerid][AdminLevel] < 9998) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  1332.   new targetid, rank;
  1333.   if(sscanf(params, "ui", targetid, rank)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /giveweapon [playerid/partofname] [rank]");
  1334.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  1335.   if(rank >= 1 && rank <= 6)
  1336.                 {
  1337.                         new string[128];
  1338.                         new pName[24];
  1339.                         Player[targetid][TeamRank] = rank;
  1340.                         GetPlayerName(targetid, pName, 24);
  1341.                         format(string, sizeof(string), "You have set %s's rank to %i.", pName, rank);
  1342.                         SendClientMessage(playerid, COLOR_RED, string);
  1343.                         format(string, sizeof(string), "You have been set to rank %d by an Admin.", pName, rank);
  1344.                         SendClientMessage(targetid, COLOR_RED, string);
  1345.                         return 1;
  1346.                 }
  1347.   else return SendClientMessage(playerid, COLOR_RED, "Ranks are between 1 and 6.");
  1348.   }
  1349. }
  1350.  
  1351.  
  1352.     if (strcmp("/ah", cmdtext, true, 10) == 0)
  1353.     {
  1354.         if(Player[playerid][AdminLevel] >= 1)
  1355.         {
  1356.         SendClientMessage(playerid,COLOR_YELLOW, "***---Modern TDM Admin Help---***");
  1357.         SendClientMessage(playerid,COLOR_WHITE, "Junior Admin (1) : /kick --- /ban --- /jail --- /unjail --- /spec --- /stopspec --- /getstats --- /slap --- #Tetx (admin chat)");
  1358.         }
  1359.         if(Player[playerid][AdminLevel] >= 2)
  1360.         {
  1361.         SendClientMessage(playerid,COLOR_WHITE, "General Admin (2) : /freeze --- /unfreeze --- /mute --- /unmute --- /akill ---  /aspawn --- /asay1 --- /asay2");
  1362.         SendClientMessage(playerid,COLOR_WHITE,"/countdown --- /cc --- /payday --- /gethere --- /nochat-");
  1363.         }
  1364.         if(Player[playerid][AdminLevel] >= 3)
  1365.         {
  1366.         SendClientMessage(playerid,COLOR_WHITE, "Senior Admin (3) : /goto --- /setscore --- /setmoney --- /sethp --- /setarmour --- /takeweapon --- /giveweapon");
  1367.         }
  1368.         if(Player[playerid][AdminLevel] >= 9998)
  1369.         {
  1370.         SendClientMessage(playerid,COLOR_WHITE, "Co-owner (9998) // Owner (9999) : /makeadmin --- /setrank --- /gmx");
  1371.         }
  1372.         else
  1373.         {
  1374.         SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  1375.         }
  1376.         return 1;
  1377.     }
  1378.     //admin weapons commands
  1379.     if(!strcmp(cmd, "/takeweapon"))
  1380.     {
  1381.   {
  1382.   if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  1383.   new targetid;
  1384.   if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /takeweapon [playerid/partofname]");
  1385.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  1386.   else
  1387.   {
  1388.   SendClientMessage(targetid, COLOR_RED,"an Admin took all of your weapons");
  1389.   ResetPlayerWeapons(targetid);
  1390.   }
  1391.   }
  1392.   return 1;
  1393. }
  1394.  
  1395.     if(!strcmp(cmd, "/giveweapon"))
  1396.     {
  1397.   {
  1398.   if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
  1399.   new targetid, weapon, ammo;
  1400.   if(sscanf(params, "uii", targetid, weapon,ammo))
  1401.   {
  1402.   SendClientMessage(playerid, COLOR_WHITE, "Usage: /giveweapon [playerid/partofname] [weaponid] [ammo]");
  1403.   SendClientMessage(playerid, COLOR_WHITE, "1(Brass) 2(Nite) 3(Club) 4(knife) 5(bat) 6(Shovel) 7(Cue) 8(Katana) 9(Chainsaw) 10-13(Dildo)");
  1404.   SendClientMessage(playerid, COLOR_WHITE, "14(Flowers) 15(Cane) 16(Grenades) 17(Teargas) 18(Molotovs) 22(Pistol) 23(SPistol) 24(Eagle)");
  1405.   SendClientMessage(playerid, COLOR_WHITE, "25(Shotgun) 26(sawn-off) 27(Combat) 28(TEC9) 29(MP5) 30(AK47) 31(M4) 32(MAC10) 33(Country)");
  1406.   SendClientMessage(playerid, COLOR_WHITE, "34(Sniper) 35(RPG) 37(Flamethrower) 38(Minigun) 41(spray) 42(exting) 43(Camera) 46(Parachute)");
  1407.   }
  1408.   if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
  1409.   if(weapon >= 1 && weapon <= 46)
  1410.                 {
  1411.                     if(ammo >= 1 && ammo <= 10000)
  1412.                     {
  1413.                         new string[128];
  1414.                         new pName[24];
  1415.                         GetPlayerName(targetid, pName, 24);
  1416.                         format(string, sizeof(string), "an Admin has gave you a weapon (WeaponID : %d with %d ammo).", weapon, ammo);
  1417.                         SendClientMessage(targetid, COLOR_RED, string);
  1418.                         format(string, sizeof(string), "You gave a weapon to %s (Weapon ID : %d with %d ammo).", pName, weapon, ammo);
  1419.                         SendClientMessage(playerid, COLOR_RED, string);
  1420.                         GivePlayerWeapon(targetid, weapon, ammo);
  1421.                         return 1;
  1422.                     }
  1423.                     else return SendClientMessage(playerid, COLOR_RED, "Weapon ID's are from 1 to 64 and Max Ammo is 10000");
  1424.                 }
  1425.   else return SendClientMessage(playerid, COLOR_RED, "Weapon ID's are from 1 to 64 and Max Ammo is 10000");
  1426.   }
  1427.   //---------------------------------------------------------------------------------------
  1428.   }
  1429.     return 1;
  1430. }
  1431.  
  1432.  
  1433.  
  1434.  
  1435. public OnPlayerSelectedMenuRow(playerid, row)
  1436.  
  1437. if(GetPlayerMenu(playerid) == AmmoNationMenu)
  1438. {
  1439.     switch(row)
  1440.     {
  1441.     //this menu will be showing only if player type /buygun inside the ammunation
  1442.     //when player select a weapon , first it checks his money (< or > of the gun price)
  1443.     //if it is < player money , player won't get the weapon and if it is > player money
  1444.     //He'll get the weapon
  1445.         case 0: //AK47
  1446.         {
  1447.           TogglePlayerControllable(playerid, 1);
  1448.           if(GetPlayerMoney(playerid) < 8000)
  1449.           {
  1450.           SendClientMessage(playerid,COLOR_YELLOW,"You Can not afford this");
  1451.           }
  1452.           else
  1453.           {
  1454.           GivePlayerWeapon(playerid,30,750);
  1455.           SendClientMessage(playerid, COLOR_YELLOW, "You Bought an AK47 from the Ammu Nation!");
  1456.           GivePlayerMoney(playerid, -8000);
  1457.           }
  1458.         }
  1459.         case 1: //M4
  1460.         {
  1461.           TogglePlayerControllable(playerid, 1);
  1462.           if(GetPlayerMoney(playerid) < 9000)
  1463.           {
  1464.           SendClientMessage(playerid,COLOR_YELLOW,"You Can not afford this");
  1465.           }
  1466.           else
  1467.           {
  1468.           GivePlayerWeapon(playerid,31,750);
  1469.           SendClientMessage(playerid, COLOR_YELLOW, "You Bought an M4 from the Ammu Nation!");
  1470.           GivePlayerMoney(playerid, -9000);
  1471.           }
  1472.         }
  1473.         case 2: //MP5
  1474.         {
  1475.           TogglePlayerControllable(playerid, 1);
  1476.           if(GetPlayerMoney(playerid) < 4000)
  1477.           {
  1478.           SendClientMessage(playerid,COLOR_YELLOW,"You Can not afford this");
  1479.           }
  1480.           else
  1481.           {
  1482.           GivePlayerWeapon(playerid,29,2400);
  1483.           SendClientMessage(playerid, COLOR_YELLOW, "You Bought an MP5 from the Ammu Nation!");
  1484.           GivePlayerMoney(playerid, -4000);
  1485.           }
  1486.         }
  1487.         case 3: //UZI
  1488.         {
  1489.           TogglePlayerControllable(playerid, 1);
  1490.           if(GetPlayerMoney(playerid) < 4000)
  1491.           {
  1492.           SendClientMessage(playerid,COLOR_YELLOW,"You Can not afford this");
  1493.           }
  1494.           else
  1495.           {
  1496.           GivePlayerWeapon(playerid,28,2400);
  1497.           SendClientMessage(playerid, COLOR_YELLOW, "You Bought a UZI from the Ammu Nation!");
  1498.           GivePlayerMoney(playerid, -4000);
  1499.           }
  1500.         }
  1501.         case 4: //SPAS12
  1502.         {
  1503.           TogglePlayerControllable(playerid, 1);
  1504.           if(GetPlayerMoney(playerid) < 7500)
  1505.           {
  1506.           SendClientMessage(playerid,COLOR_YELLOW,"You Can not afford this");
  1507.           }
  1508.           else
  1509.           {
  1510.           GivePlayerWeapon(playerid,27,500);
  1511.           SendClientMessage(playerid, COLOR_YELLOW, "You Bought a SPAS12 from the Ammu Nation!");
  1512.           GivePlayerMoney(playerid, -7500);
  1513.           }
  1514.         }
  1515.         case 5: //Deagle
  1516.         {
  1517.          TogglePlayerControllable(playerid, 1);
  1518.          if(GetPlayerMoney(playerid) < 5000)
  1519.           {
  1520.           SendClientMessage(playerid,COLOR_YELLOW,"You Can not afford this");
  1521.           }
  1522.           else
  1523.           {
  1524.           GivePlayerWeapon(playerid,24,450);
  1525.           SendClientMessage(playerid, COLOR_YELLOW, "You Bought a Deagle from the Ammu Nation!");
  1526.           GivePlayerMoney(playerid, -5000);
  1527.           }
  1528.         }
  1529.         case 6: //Sniper
  1530.         {
  1531.           TogglePlayerControllable(playerid, 1);
  1532.           if(GetPlayerMoney(playerid) < 10000)
  1533.           {
  1534.           SendClientMessage(playerid,COLOR_YELLOW,"You Can not afford this");
  1535.           }
  1536.           else
  1537.           {
  1538.           GivePlayerWeapon(playerid,34,25);
  1539.           SendClientMessage(playerid, COLOR_YELLOW, "You Bought a Sniper Rifle from the Ammu Nation!");
  1540.           GivePlayerMoney(playerid, -10000);
  1541.           }
  1542.         }
  1543.         case 7: //Rocket launcher
  1544.         {
  1545.           TogglePlayerControllable(playerid, 1);
  1546.           if(GetPlayerMoney(playerid) < 50000)
  1547.           {
  1548.           SendClientMessage(playerid,COLOR_YELLOW,"You Can not afford this");
  1549.           }
  1550.           else
  1551.           {
  1552.           GivePlayerWeapon(playerid,35,5);
  1553.           SendClientMessage(playerid, COLOR_YELLOW, "You Bought a Rocket Launcher from the Ammu Nation!");
  1554.           GivePlayerMoney(playerid, -50000);
  1555.           }
  1556.           //Ammunation only sells the best weapons and with a lot of ammo !
  1557.         }
  1558.     }
  1559. }
  1560.  
  1561.  
  1562. public OnPlayerPickUpPickup(playerid, pickupid)
  1563. {
  1564.     //This sends a message when player is in a pickup (to inform him about the cmd to use)
  1565.     if(pickupid == AmmoNationEntrance)
  1566.     {
  1567.     GameTextForPlayer(playerid,"~w~Type ~r~ /ENTER ~w~ to enter the Ammunation",3000,4);
  1568.     }
  1569.     if(pickupid == AmmoNationExit)
  1570.     {
  1571.     GameTextForPlayer(playerid,"~w~Type ~r~ /EXIT ~w~ to exit the Ammunation",3000,4);
  1572.     }else if(pickupid == DrugPlace)
  1573.     {
  1574.     GameTextForPlayer(playerid,"~w~Type ~r~ /BUYDRUG ~w~ to buy Drugs",3000,4);
  1575.     }
  1576.     return 1;
  1577. }
  1578.  
  1579. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  1580. {
  1581.   //This is the dialog when player types /buydrug to purchase drugs
  1582.   if (dialogid == 1)
  1583.   {
  1584.     if (response == 1)
  1585.     {
  1586.       TogglePlayerControllable(playerid, 1);
  1587.       switch (listitem)
  1588.       {
  1589.         case 0://Pot : + 20 health
  1590.         {
  1591.           if(GetPlayerMoney(playerid) < 200)
  1592.           {
  1593.           SendClientMessage(playerid,COLOR_GREEN,"You Can not afford this");
  1594.           }
  1595.           else
  1596.           {
  1597.           GetPlayerHealth(playerid,pHealth);
  1598.           GivePlayerMoney(playerid,-200);
  1599.           SetPlayerHealth(playerid,pHealth + 20);
  1600.           }
  1601.         }
  1602.         case 1://Crack : + 20 armour
  1603.         {
  1604.           if(GetPlayerMoney(playerid) < 350)
  1605.           {
  1606.           SendClientMessage(playerid,COLOR_GREEN,"You Can not afford this");
  1607.           }
  1608.           else
  1609.           {
  1610.           GetPlayerArmour(playerid,pArmour);
  1611.           GivePlayerMoney(playerid,-350);
  1612.           SetPlayerArmour(playerid,pArmour + 20);
  1613.           }
  1614.         }
  1615.         case 2://Meth : + 20 health and armour
  1616.         {
  1617.           if(GetPlayerMoney(playerid) < 500)
  1618.           {
  1619.           SendClientMessage(playerid,COLOR_GREEN,"You Can not afford this");
  1620.           }
  1621.           else
  1622.           {
  1623.           GetPlayerHealth(playerid,pHealth);
  1624.           GetPlayerArmour(playerid,pArmour);
  1625.           GivePlayerMoney(playerid,-500);
  1626.           SetPlayerHealth(playerid,pHealth + 20);
  1627.           SetPlayerArmour(playerid,pArmour + 20);
  1628.           }
  1629.         }
  1630.       }
  1631.     }
  1632.     else
  1633.     {
  1634.       TogglePlayerControllable(playerid, 1);
  1635.     }
  1636.     return 1;
  1637.   }
  1638.   //Login/Register Dialogs
  1639.   if (dialogid == 2)
  1640.     {
  1641.         new pName[24], playersfile[256], string[128];
  1642.         GetPlayerName(playerid, pName, 24);
  1643.         format(playersfile, sizeof(playersfile), SERVER_USER_FILE, pName);
  1644.         if(!response)return Kick(playerid);
  1645.         if (!strlen(inputtext)) return
  1646.         ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Welcome to Modern TDM" , "you're not registered , type your Password below.", "Register", "Exit");
  1647.         dini_Create(playersfile);
  1648.         dini_IntSet(playersfile, "Password", udb_hash(inputtext));
  1649.         dini_IntSet(playersfile, "AdminLevel",Player[playerid][AdminLevel] = 0);
  1650.         dini_IntSet(playersfile, "Cash",Player[playerid][Cash] = 0);
  1651.         dini_IntSet(playersfile, "Level",Player[playerid][Level] = 0);
  1652.         dini_IntSet(playersfile, "TeamRank",Player[playerid][TeamRank] = 1);
  1653.         format(string, 128, "Thank you for registering (Registered Name : %s , Password : %s ) You have auto Logged in", pName, inputtext);
  1654.         SendClientMessage(playerid, COLOR_YELLOW, string);
  1655.         Player[playerid][Logged] = 1;
  1656.     }
  1657.   if (dialogid == 3)
  1658.     {
  1659.         new pName[24], playersfile[256];
  1660.         GetPlayerName(playerid, pName, 24);
  1661.         format(playersfile, sizeof(playersfile), SERVER_USER_FILE, pName);
  1662.         if(!response) return Kick(playerid);
  1663.         if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 3, DIALOG_STYLE_INPUT, "Welcome Back to Modern TDM", "Type your Password below to login", "Login", "Exit");
  1664.         new tmp;
  1665.         tmp = dini_Int(playersfile, "Password");
  1666.         if(udb_hash(inputtext) != tmp) {
  1667.             SendClientMessage(playerid, COLOR_RED, "You Have been Kicked for typing a wrong PassWord.");
  1668.             Kick(playerid);
  1669.         }
  1670.         else
  1671.         {
  1672.             Player[playerid][Logged] = 1;
  1673.             Player[playerid][AdminLevel] = dini_Int(playersfile, "AdminLevel");
  1674.             Player[playerid][TeamRank] = dini_Int(playersfile, "TeamRank");
  1675.             Player[playerid][Level] = dini_Int(playersfile, "Level");
  1676.             Player[playerid][Cash] = dini_Int(playersfile, "Cash");
  1677.             Player[playerid][Mute] = dini_Int(playersfile, "Muted");
  1678.             Player[playerid][Jailed] = dini_Int(playersfile, "Jailed");
  1679.             Player[playerid][Wanted] = dini_Int(playersfile, "Wanted");
  1680.             SetPlayerScore(playerid, Player[playerid][Level]);
  1681.             GivePlayerMoney(playerid, Player[playerid][Cash]);
  1682.             SetPlayerWantedLevel(playerid, Player[playerid][Wanted]);
  1683.             SendClientMessage(playerid,COLOR_RED, "You Have been Logged in.");
  1684.         }
  1685.     }
  1686.   if (dialogid == 4)
  1687.   {
  1688.     if (response == 1)
  1689.     {
  1690.       switch (listitem)
  1691.       {
  1692.         case 0://MiniGun DeathMatch
  1693.         {
  1694.         }
  1695.         case 1://M4 And Spas12 DeathMatch
  1696.         {
  1697.         }
  1698.         case 2://Deagle and MP5 DeathMatch
  1699.         {
  1700.         }
  1701.       }
  1702.     }
  1703.     else
  1704.     {
  1705.     }
  1706.     return 1;
  1707.   }
  1708.   return 1;
  1709. }
  1710.  
  1711. public HourTimer(playerid)
  1712. {
  1713.   //The Player will get money , score and rocket for playing 1Hour..
  1714.   GivePlayerMoney(playerid,20000);
  1715.   SetPlayerScore(playerid,GetPlayerScore(playerid)+20);
  1716.   GivePlayerWeapon(playerid,35,5);
  1717.   GameTextForPlayer(playerid,"~g~You Have Passed 1Hour playing in the Server",3000,4);
  1718.   SendClientMessage(playerid,COLOR_GREEN,"You won $20.000 , + 20 Score and a Rocket Launcher !! Enjoy !!");
  1719.   return 1;
  1720. }
  1721.  
  1722. //Afk timer
  1723. public AfkTimer(playerid)
  1724. {
  1725.   new pName[64];
  1726.   new string[128];
  1727.   GetPlayerName(playerid,pName,64);
  1728.   format(string, sizeof string,"%s Has Been Kicked for Being Afk for More than 15Minutes" ,pName);
  1729.   SendClientMessageToAll(COLOR_GREEN,string);
  1730.   Kick(playerid);
  1731.   return 1;
  1732. }
  1733.  
  1734.  
  1735. // Countdowns timers
  1736. public CountDown2(playerid)
  1737. {
  1738.      GameTextForAll("~r~2",3000,4);
  1739.      SetTimer("CountDown1",3500,false);
  1740.      return 1;
  1741. }
  1742.  
  1743. public CountDown1(playerid)
  1744. {
  1745.      GameTextForAll("~b~1",3000,4);
  1746.      SetTimer("CountDownGo",3500,false);
  1747.      return 1;
  1748. }
  1749.  
  1750. public CountDownGo(playerid)
  1751. {
  1752.      GameTextForAll("~y~Go",3000,4);
  1753.      return 1;
  1754. }
  1755.  
  1756. //Jail Timer
  1757. public JailTimer(playerid)
  1758. {
  1759.      Player[playerid][Jailed] = 0;
  1760.      SpawnPlayer(playerid);
  1761.      SetPlayerInterior(playerid, 5);
  1762.      GameTextForPlayer(playerid,"~r~You are free to go now",3000,4);
  1763.      return 1;
  1764. }
  1765.  
  1766. //Gmx Timer
  1767. public Gmx(playerid)
  1768. {
  1769.      SendRconCommand("gmx");
  1770.      return 1;
  1771. }
  1772.  
  1773. //We use @Text as team chat , it is a Channel where the team members can chat
  1774. //Privatly to plan for attacking other teams etc..
  1775. //also #for admin chat , it shows admin levels too :D
  1776. public OnPlayerText(playerid, text[])
  1777. {
  1778.     if( (text[0] == '#') && strlen(text) > 1)
  1779.     {
  1780.         new str[128];
  1781.         new pName[24];
  1782.         GetPlayerName(playerid, pName, 128);
  1783.         for(new i; i < MAX_PLAYERS; i++)
  1784.             {
  1785.                 if(!IsPlayerConnected(i)) continue;
  1786.                 if(Player[i][AdminLevel] >= 1 && Player[playerid][AdminLevel] == 1)
  1787.                 {
  1788.                     format(str, 128, "Junior Admin %s Says : %s", pName, text[1]);
  1789.                     SendClientMessage(i, COLOR_RED, str);
  1790.                 }
  1791.                 if(Player[i][AdminLevel] >= 1 && Player[playerid][AdminLevel] == 2)
  1792.                 {
  1793.                     format(str, 128, "General Admin %s Says : %s", pName, text[1]);
  1794.                     SendClientMessage(i, COLOR_RED, str);
  1795.                 }
  1796.                 if(Player[i][AdminLevel] >= 1 && Player[playerid][AdminLevel] >= 3 && Player[playerid][AdminLevel] <= 9997)
  1797.                 {
  1798.                     format(str, 128, "Senior Admin %s Says : %s", pName, text[1]);
  1799.                     SendClientMessage(i, COLOR_RED, str);
  1800.                 }
  1801.                 if(Player[i][AdminLevel] >= 1 && Player[playerid][AdminLevel] == 9998)
  1802.                 {
  1803.                     format(str, 128, "Co-Owner %s Says : %s", pName, text[1]);
  1804.                     SendClientMessage(i, COLOR_RED, str);
  1805.                 }
  1806.                 if(Player[i][AdminLevel] >= 1 && Player[playerid][AdminLevel] >= 9999)
  1807.                 {
  1808.                     format(str, 128, "Owner %s Says : %s", pName, text[1]);
  1809.                     SendClientMessage(i, COLOR_RED, str);
  1810.                 }
  1811.             }
  1812.  
  1813.         return 0;
  1814.     }
  1815.     if( (text[0] == '@') && strlen(text) > 1)
  1816.     {
  1817.         new str[128];
  1818.         new pName[24];
  1819.         GetPlayerName(playerid, pName, 128);
  1820.         for(new i; i < MAX_PLAYERS; i++)
  1821.             {
  1822.                 if(!IsPlayerConnected(i)) continue;
  1823.                 if(Player[i][TeamRank] == Player[playerid][TeamRank])
  1824.                 {
  1825.                 if(Player[i][TeamRank] >= 1 && Player[playerid][TeamRank] == 1)
  1826.                 {
  1827.                     format(str, 128, "Rank 1 %s Says : %s", pName, text[1]);
  1828.                     SendClientMessage(i, COLOR_RED, str);
  1829.                 }
  1830.                 if(Player[i][TeamRank] >= 1 && Player[playerid][TeamRank] == 2)
  1831.                 {
  1832.                     format(str, 128, "Rank 2 %s Says : %s", pName, text[1]);
  1833.                     SendClientMessage(i, COLOR_RED, str);
  1834.                 }
  1835.                 if(Player[i][TeamRank] >= 1 && Player[playerid][TeamRank] == 3)
  1836.                 {
  1837.                     format(str, 128, "Rank 3(Killer) %s Says : %s", pName, text[1]);
  1838.                     SendClientMessage(i, COLOR_RED, str);
  1839.                 }
  1840.                 if(Player[i][TeamRank] >= 1 && Player[playerid][TeamRank] == 4)
  1841.                 {
  1842.                     format(str, 128, "Rank 4(Pro) %s Says : %s", pName, text[1]);
  1843.                     SendClientMessage(i, COLOR_RED, str);
  1844.                 }
  1845.                 if(Player[i][TeamRank] >= 1 && Player[playerid][TeamRank] == 5)
  1846.                 {
  1847.                     format(str, 128, "Rank 5 (Co-Leader) %s Says : %s", pName, text[1]);
  1848.                     SendClientMessage(i, COLOR_RED, str);
  1849.                 }
  1850.                 if(Player[i][TeamRank] >= 1 && Player[playerid][TeamRank] == 6)
  1851.                 {
  1852.                     format(str, 128, "Rank 1(Leader) %s Says : %s", pName, text[1]);
  1853.                     SendClientMessage(i, COLOR_RED, str);
  1854.                 }
  1855.                 }
  1856.             }
  1857.  
  1858.         return 0;
  1859.     }
  1860.     if(Player[playerid][AfkMute] == 1)
  1861.     {
  1862.         SendClientMessage(playerid, COLOR_RED, "You are AFK! You cannot talk");
  1863.         return 0;
  1864.     }
  1865.     if(Player[playerid][Mute] == 1)
  1866.     {
  1867.         SendClientMessage(playerid, COLOR_RED, "You are Muted! You cannot talk");
  1868.         return 0;
  1869.     }
  1870.     if(IsChatOnOrOff[playerid] == true)
  1871.     {
  1872.         SendClientMessage(playerid, COLOR_RED, "Chat channel is turned off by an admin");
  1873.         return 0;
  1874.     }
  1875.     return 1;
  1876. }
  1877.  
  1878. //This is the callback that sets player team from class
  1879.  
  1880. SetPlayerTeamFromClass(playerid, classid)
  1881. {
  1882.  
  1883.     if(classid == 0 || classid == 1 || classid == 2 || classid == 3 || classid == 4 || classid == 5 || classid == 6 || classid == 7 )
  1884.     {
  1885.         gTeam[playerid] = TEAM_POLICE;
  1886.         GameTextForPlayer(playerid,"~b~Police",3000,4);
  1887.     }
  1888.     if(classid == 8 || classid == 9 || classid == 10 || classid == 11 || classid == 12 || classid == 13 || classid == 14)
  1889.     {
  1890.         gTeam[playerid] = TEAM_HOBOS;
  1891.         GameTextForPlayer(playerid,"~W~Hobos",3000,4);
  1892.  
  1893.     }
  1894.     if(classid == 15 || classid == 16 || classid == 17 || classid == 18 || classid == 19 || classid == 20 || classid == 21)
  1895.     {
  1896.         gTeam[playerid] = TEAM_GROVE;
  1897.         GameTextForPlayer(playerid,"~g~Grove Street",3000,4);
  1898.  
  1899.     }
  1900.     else if(classid == 22 || classid == 23 || classid == 24 || classid == 25 || classid == 26 || classid == 27 || classid == 28)
  1901.     {
  1902.         gTeam[playerid] = TEAM_MAFIA;
  1903.         GameTextForPlayer(playerid,"~y~The Mafia",3000,4);
  1904.  
  1905.     }
  1906. }
  1907.  
  1908. //This is the callback that sets player colour according to team when he spawns
  1909.  
  1910. SetPlayerToTeamColour(playerid)
  1911. {
  1912.     if(gTeam[playerid] == TEAM_POLICE)
  1913.     {
  1914.         SetPlayerColor(playerid,TEAM_POLICE_COLOUR);
  1915.  
  1916.     }
  1917.     if(gTeam[playerid] == TEAM_HOBOS)
  1918.     {
  1919.         SetPlayerColor(playerid,TEAM_HOBOS_COLOUR);
  1920.  
  1921.     }
  1922.     if(gTeam[playerid] == TEAM_GROVE)
  1923.     {
  1924.         SetPlayerColor(playerid,TEAM_GROVE_COLOUR);
  1925.  
  1926.     }
  1927.     else if(gTeam[playerid] == TEAM_MAFIA)
  1928.     {
  1929.         SetPlayerColor(playerid,TEAM_MAFIA_COLOUR);
  1930.  
  1931.     }
  1932. }
  1933.  
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940. /*----------------------------------------------------------------------------*-
  1941. Function:
  1942.     sscanf
  1943. Params:
  1944.     string[] - String to extract parameters from.
  1945.     format[] - Parameter types to get.
  1946.     {Float,_}:... - Data return variables.
  1947. Return:
  1948.     0 - Successful, not 0 - fail.
  1949. Notes:
  1950.     A fail is either insufficient variables to store the data or insufficient
  1951.     data for the format string - excess data is disgarded.
  1952.  
  1953.     A string in the middle of the input data is extracted as a single word, a
  1954.     string at the end of the data collects all remaining text.
  1955.  
  1956.     The format codes are:
  1957.  
  1958.     c - A character.
  1959.     d, i - An integer.
  1960.     h, x - A hex number (e.g. a colour).
  1961.     f - A float.
  1962.     s - A string.
  1963.     z - An optional string.
  1964.     pX - An additional delimiter where X is another character.
  1965.     '' - Encloses a litteral string to locate.
  1966.     u - User, takes a name, part of a name or an id and returns the id if they're connected.
  1967.  
  1968.     Now has IsNumeric integrated into the code.
  1969.  
  1970.     Added additional delimiters in the form of all whitespace and an
  1971.     optioanlly specified one in the format string.
  1972. -*----------------------------------------------------------------------------*/
  1973.  
  1974. stock sscanf(string[], format[], {Float,_}:...)
  1975. {
  1976.     #if defined isnull
  1977.         if (isnull(string))
  1978.     #else
  1979.         if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
  1980.     #endif
  1981.         {
  1982.             return format[0];
  1983.         }
  1984.     #pragma tabsize 4
  1985.     new
  1986.         formatPos = 0,
  1987.         stringPos = 0,
  1988.         paramPos = 2,
  1989.         paramCount = numargs(),
  1990.         delim = ' ';
  1991.     while (string[stringPos] && string[stringPos] <= ' ')
  1992.     {
  1993.         stringPos++;
  1994.     }
  1995.     while (paramPos < paramCount && string[stringPos])
  1996.     {
  1997.         switch (format[formatPos++])
  1998.         {
  1999.             case '\0':
  2000.             {
  2001.                 return 0;
  2002.             }
  2003.             case 'i', 'd':
  2004.             {
  2005.                 new
  2006.                     neg = 1,
  2007.                     num = 0,
  2008.                     ch = string[stringPos];
  2009.                 if (ch == '-')
  2010.                 {
  2011.                     neg = -1;
  2012.                     ch = string[++stringPos];
  2013.                 }
  2014.                 do
  2015.                 {
  2016.                     stringPos++;
  2017.                     if ('0' <= ch <= '9')
  2018.                     {
  2019.                         num = (num * 10) + (ch - '0');
  2020.                     }
  2021.                     else
  2022.                     {
  2023.                         return -1;
  2024.                     }
  2025.                 }
  2026.                 while ((ch = string[stringPos]) > ' ' && ch != delim);
  2027.                 setarg(paramPos, 0, num * neg);
  2028.             }
  2029.             case 'h', 'x':
  2030.             {
  2031.                 new
  2032.                     num = 0,
  2033.                     ch = string[stringPos];
  2034.                 do
  2035.                 {
  2036.                     stringPos++;
  2037.                     switch (ch)
  2038.                     {
  2039.                         case 'x', 'X':
  2040.                         {
  2041.                             num = 0;
  2042.                             continue;
  2043.                         }
  2044.                         case '0' .. '9':
  2045.                         {
  2046.                             num = (num << 4) | (ch - '0');
  2047.                         }
  2048.                         case 'a' .. 'f':
  2049.                         {
  2050.                             num = (num << 4) | (ch - ('a' - 10));
  2051.                         }
  2052.                         case 'A' .. 'F':
  2053.                         {
  2054.                             num = (num << 4) | (ch - ('A' - 10));
  2055.                         }
  2056.                         default:
  2057.                         {
  2058.                             return -1;
  2059.                         }
  2060.                     }
  2061.                 }
  2062.                 while ((ch = string[stringPos]) > ' ' && ch != delim);
  2063.                 setarg(paramPos, 0, num);
  2064.             }
  2065.             case 'c':
  2066.             {
  2067.                 setarg(paramPos, 0, string[stringPos++]);
  2068.             }
  2069.             case 'f':
  2070.             {
  2071.  
  2072.                 new changestr[16], changepos = 0, strpos = stringPos;
  2073.                 while(changepos < 16 && string[strpos] && string[strpos] != delim)
  2074.                 {
  2075.                     changestr[changepos++] = string[strpos++];
  2076.                     }
  2077.                 changestr[changepos] = '\0';
  2078.                 setarg(paramPos,0,_:floatstr(changestr));
  2079.             }
  2080.             case 'p':
  2081.             {
  2082.                 delim = format[formatPos++];
  2083.                 continue;
  2084.             }
  2085.             case '\'':
  2086.             {
  2087.                 new
  2088.                     end = formatPos - 1,
  2089.                     ch;
  2090.                 while ((ch = format[++end]) && ch != '\'') {}
  2091.                 if (!ch)
  2092.                 {
  2093.                     return -1;
  2094.                 }
  2095.                 format[end] = '\0';
  2096.                 if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
  2097.                 {
  2098.                     if (format[end + 1])
  2099.                     {
  2100.                         return -1;
  2101.                     }
  2102.                     return 0;
  2103.                 }
  2104.                 format[end] = '\'';
  2105.                 stringPos = ch + (end - formatPos);
  2106.                 formatPos = end + 1;
  2107.             }
  2108.             case 'u':
  2109.             {
  2110.                 new
  2111.                     end = stringPos - 1,
  2112.                     id = 0,
  2113.                     bool:num = true,
  2114.                     ch;
  2115.                 while ((ch = string[++end]) && ch != delim)
  2116.                 {
  2117.                     if (num)
  2118.                     {
  2119.                         if ('0' <= ch <= '9')
  2120.                         {
  2121.                             id = (id * 10) + (ch - '0');
  2122.                         }
  2123.                         else
  2124.                         {
  2125.                             num = false;
  2126.                         }
  2127.                     }
  2128.                 }
  2129.                 if (num && IsPlayerConnected(id))
  2130.                 {
  2131.                     setarg(paramPos, 0, id);
  2132.                 }
  2133.                 else
  2134.                 {
  2135.                     #if !defined foreach
  2136.                         #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
  2137.                         #define __SSCANF_FOREACH__
  2138.                     #endif
  2139.                     string[end] = '\0';
  2140.                     num = false;
  2141.                     new
  2142.                         name[MAX_PLAYER_NAME];
  2143.                     id = end - stringPos;
  2144.                     foreach (Player, playerid)
  2145.                     {
  2146.                         GetPlayerName(playerid, name, sizeof (name));
  2147.                         if (!strcmp(name, string[stringPos], true, id))
  2148.                         {
  2149.                             setarg(paramPos, 0, playerid);
  2150.                             num = true;
  2151.                             break;
  2152.                         }
  2153.                     }
  2154.                     if (!num)
  2155.                     {
  2156.                         setarg(paramPos, 0, INVALID_PLAYER_ID);
  2157.                     }
  2158.                     string[end] = ch;
  2159.                     #if defined __SSCANF_FOREACH__
  2160.                         #undef foreach
  2161.                         #undef __SSCANF_FOREACH__
  2162.                     #endif
  2163.                 }
  2164.                 stringPos = end;
  2165.             }
  2166.             case 's', 'z':
  2167.             {
  2168.                 new
  2169.                     i = 0,
  2170.                     ch;
  2171.                 if (format[formatPos])
  2172.                 {
  2173.                     while ((ch = string[stringPos++]) && ch != delim)
  2174.                     {
  2175.                         setarg(paramPos, i++, ch);
  2176.                     }
  2177.                     if (!i)
  2178.                     {
  2179.                         return -1;
  2180.                     }
  2181.                 }
  2182.                 else
  2183.                 {
  2184.                     while ((ch = string[stringPos++]))
  2185.                     {
  2186.                         setarg(paramPos, i++, ch);
  2187.                     }
  2188.                 }
  2189.                 stringPos--;
  2190.                 setarg(paramPos, i, '\0');
  2191.             }
  2192.             default:
  2193.             {
  2194.                 continue;
  2195.             }
  2196.         }
  2197.         while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
  2198.         {
  2199.             stringPos++;
  2200.         }
  2201.         while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
  2202.         {
  2203.             stringPos++;
  2204.         }
  2205.         paramPos++;
  2206.     }
  2207.     do
  2208.     {
  2209.         if ((delim = format[formatPos++]) > ' ')
  2210.         {
  2211.             if (delim == '\'')
  2212.             {
  2213.                 while ((delim = format[formatPos++]) && delim != '\'') {}
  2214.             }
  2215.             else if (delim != 'z')
  2216.             {
  2217.                 return delim;
  2218.             }
  2219.         }
  2220.     }
  2221.     while (delim > ' ');
  2222.     return 0;
  2223. }
Advertisement
Add Comment
Please, Sign In to add comment