Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // .:--------------------------------------------------------------:.
- // .:==============================================================:.
- // { M - TDM v1.2 FOR 0.3C BY Soumi }
- // Credits : *Me for doing this :D
- // *cloudysky for mapping
- // *SA-MP team of course
- // "and for everyone who helped me to make this script"
- // .:==============================================================:.
- // .:--------------------------------------------------------------:.
- //Main Defines :
- #include <a_samp>
- #include <dini>
- #include <dudb>
- #pragma unused ret_memcpy
- #pragma unused strtok
- //Teams Defines :
- #define TEAM_POLICE 1
- #define TEAM_HOBOS 2
- #define TEAM_GROVE 3
- #define TEAM_MAFIA 4
- #define TEAM_POLICE_COLOUR 0x2641FEAA
- #define TEAM_HOBOS_COLOUR 0x800000AA
- #define TEAM_GROVE_COLOUR 0x33AA33AA
- #define TEAM_MAFIA_COLOUR 0xF5DEB3AA
- new gTeam[MAX_PLAYERS];
- //Colors Defines :
- #define COLOR_WHITE 0xFFFFFFFF
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_RED 0xA10000AA
- #define COLOR_YELLOW 0xFFFF00AA
- //ScriptFiles Defines :
- #define SERVER_USER_FILE "M-tdm/Players/%s.ini"
- //Pickups Defines :
- new AmmoNationEntrance;
- new AmmoNationExit;
- new DrugPlace;
- //Menus Defines :
- new Menu:AmmoNationMenu;
- //Texts Defines :
- new Text:ServerNameText;
- //Bools Defines :
- new bool:IsPlayerSpecing[MAX_PLAYERS];
- new bool:IsPlayerTypingKill[MAX_PLAYERS];
- new bool:IsChatOnOrOff[MAX_PLAYERS];
- //Timers Defines :
- new Afk;
- new Jail;
- forward HourTimer(playerid);
- forward AfkTimer(playerid);
- forward CountDown2(playerid);
- forward CountDown1(playerid);
- forward CountDownGo(playerid);
- forward Gmx(playerid);
- forward JailTimer(playerid);
- //Player Stats :
- enum PlayerStats
- {
- AdminLevel,
- TeamRank,
- Cash,
- Level,
- Wanted,
- Logged,
- Mute,
- AfkMute,
- Afking,
- Jailed,
- Frozen,
- };
- new Player[MAX_PLAYERS][PlayerStats];
- //DCMD Define :
- #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
- //Others
- new Float:pHealth;
- new Float:pArmour;
- new Money;
- new Score;
- new WantedLevel;
- #if defined FILTERSCRIPT
- #else
- main()
- {
- print("\n--------------------------------------");
- print(" M-TDM v1.2 ");
- print(" By {Soumi} ");
- print("--------------------------------------\n");
- }
- #endif
- public OnGameModeInit()
- {
- //---------------------------------------------------------------------------------------
- AllowAdminTeleport(1);
- AllowInteriorWeapons(1);
- DisableInteriorEnterExits();
- ShowPlayerMarkers(0);
- SetTeamCount(4);
- //---------------------------------------------------------------------------------------
- //Game mode
- SetGameModeText("M-TDM v1.2");
- //---------------------------------------------------------------------------------------
- //Teams spawn :
- //Police :
- AddPlayerClass(280,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
- AddPlayerClass(281,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
- AddPlayerClass(282,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
- AddPlayerClass(283,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
- AddPlayerClass(285,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
- AddPlayerClass(288,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
- AddPlayerClass(286,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
- AddPlayerClass(192,1305.4125,-786.8438,1084.0078,37.1204,3,0,22,60,30,300);
- //Hobos :
- AddPlayerClass(134,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
- AddPlayerClass(135,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
- AddPlayerClass(137,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
- AddPlayerClass(212,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
- AddPlayerClass(230,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
- AddPlayerClass(239,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
- AddPlayerClass(77,1265.8604,-777.2852,1084.0078,359.8568,6,0,23,60,31,300);
- //Grove :
- AddPlayerClass(105,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
- AddPlayerClass(106,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
- AddPlayerClass(107,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
- AddPlayerClass(269,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
- AddPlayerClass(270,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
- AddPlayerClass(271,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
- AddPlayerClass(298,1267.8646,-810.1602,1084.0078,52.8108,5,0,26,70,30,300);
- //Mafia :
- AddPlayerClass(111,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
- AddPlayerClass(113,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
- AddPlayerClass(124,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
- AddPlayerClass(125,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
- AddPlayerClass(126,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
- AddPlayerClass(127,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
- AddPlayerClass(194,1282.1912,-824.7309,1085.6328,132.7349,1,0,29,250,25,70);
- //---------------------------------------------------------------------------------------
- //Pickups
- //Team Spawn Pickups
- //With a 3D text in each spawn pickup
- CreatePickup(1314,1,1305.4125,-786.8438,1084.0078);
- Create3DTextLabel("Police Spawn",0xFF00FFFF,1305.4125,-786.8438,1084.0078,6.0,0);
- CreatePickup(1314,1,1265.8604,-777.2852,1084.0078);
- Create3DTextLabel("Hobos Spawn",0xFF00FFFF,1265.8604,-777.2852,1084.0078,6.0,0);
- CreatePickup(1314,1,1267.8646,-810.1602,1084.0078);
- Create3DTextLabel("Grove Spawn",0xFF00FFFF,1267.8646,-810.1602,1084.0078,6.0,0);
- CreatePickup(1314,1,1282.1912,-824.7309,1085.6328);
- Create3DTextLabel("Mafia Spawn",0xFF00FFFF,1282.1912,-824.7309,1085.6328,6.0,0);
- //Drugs/Ammunation Pickups
- //with 3D text in each pickup too , it helps the player to
- //know what is that pickup for
- DrugPlace = CreatePickup(1279,1,1248.7208,-806.1448,1084.0078);
- Create3DTextLabel("Drug Point",COLOR_GREEN,1248.7208,-806.1448,1084.0078,6.0,0);
- AmmoNationEntrance = CreatePickup(1318,1,1271.4468,-822.4473,1089.9375);
- Create3DTextLabel("Ammu-Nation",COLOR_YELLOW,1271.4468,-822.4473,1089.9375,6.0,0);
- AmmoNationExit = CreatePickup(1318,1,286.0389,-29.8492,1001.5156);
- //---------------------------------------------------------------------------------------
- //Menus
- //The ammunation menu , you can type /buygun at the ammuation to
- //see this menu that allows you to select the weapon you want to buy
- AmmoNationMenu = CreateMenu("AmmuNation :", 2, 200.0, 100.0, 150.0, 150.0);
- AddMenuItem(AmmoNationMenu, 0, "AK47 $8000");
- AddMenuItem(AmmoNationMenu, 0, "M4 $9000");
- AddMenuItem(AmmoNationMenu, 0, "MP5 $4000");
- AddMenuItem(AmmoNationMenu, 0, "UZI $4000");
- AddMenuItem(AmmoNationMenu, 0, "SPAS12 $7500");
- AddMenuItem(AmmoNationMenu, 0, "Deagle $5000");
- AddMenuItem(AmmoNationMenu, 0, "Sniper $10.000");
- AddMenuItem(AmmoNationMenu, 0, "Rocket launcher $50.000");
- //---------------------------------------------------------------------------------------
- //Timers
- //Note : 3600000 = 1Hour
- SetTimer("HourTimer",3600000,true);
- //Objects By cloudysky
- //Maddog Mansion Objects :
- CreateObject(3015, 1283.4685058594, -783.25317382813, 1088.9375, 0, 0, 0);
- CreateObject(18257, 1268.6064453125, -777.88317871094, 1090.90625, 0, 0, 0);
- CreateObject(1685, 1280.4525146484, -782.69390869141, 1089.6875, 0, 0, 0);
- CreateObject(1685, 1283.951171875, -787.72045898438, 1089.6875, 0, 0, 0);
- CreateObject(1685, 1280.6843261719, -794.84375, 1089.6875, 0, 0, 0);
- CreateObject(1685, 1283.6586914063, -802.11389160156, 1089.6875, 0, 0, 0);
- CreateObject(1685, 1280.6539306641, -810.66033935547, 1089.6875, 0, 0, 0);
- CreateObject(1685, 1283.9046630859, -816.2861328125, 1089.6875, 0, 0, 0);
- CreateObject(944, 1282.9704589844, -832.66619873047, 1089.822265625, 0, 0, 0);
- CreateObject(3013, 1282.4670410156, -833.52166748047, 1089.0847167969, 0, 0, 0);
- CreateObject(18257, 1279.267578125, -836.28381347656, 1084.6328125, 0, 0, 270);
- CreateObject(964, 1270.8817138672, -830.07318115234, 1084.6328125, 0, 0, 0);
- CreateObject(964, 1270.9008789063, -830.06182861328, 1085.5985107422, 0, 0, 0);
- CreateObject(964, 1270.8041992188, -828.09484863281, 1084.6328125, 0, 0, 0);
- CreateObject(964, 1270.8045654297, -828.09490966797, 1085.5985107422, 0, 0, 0);
- CreateObject(964, 1270.9875488281, -830.00482177734, 1086.5642089844, 0, 0, 0);
- CreateObject(964, 1270.9973144531, -828.74108886719, 1086.5642089844, 0, 0, 0);
- CreateObject(964, 1270.9912109375, -827.59020996094, 1086.5642089844, 0, 0, 0);
- CreateObject(2974, 1288.6882324219, -832.89422607422, 1084.6328125, 0, 0, 0);
- CreateObject(2912, 1262.5721435547, -831.54174804688, 1083.0148925781, 0, 0, 0);
- CreateObject(2912, 1262.5548095703, -831.54541015625, 1083.71484375, 0, 0, 0);
- CreateObject(930, 1262.7761230469, -832.22424316406, 1083.4907226563, 0, 0, 0);
- CreateObject(1685, 1263.0493164063, -835.00860595703, 1083.7648925781, 0, 0, 0);
- CreateObject(1685, 1263.0401611328, -838.27423095703, 1083.7578125, 0, 0, 0);
- CreateObject(1685, 1281.0793457031, -822.1123046875, 1089.6875, 0, 0, 0);
- CreateObject(2991, 1254.3442382813, -828.16259765625, 1083.6354980469, 0, 0, 0);
- CreateObject(2991, 1235.5437011719, -833.06286621094, 1083.6354980469, 0, 0, 90);
- CreateObject(2975, 1239.3370361328, -826.60205078125, 1082.15625, 0, 0, 0);
- CreateObject(2975, 1249.0526123047, -831.75555419922, 1083.0148925781, 0, 0, 0);
- CreateObject(2975, 1251.1234130859, -835.57684326172, 1083.0078125, 0, 0, 0);
- CreateObject(2975, 1248.3004150391, -838.54870605469, 1083.0078125, 0, 0, 0);
- CreateObject(925, 1229.7275390625, -836.10113525391, 1084.0697021484, 0, 0, 0);
- CreateObject(925, 1235.4520263672, -838.2861328125, 1084.0697021484, 0, 0, 0);
- CreateObject(1431, 1227.451171875, -830.45275878906, 1083.5554199219, 0, 0, 0);
- CreateObject(1431, 1227.4953613281, -826.00225830078, 1083.5554199219, 0, 0, 0);
- CreateObject(1685, 1229.1007080078, -815.25439453125, 1083.7578125, 0, 0, 0);
- CreateObject(1685, 1229.1105957031, -817.37756347656, 1083.7578125, 0, 0, 0);
- CreateObject(930, 1240.0802001953, -811.35986328125, 1083.4836425781, 0, 0, 90);
- CreateObject(930, 1240.2679443359, -813.39324951172, 1083.4836425781, 0, 0, 0);
- CreateObject(1431, 1232.015625, -812.86987304688, 1083.5554199219, 0, 0, 90);
- CreateObject(1431, 1228.6192626953, -808.72845458984, 1083.5554199219, 0, 0, 0);
- CreateObject(2567, 1249.3779296875, -811.3125, 1084.9354248047, 0, 0, 0);
- CreateObject(942, 1271.5297851563, -798.40734863281, 1085.4510498047, 0, 0, 0);
- CreateObject(935, 1260.9449462891, -802.34149169922, 1083.5710449219, 0, 0, 0);
- CreateObject(935, 1261.9300537109, -802.35845947266, 1083.5710449219, 0, 0, 0);
- CreateObject(935, 1262.9259033203, -802.33630371094, 1083.5710449219, 0, 0, 0);
- CreateObject(935, 1263.9537353516, -802.25360107422, 1083.5710449219, 0, 0, 0);
- CreateObject(1431, 1258.5804443359, -804.14392089844, 1083.5554199219, 0, 0, 90);
- CreateObject(1431, 1281.3435058594, -800.90148925781, 1083.5554199219, 0, 0, 0);
- CreateObject(1431, 1283.4188232422, -800.81677246094, 1083.5554199219, 0, 0, 0);
- CreateObject(1685, 1284.7239990234, -798.10766601563, 1083.7578125, 0, 0, 0);
- CreateObject(1685, 1283.6350097656, -792.51336669922, 1083.7578125, 0, 0, 0);
- CreateObject(1685, 1267.0187988281, -793.64581298828, 1083.7578125, 0, 0, 0);
- CreateObject(925, 1274.7543945313, -786.8017578125, 1084.0767822266, 0, 0, 0);
- CreateObject(944, 1270.1082763672, -789.45581054688, 1083.892578125, 0, 0, 90);
- CreateObject(935, 1275.0075683594, -790.5966796875, 1083.5710449219, 0, 0, 0);
- CreateObject(935, 1274.9952392578, -789.80413818359, 1083.5710449219, 0, 0, 0);
- CreateObject(935, 1253.4654541016, -791.03802490234, 1083.5710449219, 0, 0, 0);
- CreateObject(935, 1254.0161132813, -790.20257568359, 1083.5710449219, 0, 0, 0);
- CreateObject(1337, 1254.1267089844, -789.33032226563, 1083.6569824219, 0, 0, 0);
- CreateObject(1299, 1250.0831298828, -787.16754150391, 1083.4636230469, 0, 0, 0);
- CreateObject(1299, 1242.6888427734, -780.49841308594, 1083.470703125, 0, 0, 0);
- CreateObject(1299, 1240.1783447266, -763.10949707031, 1083.4650878906, 0, 0, 0);
- CreateObject(12957, 1235.8734130859, -763.90338134766, 1083.8853759766, 0, 0, 245);
- CreateObject(1227, 1250.9050292969, -772.07415771484, 1083.8594970703, 0, 0, 0);
- CreateObject(1224, 1248.5551757813, -767.53466796875, 1083.6291503906, 0, 0, 0);
- CreateObject(1224, 1261.8525390625, -779.00042724609, 1083.6226806641, 0, 0, 0);
- CreateObject(1224, 1266.3231201172, -778.13940429688, 1083.6226806641, 0, 0, 0);
- CreateObject(3594, 1289.2827148438, -773.94354248047, 1083.6390380859, 0, 0, 0);
- CreateObject(1440, 1283.6583251953, -783.63342285156, 1083.5269775391, 0, 0, 0);
- CreateObject(2744, 1284.6867675781, -782.10870361328, 1085.0920410156, 0, 0, 270);
- CreateObject(932, 1299.5815429688, -782.56298828125, 1083.0078125, 0, 0, 0);
- CreateObject(932, 1298.8043212891, -782.55981445313, 1083.0078125, 0, 0, 0);
- CreateObject(910, 1299.0833740234, -780.38854980469, 1084.2769775391, 0, 0, 90);
- //Wooow , you should try the GameMode and check those awsome Objetcs
- return 1;
- }
- public OnGameModeExit()
- {
- //it is showen when you exit the Gamemode
- print("You have turned off M-TDM Game Mode By .:'{Soumi}':.");
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- //---------------------------------------------------------------------------------------
- //a sound will be playing while the player is choosing a class
- PlayerPlaySound(playerid, 1062, 0.0, 0.0, 2.0);
- ApplyAnimation(playerid,"PED","WALK_gang1",4.1,1,1,1,1,1); //This will apply an animation on the player while choosing the class
- SetPlayerTeamFromClass(playerid,classid); // This sets the palyer team from class
- //---------------------------------------------------------------------------------------
- //This is what the player Position when he's selecting a class
- SetPlayerPos(playerid,1286.1554,-774.1998,1091.9063);
- SetPlayerFacingAngle(playerid,0.0);
- SetPlayerCameraPos(playerid,1282.0900,-772.8223,1091.9063);
- SetPlayerCameraLookAt(playerid,1286.1554,-774.1998,1091.9063);
- SetPlayerInterior(playerid,5);
- //---------------------------------------------------------------------------------------
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- //---------------------------------------------------------------------------------------
- GameTextForPlayer(playerid,"~w~Modern Team Dm !",3000,4);
- SendClientMessage(playerid,COLOR_WHITE,"Welcome to {88AA88}Modern{FFFFFF}-TDM");
- //---------------------------------------------------------------------------------------
- //This sends a message to all the palyers when someone join the server
- new str[128], pName[24];
- GetPlayerName(playerid, pName, 24);
- format(str, 128, "(Connecting) %s has Joined Modern TDM Server.", pName);
- SendClientMessageToAll(COLOR_WHITE,str);
- //---------------------------------------------------------------------------------------
- Player[playerid][Afking] = false; //If the player left when he's afk , he won't be anymore
- Player[playerid][AfkMute] = false; //and for the AfkMute and frozen and specing all off..
- Player[playerid][Frozen] = false;
- IsPlayerSpecing[playerid] = false;
- Player[playerid][Logged] = 0;
- //The Register/Login system , added in the version 1.3.
- new playersfile[256];
- format(playersfile, sizeof(playersfile), SERVER_USER_FILE, pName);
- if (!dini_Exists(playersfile))
- {
- ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Welcome to Modern TDM" , "you're not registered , type your Password below.", "Register", "Exit");
- }
- if(fexist(playersfile))
- {
- ShowPlayerDialog(playerid, 3, DIALOG_STYLE_INPUT, "Welcome Back to Modern TDM", "Type your Password below to login", "Login", "Exit");
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- //---------------------------------------------------------------------------------------
- //also this sends a message to all the players when someone exit the server
- new str[128], pName[24];
- GetPlayerName(playerid, pName, 24);
- format(str, 128, "%s has left Modern TDM Server.", pName);
- SendClientMessageToAll(COLOR_WHITE,str);
- //---------------------------------------------------------------------------------------
- Player[playerid][Afking] = false;
- Player[playerid][AfkMute] = false;
- Player[playerid][Frozen] = false;
- IsPlayerSpecing[playerid] = false;
- new playersfile[256];
- format(playersfile, sizeof(playersfile), SERVER_USER_FILE, pName);
- if(Player[playerid][Logged] == 1)
- {
- dini_IntSet(playersfile, "Level", GetPlayerScore(playerid));
- dini_IntSet(playersfile, "Cash", GetPlayerMoney(playerid));
- dini_IntSet(playersfile, "AdminLevel",Player[playerid][AdminLevel]);
- dini_IntSet(playersfile, "TeamRank",Player[playerid][TeamRank]);
- dini_IntSet(playersfile, "Muted",Player[playerid][Mute]);
- dini_IntSet(playersfile, "Jailed",Player[playerid][Jailed]);
- dini_IntSet(playersfile, "Wanted",GetPlayerWantedLevel(playerid));
- }
- Player[playerid][Logged] = 0;
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- //---------------------------------------------------------------------------------------
- //when the player spawn , he'll see this text at the bottom of the screen
- //near the mini-map
- ServerNameText = TextDrawCreate(10.0, 415.0,"~r~Modern Team Deathmatch");
- TextDrawBoxColor(ServerNameText,0x222222BB);
- TextDrawLetterSize(ServerNameText,0.3,1.0);
- TextDrawTextSize(ServerNameText,400.0,40.0);
- TextDrawFont(ServerNameText, 2);
- TextDrawShowForPlayer(playerid,ServerNameText);
- //---------------------------------------------------------------------------------------
- PlayerPlaySound(playerid,1063, 0.0, 0.0, 2.0);
- SetPlayerToTeamColour(playerid);
- SetPlayerInterior(playerid,5);
- SetPlayerHealth(playerid,100);
- SetPlayerArmour(playerid,100);
- IsPlayerTypingKill[playerid] = false;
- //---------------------------------------------------------------------------------------
- //Player will have the Maximum of all the weapons that are used in the gamemode
- SetPlayerSkillLevel(playerid,22,9999);
- SetPlayerSkillLevel(playerid,23,9999);
- SetPlayerSkillLevel(playerid,24,9999);
- SetPlayerSkillLevel(playerid,25,9999);
- SetPlayerSkillLevel(playerid,26,9999);
- SetPlayerSkillLevel(playerid,27,9999);
- SetPlayerSkillLevel(playerid,28,9999);
- SetPlayerSkillLevel(playerid,29,9999);
- SetPlayerSkillLevel(playerid,30,9999);
- SetPlayerSkillLevel(playerid,31,9999);
- SetPlayerSkillLevel(playerid,32,9999);
- SetPlayerSkillLevel(playerid,34,9999);
- //---------------------------------------------------------------------------------------
- if(Player[playerid][Jailed] == 1)
- {
- SendClientMessage(playerid,COLOR_RED,"Back To Jail !!");
- SetPlayerPos(playerid, 264.6288,77.5742,1001.0391);
- SetPlayerInterior(playerid, 6);
- ResetPlayerWeapons(playerid);
- Jail = SetTimer("JailTimer",300000,false);
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- //---------------------------------------------------------------------------------------
- //When player dies , He'll loose $500 and he'll respawn of course
- //but the one who killed him will get $1000 and + wanted level
- //also he'll get +1 score and death message will be send to the otehr players
- WantedLevel = GetPlayerWantedLevel(playerid);
- Money = GetPlayerMoney(playerid),
- GivePlayerMoney(killerid, 1000);
- SetPlayerWantedLevel(killerid, WantedLevel + 1);
- ResetPlayerMoney(playerid);
- GivePlayerMoney(playerid, Money -500),
- //---------------------------------------------------------------------------------------
- SendDeathMessage(killerid, playerid, reason);
- SendClientMessage(playerid, 0xFF6347AA ," You Died and Lost $500 !");
- //---------------------------------------------------------------------------------------
- if(IsPlayerConnected(killerid))
- {
- SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
- }
- //---------------------------------------------------------------------------------------
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[30], params[30];
- sscanf(cmdtext, "ss", cmd, params);
- //I Made these cmds when i didn't know how to use params , etc..
- //But all the new ones are in DCMD !!
- //---------------------------------------------------------------------------------------
- if (strcmp("/help", cmdtext, true, 10) == 0)
- {
- SendClientMessage(playerid,COLOR_YELLOW, "***---Modern TDM Help :---***");
- SendClientMessage(playerid,COLOR_WHITE, "Forums : http://www.m-tdm.com/ is our current forums");
- SendClientMessage(playerid,COLOR_WHITE, "Commands : Type /cmds For a list of the Server Commands");
- SendClientMessage(playerid,COLOR_WHITE, "Rules : Type /rules for a list of M-TDM server rules");
- SendClientMessage(playerid,COLOR_WHITE, "Money : When you kill a player you will earn $1000 , but when you die you'll loose $500 ");
- SendClientMessage(playerid,COLOR_WHITE, "Other : /weaponhelp *** /drughelp ");
- SendClientMessage(playerid,COLOR_WHITE, "That's all , Have fun !!");
- return 1;
- }
- if (strcmp("/rules", cmdtext, true, 10) == 0)
- {
- SendClientMessage(playerid,COLOR_YELLOW, "***---Modern TDM Rules---***");
- 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");
- 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");
- SendClientMessage(playerid,COLOR_WHITE, "Spawn Killing : You are not allowed to kill other players when they spawn");
- SendClientMessage(playerid,COLOR_WHITE, "Bug Abuse : You Don't have the right abuse any bug ");
- SendClientMessage(playerid,COLOR_WHITE, "Adversing : You can not advertise other servers , sending any IP will get you banned");
- SendClientMessage(playerid,COLOR_WHITE, "Team Work : Work as a Team and Never fight with Players that are in your Team." );
- SendClientMessage(playerid,COLOR_WHITE, "Other : /weaponhelp *** /drughelp ");
- SendClientMessage(playerid,COLOR_WHITE, "That's all , Have fun !!");
- return 1;
- }
- if (strcmp("/cmds", cmdtext, true, 10) == 0)
- {
- SendClientMessage(playerid,COLOR_YELLOW, "***---Modern TDM Commands---***");
- SendClientMessage(playerid,COLOR_WHITE, "General Cmds : /stats --- /report [Reason] --- /kill --- /enter --- /exit --- @Text (Team Chat)");
- SendClientMessage(playerid,COLOR_WHITE, "/pay --- /savestats --- /giverank Afk : /goafk --- /back ");
- SendClientMessage(playerid,COLOR_WHITE, "Other : /weaponhelp *** /drughelp *** /help *** /rules ");
- SendClientMessage(playerid,COLOR_WHITE, "That's all , Have fun !!");
- return 1;
- }
- ///enter and /exit allows you to TP from a place to another (from DM area to ammunation)
- if (strcmp("/enter", cmdtext, true, 10) == 0)
- {
- if(IsPlayerInRangeOfPoint(playerid, 3, 1271.4468,-822.4473,1089.9375) )
- {
- SetPlayerInterior(playerid, 1);
- SetPlayerPos(playerid, 286.0595,-32.6137,1001.5156);
- GameTextForPlayer(playerid, "~w~The Ammu-Nation", 5000, 1);
- }
- else
- {
- }
- return 1;
- }
- if (strcmp("/exit", cmdtext, true, 10) == 0)
- {
- if(IsPlayerInRangeOfPoint(playerid, 3, 286.0389,-29.8492,1001.5156) )
- {
- SetPlayerInterior(playerid, 5);
- SetPlayerPos(playerid, 1273.1444,-822.4879,1089.9375);
- }
- else
- {
- }
- return 1;
- }
- //This cmd will kill the player by setting his health to 0 and he'll be fined +$500
- if (strcmp("/kill", cmdtext, true, 10) == 0)
- {
- if(IsPlayerTypingKill[playerid] == false)
- {
- SetPlayerHealth(playerid, 0);
- SendClientMessage(playerid, COLOR_RED, "You have been fined +$500 because You committed a suicide!");
- GivePlayerMoney(playerid, -500);
- IsPlayerTypingKill[playerid] = true;
- }
- else if(IsPlayerTypingKill[playerid] == true) return SendClientMessage(playerid, COLOR_RED, "You Can not do this at the moment!");
- return 1;
- }
- //the stats command only shows some information about the player
- if (strcmp("/stats", cmdtext, true, 10) == 0)
- {
- new str[128], pName[24];
- GetPlayerName(playerid, pName, 24);
- Money = GetPlayerMoney(playerid),
- GetPlayerHealth(playerid,pHealth);
- GetPlayerArmour(playerid,pArmour);
- Score =GetPlayerScore(playerid);
- Player[playerid][Wanted] = GetPlayerWantedLevel(playerid),
- format(str, 128, "%s Stats :", pName);
- SendClientMessage(playerid,COLOR_WHITE,str);
- format(str,128, "Money : $%i --- Health : %0.f ",Money,pHealth);
- SendClientMessage(playerid,COLOR_WHITE,str);
- format(str,128, "Armour : %0.f --- Score : %i --- Wanted : %i",pArmour,Score,Player[playerid][Wanted]);
- SendClientMessage(playerid,COLOR_WHITE,str);
- format(str,128, "AdminLevel : %i --- Team rank : %i",Player[playerid][AdminLevel],Player[playerid][TeamRank]);
- SendClientMessage(playerid,COLOR_WHITE,str);
- return 1;
- }
- if (strcmp("/weaponhelp", cmdtext, true, 10) == 0)
- {
- SendClientMessage(playerid,COLOR_YELLOW, "***---Modern TDM Weapon Help---***");
- SendClientMessage(playerid,COLOR_WHITE, "You always get weapons when you spawn. But you can buy more weapons with more bullets");
- SendClientMessage(playerid,COLOR_WHITE, "You can buy weapons from AmmuNations :");
- SendClientMessage(playerid,COLOR_WHITE, "Type /buygun to purchase a weapon");
- SendClientMessage(playerid,COLOR_WHITE, "Other : /cmds *** /racehelp *** /drughelp *** /rules *** /help ");
- SendClientMessage(playerid,COLOR_WHITE, "That's all , Have fun !!");
- return 1;
- }
- //This command can be used in ammunation only , it shows the ammunation menu that allows
- //the player to select a weapon and buy it
- if (strcmp("/buygun", cmdtext, true, 10) == 0)
- {
- if(GetPlayerInterior(playerid) == 1)
- {
- TogglePlayerControllable(playerid, 0);
- ShowMenuForPlayer(AmmoNationMenu,playerid);
- }
- else
- {
- SendClientMessage(playerid, COLOR_YELLOW,"You are not at the Ammu Nation ! ");
- }
- return 1;
- }
- if (strcmp("/drughelp", cmdtext, true, 10) == 0)
- {
- SendClientMessage(playerid,COLOR_YELLOW, "***---Modern TDM Drug Help---***");
- SendClientMessage(playerid,COLOR_WHITE, "You can buy drugs to get more armor ");
- SendClientMessage(playerid,COLOR_WHITE, "Type /buydrug to get 2g of drugs that will give you +20 Armour/Health ");
- SendClientMessage(playerid,COLOR_WHITE, "Meth will give you +20 Health and Armour and it costs $500 ");
- SendClientMessage(playerid,COLOR_WHITE, "Crack will give you +20 Armour and it costs $350 ");
- SendClientMessage(playerid,COLOR_WHITE, "Pot will give you +20 Health and it costs $200 ");
- SendClientMessage(playerid,COLOR_WHITE, "Other : /weaponhelp *** /cmds *** /rules *** /help ");
- SendClientMessage(playerid,COLOR_WHITE, "That's all , Have fun !!");
- return 1;
- }
- //also this command can be used only near the drug point , it shows the
- //dialog where can the player select a tye of drugs and buy it
- if (strcmp("/buydrug", cmdtext, true, 10) == 0)
- {
- if(IsPlayerInRangeOfPoint(playerid, 3, 1248.7208,-806.1448,1084.0078) )
- {
- TogglePlayerControllable(playerid, 0);
- ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Choose a Drug type :", "Pot\nCrack\nMeth", "Buy", "Cancel");
- }
- else
- {
- SendClientMessage(playerid,COLOR_GREEN,"You are not at the Drug point right now !");
- }
- return 1;
- }
- //---------------------------------------------------------------------------------------
- //Now to the afk system !!
- //This commands sets you to afk mode , you'll be TPed out of the DM area
- //and you won't be able to move or to chat..
- if (strcmp("/goafk", cmdtext, true, 10) == 0)
- {
- if(Player[playerid][Afking] == 0)
- {
- TogglePlayerControllable(playerid, 0);
- Player[playerid][Afking] = 1;
- new str[128], pName[24];
- GetPlayerName(playerid, pName, 24);
- format(str,sizeof str,"%s is now AFK (Away from Keyboard)",pName);
- SendClientMessageToAll(COLOR_RED,str);
- GameTextForPlayer(playerid,"~r~ You are Now Afk",4000,3);
- SetPlayerInterior(playerid,0);
- SetPlayerPos(playerid,1544.2355,-1352.9237,329.4750);//Sets the player pos outside the DM area
- Player[playerid][AfkMute] = true;
- SetPlayerColor(playerid,0x000000AA);//It will set the player to black color
- Afk = SetTimer("AfkTimer",900000,false);
- }
- else if(Player[playerid][Afking] == 1)
- {
- SendClientMessage(playerid,COLOR_RED,"You are already Afk , please use /back");
- }
- return 1;
- }
- //if you were afk , this cmd will make spawn , and you'll be
- //able to chat with other players and move again !!
- if (strcmp("/back", cmdtext, true, 10) == 0)
- {
- if(Player[playerid][Afking] == 1)
- {
- TogglePlayerControllable(playerid, 1);
- Player[playerid][Afking] = 0;
- new str[128], pName[24];
- GetPlayerName(playerid, pName, 24);
- format(str,sizeof str,"%s is no longer Afk (Away from Keyboard)",pName);
- SendClientMessageToAll(COLOR_RED,str);//A Message will be sent to all players
- GameTextForPlayer(playerid,"~r~ You are No Longer Afk",4000,3);
- SetPlayerInterior(playerid,5);
- SpawnPlayer(playerid);//Player will re-spawn
- Player[playerid][AfkMute] = false;
- SetPlayerToTeamColour(playerid);//Sets the player to his team color again
- KillTimer(Afk);
- }
- else if(Player[playerid][Afking] == 0)
- {
- SendClientMessage(playerid,COLOR_RED,"You are not Afk , So you can't use this cmd , please type /goafk to be afk ");
- }
- return 1;
- }
- //---------------------------------------------------------------------------------------
- if(!strcmp(cmd, "/pay"))
- {
- {
- new targetid, cash, string[128];
- if(sscanf(params, "ui", targetid,cash)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /pay [playerid/partofname] [cash]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID !");
- if (playerid == targetid) return SendClientMessage(playerid, COLOR_WHITE, "You can not give money to yourself.");
- Money = GetPlayerMoney(playerid);
- if(Money < cash) if (playerid == targetid) return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much");
- else
- {
- PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
- new pTargetName[24], pName[24];
- GetPlayerName(targetid,pTargetName,24);
- GetPlayerName(playerid,pName,24);
- GivePlayerMoney(targetid, cash);
- GivePlayerMoney(playerid, (0 - cash));
- format(string, sizeof(string), "You received %i from %s", cash,pName);
- SendClientMessage(targetid, 0xFFC0CBFF,string);
- format(string, sizeof(string), "You transfered %i to %s", cash,pTargetName);
- SendClientMessage(playerid, 0xFFC0CBFF,string);
- }
- }
- return 1;
- }
- if(!strcmp(cmd, "/savestats"))
- {
- {
- new playersfile[256], pName[24];
- GetPlayerName(playerid, pName, 24);
- format(playersfile, sizeof(playersfile), SERVER_USER_FILE, pName);
- if(Player[playerid][Logged] == 1)
- {
- dini_IntSet(playersfile, "Level", GetPlayerScore(playerid));
- dini_IntSet(playersfile, "Cash", GetPlayerMoney(playerid));
- dini_IntSet(playersfile, "AdminLevel",Player[playerid][AdminLevel]);
- dini_IntSet(playersfile, "TeamRank",Player[playerid][TeamRank]);
- dini_IntSet(playersfile, "Muted",Player[playerid][Mute]);
- dini_IntSet(playersfile, "Jailed",Player[playerid][Jailed]);
- dini_IntSet(playersfile, "Wanted",GetPlayerWantedLevel(playerid));
- SendClientMessage(playerid, 0xFFC0CBFF,"Stats Saved");
- Player[playerid][Logged] = 0;
- }
- }
- return 1;
- }
- if(!strcmp(cmd, "/giverank"))
- {
- {
- new targetid, rank, string[128];
- if(Player[playerid][TeamRank] < 5) return SendClientMessage(playerid, COLOR_WHITE, "You are not able to use this Command (only rank 6)");
- if(sscanf(params, "ui", targetid,rank)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /givernak [playerid/partofname] [rank]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID !");
- if (playerid == targetid) return SendClientMessage(playerid, COLOR_WHITE, "You can not give money to yourself.");
- else
- {
- new pTargetName[24], pName[24];
- GetPlayerName(targetid,pTargetName,24);
- GetPlayerName(playerid,pName,24);
- format(string, sizeof(string), "Leader/Co-Leader %s has made you Rank %i ", pName,rank);
- SendClientMessage(targetid, 0xFFC0CBFF,string);
- format(string, sizeof(string), "You Made %s rank %i",pTargetName, rank);
- SendClientMessage(playerid, 0xFFC0CBFF,string);
- }
- }
- return 1;
- }
- if(!strcmp(cmd, "/report"))
- {
- {
- new string[128], reason[64];
- if(sscanf(params, "z", reason)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /report [reason]");
- else
- {
- new pName[24];
- GetPlayerName(playerid, pName, 128);
- for (new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(Player[i][AdminLevel] >= 1)
- {
- format(string, sizeof(string), "Report : %s , Reason : %s", pName, reason);
- SendClientMessage(i, COLOR_RED, string);
- }
- }
- }
- }
- }
- return 1;
- }
- //---------------------------------------------------------------------------------------
- if (strcmp("/cc", cmdtext, true, 10) == 0)
- {
- if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- for(new i=0; i<49; i++)
- {
- SendClientMessageToAll(0x33FF33AA, " "); return 1;
- }
- return 1;
- }
- if (strcmp("/countdown", cmdtext, true, 10) == 0)
- {
- if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- else
- {
- GameTextForAll("~w~3",3000, 4);
- SetTimer("CountDown2",3500,false);
- }
- return 1;
- }
- if(!strcmp(cmd, "/payday"))
- {
- {
- if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new money;
- if(sscanf(params, "i", money)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /payday [money]");
- else
- {
- for(new i; i< MAX_PLAYERS; i++)
- {
- GivePlayerMoney(i,money);
- SendClientMessage(i,COLOR_RED,"an Admin has sent an ammount of money to all the Players");
- }
- }
- }
- return 1;
- }
- //Kick cmd :
- if(!strcmp(cmd, "/kick"))
- {
- {
- if(Player[playerid][AdminLevel] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid, reason[64], string[128];
- if(sscanf(params, "uz", targetid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /kick [playerid/partofname] [reason]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- if(Player[targetid][AdminLevel] > Player[playerid][AdminLevel])
- {
- new pName[24];
- GetPlayerName(playerid,pName,24);
- format(string, sizeof(string), "%s have been Kicked for attempting to kick a Higher level admin!", pName);
- SendClientMessageToAll(COLOR_RED,string);
- Kick(playerid);
- }
- else
- {
- new pTargetName[24], pName[24];
- GetPlayerName(playerid,pName,24);
- GetPlayerName(targetid,pTargetName,24);
- format(string, sizeof(string), "%s have been Kicked By Admin %s ! Reason: %s", pTargetName, pName, reason);
- SendClientMessageToAll(COLOR_RED,string);
- Kick(targetid);
- }
- }
- return 1;
- }
- if(!strcmp(cmd, "/getstats"))
- {
- {
- if(Player[playerid][AdminLevel] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid;
- if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /getstats [playerid/partofname]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- else
- {
- new str[128], pName[24];
- GetPlayerName(targetid, pName, 24);
- Money = GetPlayerMoney(targetid),
- GetPlayerHealth(targetid,pHealth);
- GetPlayerArmour(targetid,pArmour);
- Score =GetPlayerScore(targetid);
- Player[targetid][Wanted] = GetPlayerWantedLevel(targetid),
- format(str, 128, "%s Stats :", pName);
- SendClientMessage(playerid,COLOR_WHITE,str);
- format(str,128, "Money : $%i --- Health : %0.f ",Money,pHealth);
- SendClientMessage(playerid,COLOR_WHITE,str);
- format(str,128, "Armour : %0.f --- Score : %i --- Wanted : %i",pArmour,Score,Player[targetid][Wanted]);
- SendClientMessage(playerid,COLOR_WHITE,str);
- format(str,128, "AdminLevel : %i --- Team rank : %i",Player[targetid][AdminLevel],Player[targetid][TeamRank]);
- SendClientMessage(playerid,COLOR_WHITE,str);
- }
- }
- return 1;
- }
- //Ban cmd
- if(!strcmp(cmd, "/ban"))
- {
- {
- if(Player[playerid][AdminLevel] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid, reason[64], string[128];
- if(sscanf(params, "uz", targetid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /ban [playerid/partofname] [reason]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- if(Player[targetid][AdminLevel] > Player[playerid][AdminLevel])
- {
- new pName[24];
- GetPlayerName(playerid,pName,24);
- format(string, sizeof(string), "%s have been Banned for attempting to ban a Higher level admin!", pName);
- SendClientMessageToAll(COLOR_RED,string);
- Ban(playerid);
- }
- {
- new pTargetName[24], pName[24];
- GetPlayerName(playerid,pName,24);
- GetPlayerName(targetid,pTargetName,24);
- format(string, sizeof(string), "%s have been Banned By Admin %s ! Reason: %s", pTargetName, pName, reason);
- SendClientMessageToAll(COLOR_RED,string);
- Ban(targetid);
- }
- }
- return 1;
- }
- //Mute cmd
- if(!strcmp(cmd, "/mute"))
- {
- {
- if(Player[playerid][AdminLevel] < 2) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid, reason[64], string[128];
- if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /mute [playerid/partofname] [reason]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- if(Player[targetid][Mute] == 1)
- {
- SendClientMessage(playerid, COLOR_WHITE, "Player is Already Muted");
- }
- else
- {
- new pTargetName[24], pName[24];
- GetPlayerName(playerid,pName,24);
- GetPlayerName(targetid,pTargetName,24);
- format(string, sizeof(string), "%s have been Muted By Admin %s ! Reason: %s",pTargetName, pName, reason);
- SendClientMessageToAll(COLOR_RED,string);
- Player[targetid][Mute] = 1;
- }
- }
- return 1;
- }
- //Unmute cmd
- if(!strcmp(cmd, "/unmute"))
- {
- {
- if(Player[playerid][AdminLevel] < 2) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid, string[128];
- if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /unmute [playerid/partofname]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- if(Player[targetid][Mute] == 0)
- {
- SendClientMessage(playerid, COLOR_WHITE, "Player isn't Muted");
- }
- else
- {
- new pTargetName[24], pName[24];
- GetPlayerName(playerid,pName,24);
- GetPlayerName(targetid,pTargetName,24);
- format(string, sizeof(string), "%s have been unmuted By Admin %s ! ",pTargetName, pName);
- SendClientMessageToAll(COLOR_RED,string);
- Player[targetid][Mute] = 0;
- }
- }
- return 1;
- }
- //Freeze cmd
- if(!strcmp(cmd, "/freeze"))
- {
- {
- if(Player[playerid][AdminLevel] < 2) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid, string[128];
- if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /freeze [playerid/partofname]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- if(Player[targetid][Frozen] == 1)
- {
- SendClientMessage(playerid, COLOR_WHITE, "Player is already Frozen");
- }
- else
- {
- new pTargetName[24], pName[24];
- GetPlayerName(playerid,pName,24);
- GetPlayerName(targetid,pTargetName,24);
- format(string, sizeof(string), "%s have been Freezed By Admin %s !",pTargetName, pName);
- SendClientMessageToAll(COLOR_RED,string);
- Player[targetid][Frozen] = 1;
- TogglePlayerControllable(targetid, 0);
- }
- }
- return 1;
- }
- //Unfreeze cmd
- if(!strcmp(cmd, "/unfreeze"))
- {
- {
- if(Player[playerid][AdminLevel] < 2) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid, string[128];
- if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /unfreeze [playerid/partofname]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- if(Player[targetid][Frozen] == 0)
- {
- SendClientMessage(playerid, COLOR_WHITE, "Player isn't Frozen");
- }
- else
- {
- new pTargetName[24], pName[24];
- GetPlayerName(playerid,pName,24);
- GetPlayerName(targetid,pTargetName,24);
- format(string, sizeof(string), "%s have been unfreezed By Admin %s !",pTargetName, pName);
- SendClientMessageToAll(COLOR_RED,string);
- Player[targetid][Frozen] = 0;
- TogglePlayerControllable(targetid, 1);
- }
- }
- return 1;
- }
- //Jail cmd
- if(!strcmp(cmd, "/jail"))
- {
- {
- if(Player[playerid][AdminLevel] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid, reason[64], string[128];
- if(sscanf(params, "uz", targetid,reason)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /jail [playerid/partofname] [reason]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- if(Player[targetid][Jailed] == 1)
- {
- SendClientMessage(playerid, COLOR_WHITE, "Player is already inside the jail");
- }
- else
- {
- new pName[24], pTargetName[24];
- GetPlayerName(targetid,pTargetName,128);
- GetPlayerName(playerid,pName,128);
- format(string, sizeof(string), "%s have been Jailed By Admin %s ! Reason : %s ",pTargetName, pName, reason);
- SendClientMessageToAll(COLOR_RED,string);
- Player[targetid][Jailed] = 1;
- SetPlayerPos(targetid, 264.6288,77.5742,1001.0391);
- SetPlayerInterior(targetid, 6);
- ResetPlayerWeapons(targetid);
- Jail = SetTimer("JailTimer",300000,false);
- }
- }
- return 1;
- }
- //Unjail cmd
- if(!strcmp(cmd, "/unjail"))
- {
- {
- if(Player[playerid][AdminLevel] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid, string[128];
- if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /unjail [playerid/partofname]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- if(Player[targetid][Jailed] == 0)
- {
- SendClientMessage(playerid, COLOR_WHITE, "Player isn't inside the jail");
- }
- else
- {
- new pName[24], pTargetName[24];
- GetPlayerName(targetid,pTargetName,128);
- GetPlayerName(playerid,pName,128);
- format(string, sizeof(string), "%s have been unjailed By Admin %s !",pTargetName, pName);
- SendClientMessageToAll(COLOR_RED,string);
- Player[targetid][Jailed] = 0;
- SpawnPlayer(targetid);
- SetPlayerInterior(targetid, 5);
- KillTimer(Jail);
- }
- }
- return 1;
- }
- //Spec cmd
- if(!strcmp(cmd, "/spec"))
- {
- {
- if(Player[playerid][AdminLevel] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid;
- if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /spec [playerid/partofname]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- if(IsPlayerSpecing[playerid] == true)
- {
- SendClientMessage(playerid, COLOR_WHITE, "You are already specing someone , please type /stopspec");
- }
- else
- {
- SendClientMessage(playerid, COLOR_RED,"You Are Now specing , type /stopspec to stop specing this player ! ");
- IsPlayerSpecing[playerid] = true;
- TogglePlayerSpectating(playerid, 1);
- PlayerSpectatePlayer(playerid, targetid);
- SetPlayerInterior(playerid,GetPlayerInterior(targetid));
- }
- }
- return 1;
- }
- //specoff cmd
- if(!strcmp(cmd, "/stopspec"))
- {
- {
- if(Player[playerid][AdminLevel] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- if(IsPlayerSpecing[playerid] == false)
- {
- SendClientMessage(playerid, COLOR_WHITE, "You are not specing anyone right now ! ");
- }
- else
- {
- SendClientMessage(playerid, COLOR_RED,"You aren't specing that Player anymore ! ");
- IsPlayerSpecing[playerid] = false;
- TogglePlayerSpectating(playerid, 0);
- }
- }
- return 1;
- }
- //Goto cmd
- if(!strcmp(cmd, "/goto"))
- {
- {
- if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid, string[128];
- if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /goto [playerid/partofname]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- else
- {
- new pName[24];
- GetPlayerName(targetid,pName,128);
- format(string, sizeof(string), "You Have been Teleported to %s ",pName);
- SendClientMessage(playerid,COLOR_RED,string);
- SetPlayerInterior(playerid,GetPlayerInterior(targetid));
- new Float:TPX, Float:TPY, Float:TPZ;
- GetPlayerPos(targetid, TPX, TPY, TPZ);
- SetPlayerPos(playerid, TPX, TPY, TPZ+1);
- }
- }
- return 1;
- }
- //Get here cmd
- if(!strcmp(cmd, "/gethere"))
- {
- {
- if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid, string[128];
- if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /gethere [playerid/partofname]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- else
- {
- new pName[24];
- GetPlayerName(playerid,pName,128);
- format(string, sizeof(string), "You Have been Teleported to %s ",pName);
- SendClientMessage(targetid,COLOR_RED,string);
- SetPlayerInterior(targetid,GetPlayerInterior(playerid));
- new Float:TPX, Float:TPY, Float:TPZ;
- GetPlayerPos(playerid, TPX, TPY, TPZ);
- SetPlayerPos(targetid, TPX, TPY, TPZ+1);
- }
- }
- return 1;
- }
- //admin announcement cmd 1
- if(!strcmp(cmd, "/asay1"))
- {
- if(Player[playerid][AdminLevel] < 2) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new text[64];
- if(sscanf(params, "z",text)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /asay [text]");
- new string[128];
- new pName[24];
- GetPlayerName(playerid,pName,128);
- format(string,sizeof string,"[ADMIN]%s: %s",pName,text);
- SendClientMessageToAll(COLOR_RED,string);
- return 1;
- }
- if(!strcmp(cmd, "/asay2"))
- {
- if(Player[playerid][AdminLevel] < 2) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new text[64];
- if(sscanf(params, "z",text)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /asay [text]");
- new string[128];
- new pName[24];
- GetPlayerName(playerid,pName,128);
- format(string,sizeof string,"[ADMIN]%s: %s",pName,text);
- GameTextForAll(string, 500, 6);
- return 1;
- }
- //Admin kill cmd
- if(!strcmp(cmd, "/akill"))
- {
- if(Player[playerid][AdminLevel] < 2) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid;
- if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /akill [playerid/partofname]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- SendClientMessage(targetid, COLOR_RED,"You Have been Killed by an Admin ! ");
- SetPlayerHealth(targetid,0);
- return 1;
- }
- //Admin spawn cmd
- if(!strcmp(cmd, "/aspawn"))
- {
- {
- if(Player[playerid][AdminLevel] < 2) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid;
- if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /aspawn [playerid/partofname]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- else
- {
- SendClientMessage(targetid, COLOR_RED,"You Have been Spawned by an Admin ! ");
- SpawnPlayer(targetid);
- }
- }
- return 1;
- }
- //Setscore , hp , money , armour cmds
- if(!strcmp(cmd, "/setscore"))
- {
- if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid, score;
- if(sscanf(params, "ui", targetid,score)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /setscore [playerid/partofname] [score]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- SetPlayerScore(targetid, score);
- SendClientMessage(targetid, COLOR_RED, "an Admin has changed your Score.");
- return 1;
- }
- if(!strcmp(cmd, "/sethp"))
- {
- {
- if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid, hp;
- if(sscanf(params, "ui", targetid,hp)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /sethp [playerid/partofname] [health]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- else
- {
- SetPlayerHealth(targetid, hp);
- SendClientMessage(targetid, COLOR_RED, "an Admin has setted your Health. " );
- }
- }
- return 1;
- }
- if(!strcmp(cmd, "/setarmour"))
- {
- {
- if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid, armour;
- if(sscanf(params, "ui", targetid,armour)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /setarmour [playerid/partofname] [armour]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- else
- {
- SetPlayerArmour(targetid, armour);
- SendClientMessage(targetid, COLOR_RED, "an Admin has setted your Armour. ");
- }
- }
- return 1;
- }
- if(!strcmp(cmd, "/setmoney"))
- {
- {
- if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid, money;
- if(sscanf(params, "ui", targetid,money)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /setmoney [playerid/partofname] [money]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- else
- {
- GivePlayerMoney(targetid, money);
- SendClientMessage(targetid, COLOR_RED, "an Admin Has changed your Money");
- }
- }
- return 1;
- }
- //Slap cmd
- if(!strcmp(cmd, "/slap"))
- {
- {
- if(Player[playerid][AdminLevel] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid;
- if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /slap [playerid/partofname]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- if(Player[targetid][AdminLevel] > Player[playerid][AdminLevel])
- {
- SendClientMessage(targetid, COLOR_RED,"You Have been Slapped for attempting to slap a higher level admin ! ");
- new Float:SLX, Float:SLY, Float:SLZ;
- GetPlayerHealth(playerid, pHealth);
- SetPlayerHealth(playerid, pHealth-5);
- GetPlayerPos(playerid, SLX, SLY, SLZ);
- SetPlayerPos(playerid, SLX, SLY, SLZ+5);
- PlayerPlaySound(playerid, 1130, SLX, SLY, SLZ+5);
- }
- else
- {
- SendClientMessage(targetid, COLOR_RED,"You Have been Slapped By an admin ! ");
- new Float:SLX, Float:SLY, Float:SLZ;
- GetPlayerHealth(targetid, pHealth);
- SetPlayerHealth(targetid, pHealth-5);
- GetPlayerPos(targetid, SLX, SLY, SLZ);
- SetPlayerPos(targetid, SLX, SLY, SLZ+5);
- PlayerPlaySound(targetid, 1130, SLX, SLY, SLZ+5);
- }
- }
- return 1;
- }
- if(!strcmp(cmd, "/nochat"))
- {
- {
- if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new pName[24], string[128];
- GetPlayerName(playerid,pName,24);
- if (IsChatOnOrOff[playerid] == false)
- {
- for(new i; i< MAX_PLAYERS; i++)
- {
- IsChatOnOrOff[i] = true;
- format(string,128,"Admin %s Has turned off the Chat channel", pName);
- SendClientMessage(i, COLOR_RED,string);
- }
- }
- else if(IsChatOnOrOff[playerid] == true)
- {
- for(new i; i< MAX_PLAYERS; i++)
- {
- IsChatOnOrOff[i] = false;
- format(string,128,"Admin %s Has turned on the Chat channel", pName);
- SendClientMessage(i, COLOR_RED,string);
- }
- }
- }
- return 1;
- }
- if(!strcmp(cmd, "/makeadmin"))
- {
- {
- if(Player[playerid][AdminLevel] < 9998) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this command !");
- new targetid, adminlevel;
- if(sscanf(params, "ui", targetid, adminlevel)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /makeadmin [playerid/partofname] [level]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- if(adminlevel >= 1 && adminlevel <= 9999)
- {
- new pName[64], string[128];
- GetPlayerName(playerid,pName,64);
- Player[targetid][AdminLevel] = adminlevel;
- format(string, sizeof(string), "You have been promoted to level %d admin by %s", adminlevel, pName);
- SendClientMessage(targetid, COLOR_RED, string);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_RED, "Admin levels are from 1 to 9999");
- }
- }
- return 1;
- }
- if(!strcmp(cmd, "/gmx"))
- {
- {
- if(Player[playerid][AdminLevel] < 9998) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this command !");
- else
- {
- GameTextForAll("Server Restart in 15seconds , Type /savestats , to save all of your Stats",3000,6);
- SetTimer("Gmx",15000,false);
- }
- }
- return 1;
- }
- if(!strcmp(cmd, "/setrank"))
- {
- {
- if(Player[playerid][AdminLevel] < 9998) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid, rank;
- if(sscanf(params, "ui", targetid, rank)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /giveweapon [playerid/partofname] [rank]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- if(rank >= 1 && rank <= 6)
- {
- new string[128];
- new pName[24];
- Player[targetid][TeamRank] = rank;
- GetPlayerName(targetid, pName, 24);
- format(string, sizeof(string), "You have set %s's rank to %i.", pName, rank);
- SendClientMessage(playerid, COLOR_RED, string);
- format(string, sizeof(string), "You have been set to rank %d by an Admin.", pName, rank);
- SendClientMessage(targetid, COLOR_RED, string);
- return 1;
- }
- else return SendClientMessage(playerid, COLOR_RED, "Ranks are between 1 and 6.");
- }
- }
- if (strcmp("/ah", cmdtext, true, 10) == 0)
- {
- if(Player[playerid][AdminLevel] >= 1)
- {
- SendClientMessage(playerid,COLOR_YELLOW, "***---Modern TDM Admin Help---***");
- SendClientMessage(playerid,COLOR_WHITE, "Junior Admin (1) : /kick --- /ban --- /jail --- /unjail --- /spec --- /stopspec --- /getstats --- /slap --- #Tetx (admin chat)");
- }
- if(Player[playerid][AdminLevel] >= 2)
- {
- SendClientMessage(playerid,COLOR_WHITE, "General Admin (2) : /freeze --- /unfreeze --- /mute --- /unmute --- /akill --- /aspawn --- /asay1 --- /asay2");
- SendClientMessage(playerid,COLOR_WHITE,"/countdown --- /cc --- /payday --- /gethere --- /nochat-");
- }
- if(Player[playerid][AdminLevel] >= 3)
- {
- SendClientMessage(playerid,COLOR_WHITE, "Senior Admin (3) : /goto --- /setscore --- /setmoney --- /sethp --- /setarmour --- /takeweapon --- /giveweapon");
- }
- if(Player[playerid][AdminLevel] >= 9998)
- {
- SendClientMessage(playerid,COLOR_WHITE, "Co-owner (9998) // Owner (9999) : /makeadmin --- /setrank --- /gmx");
- }
- else
- {
- SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- }
- return 1;
- }
- //admin weapons commands
- if(!strcmp(cmd, "/takeweapon"))
- {
- {
- if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid;
- if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /takeweapon [playerid/partofname]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- else
- {
- SendClientMessage(targetid, COLOR_RED,"an Admin took all of your weapons");
- ResetPlayerWeapons(targetid);
- }
- }
- return 1;
- }
- if(!strcmp(cmd, "/giveweapon"))
- {
- {
- if(Player[playerid][AdminLevel] < 3) return SendClientMessage(playerid,COLOR_WHITE,"You are not able to use this Command!");
- new targetid, weapon, ammo;
- if(sscanf(params, "uii", targetid, weapon,ammo))
- {
- SendClientMessage(playerid, COLOR_WHITE, "Usage: /giveweapon [playerid/partofname] [weaponid] [ammo]");
- 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)");
- SendClientMessage(playerid, COLOR_WHITE, "14(Flowers) 15(Cane) 16(Grenades) 17(Teargas) 18(Molotovs) 22(Pistol) 23(SPistol) 24(Eagle)");
- SendClientMessage(playerid, COLOR_WHITE, "25(Shotgun) 26(sawn-off) 27(Combat) 28(TEC9) 29(MP5) 30(AK47) 31(M4) 32(MAC10) 33(Country)");
- SendClientMessage(playerid, COLOR_WHITE, "34(Sniper) 35(RPG) 37(Flamethrower) 38(Minigun) 41(spray) 42(exting) 43(Camera) 46(Parachute)");
- }
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected!");
- if(weapon >= 1 && weapon <= 46)
- {
- if(ammo >= 1 && ammo <= 10000)
- {
- new string[128];
- new pName[24];
- GetPlayerName(targetid, pName, 24);
- format(string, sizeof(string), "an Admin has gave you a weapon (WeaponID : %d with %d ammo).", weapon, ammo);
- SendClientMessage(targetid, COLOR_RED, string);
- format(string, sizeof(string), "You gave a weapon to %s (Weapon ID : %d with %d ammo).", pName, weapon, ammo);
- SendClientMessage(playerid, COLOR_RED, string);
- GivePlayerWeapon(targetid, weapon, ammo);
- return 1;
- }
- else return SendClientMessage(playerid, COLOR_RED, "Weapon ID's are from 1 to 64 and Max Ammo is 10000");
- }
- else return SendClientMessage(playerid, COLOR_RED, "Weapon ID's are from 1 to 64 and Max Ammo is 10000");
- }
- //---------------------------------------------------------------------------------------
- }
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- if(GetPlayerMenu(playerid) == AmmoNationMenu)
- {
- switch(row)
- {
- //this menu will be showing only if player type /buygun inside the ammunation
- //when player select a weapon , first it checks his money (< or > of the gun price)
- //if it is < player money , player won't get the weapon and if it is > player money
- //He'll get the weapon
- case 0: //AK47
- {
- TogglePlayerControllable(playerid, 1);
- if(GetPlayerMoney(playerid) < 8000)
- {
- SendClientMessage(playerid,COLOR_YELLOW,"You Can not afford this");
- }
- else
- {
- GivePlayerWeapon(playerid,30,750);
- SendClientMessage(playerid, COLOR_YELLOW, "You Bought an AK47 from the Ammu Nation!");
- GivePlayerMoney(playerid, -8000);
- }
- }
- case 1: //M4
- {
- TogglePlayerControllable(playerid, 1);
- if(GetPlayerMoney(playerid) < 9000)
- {
- SendClientMessage(playerid,COLOR_YELLOW,"You Can not afford this");
- }
- else
- {
- GivePlayerWeapon(playerid,31,750);
- SendClientMessage(playerid, COLOR_YELLOW, "You Bought an M4 from the Ammu Nation!");
- GivePlayerMoney(playerid, -9000);
- }
- }
- case 2: //MP5
- {
- TogglePlayerControllable(playerid, 1);
- if(GetPlayerMoney(playerid) < 4000)
- {
- SendClientMessage(playerid,COLOR_YELLOW,"You Can not afford this");
- }
- else
- {
- GivePlayerWeapon(playerid,29,2400);
- SendClientMessage(playerid, COLOR_YELLOW, "You Bought an MP5 from the Ammu Nation!");
- GivePlayerMoney(playerid, -4000);
- }
- }
- case 3: //UZI
- {
- TogglePlayerControllable(playerid, 1);
- if(GetPlayerMoney(playerid) < 4000)
- {
- SendClientMessage(playerid,COLOR_YELLOW,"You Can not afford this");
- }
- else
- {
- GivePlayerWeapon(playerid,28,2400);
- SendClientMessage(playerid, COLOR_YELLOW, "You Bought a UZI from the Ammu Nation!");
- GivePlayerMoney(playerid, -4000);
- }
- }
- case 4: //SPAS12
- {
- TogglePlayerControllable(playerid, 1);
- if(GetPlayerMoney(playerid) < 7500)
- {
- SendClientMessage(playerid,COLOR_YELLOW,"You Can not afford this");
- }
- else
- {
- GivePlayerWeapon(playerid,27,500);
- SendClientMessage(playerid, COLOR_YELLOW, "You Bought a SPAS12 from the Ammu Nation!");
- GivePlayerMoney(playerid, -7500);
- }
- }
- case 5: //Deagle
- {
- TogglePlayerControllable(playerid, 1);
- if(GetPlayerMoney(playerid) < 5000)
- {
- SendClientMessage(playerid,COLOR_YELLOW,"You Can not afford this");
- }
- else
- {
- GivePlayerWeapon(playerid,24,450);
- SendClientMessage(playerid, COLOR_YELLOW, "You Bought a Deagle from the Ammu Nation!");
- GivePlayerMoney(playerid, -5000);
- }
- }
- case 6: //Sniper
- {
- TogglePlayerControllable(playerid, 1);
- if(GetPlayerMoney(playerid) < 10000)
- {
- SendClientMessage(playerid,COLOR_YELLOW,"You Can not afford this");
- }
- else
- {
- GivePlayerWeapon(playerid,34,25);
- SendClientMessage(playerid, COLOR_YELLOW, "You Bought a Sniper Rifle from the Ammu Nation!");
- GivePlayerMoney(playerid, -10000);
- }
- }
- case 7: //Rocket launcher
- {
- TogglePlayerControllable(playerid, 1);
- if(GetPlayerMoney(playerid) < 50000)
- {
- SendClientMessage(playerid,COLOR_YELLOW,"You Can not afford this");
- }
- else
- {
- GivePlayerWeapon(playerid,35,5);
- SendClientMessage(playerid, COLOR_YELLOW, "You Bought a Rocket Launcher from the Ammu Nation!");
- GivePlayerMoney(playerid, -50000);
- }
- //Ammunation only sells the best weapons and with a lot of ammo !
- }
- }
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- //This sends a message when player is in a pickup (to inform him about the cmd to use)
- if(pickupid == AmmoNationEntrance)
- {
- GameTextForPlayer(playerid,"~w~Type ~r~ /ENTER ~w~ to enter the Ammunation",3000,4);
- }
- if(pickupid == AmmoNationExit)
- {
- GameTextForPlayer(playerid,"~w~Type ~r~ /EXIT ~w~ to exit the Ammunation",3000,4);
- }else if(pickupid == DrugPlace)
- {
- GameTextForPlayer(playerid,"~w~Type ~r~ /BUYDRUG ~w~ to buy Drugs",3000,4);
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- //This is the dialog when player types /buydrug to purchase drugs
- if (dialogid == 1)
- {
- if (response == 1)
- {
- TogglePlayerControllable(playerid, 1);
- switch (listitem)
- {
- case 0://Pot : + 20 health
- {
- if(GetPlayerMoney(playerid) < 200)
- {
- SendClientMessage(playerid,COLOR_GREEN,"You Can not afford this");
- }
- else
- {
- GetPlayerHealth(playerid,pHealth);
- GivePlayerMoney(playerid,-200);
- SetPlayerHealth(playerid,pHealth + 20);
- }
- }
- case 1://Crack : + 20 armour
- {
- if(GetPlayerMoney(playerid) < 350)
- {
- SendClientMessage(playerid,COLOR_GREEN,"You Can not afford this");
- }
- else
- {
- GetPlayerArmour(playerid,pArmour);
- GivePlayerMoney(playerid,-350);
- SetPlayerArmour(playerid,pArmour + 20);
- }
- }
- case 2://Meth : + 20 health and armour
- {
- if(GetPlayerMoney(playerid) < 500)
- {
- SendClientMessage(playerid,COLOR_GREEN,"You Can not afford this");
- }
- else
- {
- GetPlayerHealth(playerid,pHealth);
- GetPlayerArmour(playerid,pArmour);
- GivePlayerMoney(playerid,-500);
- SetPlayerHealth(playerid,pHealth + 20);
- SetPlayerArmour(playerid,pArmour + 20);
- }
- }
- }
- }
- else
- {
- TogglePlayerControllable(playerid, 1);
- }
- return 1;
- }
- //Login/Register Dialogs
- if (dialogid == 2)
- {
- new pName[24], playersfile[256], string[128];
- GetPlayerName(playerid, pName, 24);
- format(playersfile, sizeof(playersfile), SERVER_USER_FILE, pName);
- if(!response)return Kick(playerid);
- if (!strlen(inputtext)) return
- ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Welcome to Modern TDM" , "you're not registered , type your Password below.", "Register", "Exit");
- dini_Create(playersfile);
- dini_IntSet(playersfile, "Password", udb_hash(inputtext));
- dini_IntSet(playersfile, "AdminLevel",Player[playerid][AdminLevel] = 0);
- dini_IntSet(playersfile, "Cash",Player[playerid][Cash] = 0);
- dini_IntSet(playersfile, "Level",Player[playerid][Level] = 0);
- dini_IntSet(playersfile, "TeamRank",Player[playerid][TeamRank] = 1);
- format(string, 128, "Thank you for registering (Registered Name : %s , Password : %s ) You have auto Logged in", pName, inputtext);
- SendClientMessage(playerid, COLOR_YELLOW, string);
- Player[playerid][Logged] = 1;
- }
- if (dialogid == 3)
- {
- new pName[24], playersfile[256];
- GetPlayerName(playerid, pName, 24);
- format(playersfile, sizeof(playersfile), SERVER_USER_FILE, pName);
- if(!response) return Kick(playerid);
- if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 3, DIALOG_STYLE_INPUT, "Welcome Back to Modern TDM", "Type your Password below to login", "Login", "Exit");
- new tmp;
- tmp = dini_Int(playersfile, "Password");
- if(udb_hash(inputtext) != tmp) {
- SendClientMessage(playerid, COLOR_RED, "You Have been Kicked for typing a wrong PassWord.");
- Kick(playerid);
- }
- else
- {
- Player[playerid][Logged] = 1;
- Player[playerid][AdminLevel] = dini_Int(playersfile, "AdminLevel");
- Player[playerid][TeamRank] = dini_Int(playersfile, "TeamRank");
- Player[playerid][Level] = dini_Int(playersfile, "Level");
- Player[playerid][Cash] = dini_Int(playersfile, "Cash");
- Player[playerid][Mute] = dini_Int(playersfile, "Muted");
- Player[playerid][Jailed] = dini_Int(playersfile, "Jailed");
- Player[playerid][Wanted] = dini_Int(playersfile, "Wanted");
- SetPlayerScore(playerid, Player[playerid][Level]);
- GivePlayerMoney(playerid, Player[playerid][Cash]);
- SetPlayerWantedLevel(playerid, Player[playerid][Wanted]);
- SendClientMessage(playerid,COLOR_RED, "You Have been Logged in.");
- }
- }
- if (dialogid == 4)
- {
- if (response == 1)
- {
- switch (listitem)
- {
- case 0://MiniGun DeathMatch
- {
- }
- case 1://M4 And Spas12 DeathMatch
- {
- }
- case 2://Deagle and MP5 DeathMatch
- {
- }
- }
- }
- else
- {
- }
- return 1;
- }
- return 1;
- }
- public HourTimer(playerid)
- {
- //The Player will get money , score and rocket for playing 1Hour..
- GivePlayerMoney(playerid,20000);
- SetPlayerScore(playerid,GetPlayerScore(playerid)+20);
- GivePlayerWeapon(playerid,35,5);
- GameTextForPlayer(playerid,"~g~You Have Passed 1Hour playing in the Server",3000,4);
- SendClientMessage(playerid,COLOR_GREEN,"You won $20.000 , + 20 Score and a Rocket Launcher !! Enjoy !!");
- return 1;
- }
- //Afk timer
- public AfkTimer(playerid)
- {
- new pName[64];
- new string[128];
- GetPlayerName(playerid,pName,64);
- format(string, sizeof string,"%s Has Been Kicked for Being Afk for More than 15Minutes" ,pName);
- SendClientMessageToAll(COLOR_GREEN,string);
- Kick(playerid);
- return 1;
- }
- // Countdowns timers
- public CountDown2(playerid)
- {
- GameTextForAll("~r~2",3000,4);
- SetTimer("CountDown1",3500,false);
- return 1;
- }
- public CountDown1(playerid)
- {
- GameTextForAll("~b~1",3000,4);
- SetTimer("CountDownGo",3500,false);
- return 1;
- }
- public CountDownGo(playerid)
- {
- GameTextForAll("~y~Go",3000,4);
- return 1;
- }
- //Jail Timer
- public JailTimer(playerid)
- {
- Player[playerid][Jailed] = 0;
- SpawnPlayer(playerid);
- SetPlayerInterior(playerid, 5);
- GameTextForPlayer(playerid,"~r~You are free to go now",3000,4);
- return 1;
- }
- //Gmx Timer
- public Gmx(playerid)
- {
- SendRconCommand("gmx");
- return 1;
- }
- //We use @Text as team chat , it is a Channel where the team members can chat
- //Privatly to plan for attacking other teams etc..
- //also #for admin chat , it shows admin levels too :D
- public OnPlayerText(playerid, text[])
- {
- if( (text[0] == '#') && strlen(text) > 1)
- {
- new str[128];
- new pName[24];
- GetPlayerName(playerid, pName, 128);
- for(new i; i < MAX_PLAYERS; i++)
- {
- if(!IsPlayerConnected(i)) continue;
- if(Player[i][AdminLevel] >= 1 && Player[playerid][AdminLevel] == 1)
- {
- format(str, 128, "Junior Admin %s Says : %s", pName, text[1]);
- SendClientMessage(i, COLOR_RED, str);
- }
- if(Player[i][AdminLevel] >= 1 && Player[playerid][AdminLevel] == 2)
- {
- format(str, 128, "General Admin %s Says : %s", pName, text[1]);
- SendClientMessage(i, COLOR_RED, str);
- }
- if(Player[i][AdminLevel] >= 1 && Player[playerid][AdminLevel] >= 3 && Player[playerid][AdminLevel] <= 9997)
- {
- format(str, 128, "Senior Admin %s Says : %s", pName, text[1]);
- SendClientMessage(i, COLOR_RED, str);
- }
- if(Player[i][AdminLevel] >= 1 && Player[playerid][AdminLevel] == 9998)
- {
- format(str, 128, "Co-Owner %s Says : %s", pName, text[1]);
- SendClientMessage(i, COLOR_RED, str);
- }
- if(Player[i][AdminLevel] >= 1 && Player[playerid][AdminLevel] >= 9999)
- {
- format(str, 128, "Owner %s Says : %s", pName, text[1]);
- SendClientMessage(i, COLOR_RED, str);
- }
- }
- return 0;
- }
- if( (text[0] == '@') && strlen(text) > 1)
- {
- new str[128];
- new pName[24];
- GetPlayerName(playerid, pName, 128);
- for(new i; i < MAX_PLAYERS; i++)
- {
- if(!IsPlayerConnected(i)) continue;
- if(Player[i][TeamRank] == Player[playerid][TeamRank])
- {
- if(Player[i][TeamRank] >= 1 && Player[playerid][TeamRank] == 1)
- {
- format(str, 128, "Rank 1 %s Says : %s", pName, text[1]);
- SendClientMessage(i, COLOR_RED, str);
- }
- if(Player[i][TeamRank] >= 1 && Player[playerid][TeamRank] == 2)
- {
- format(str, 128, "Rank 2 %s Says : %s", pName, text[1]);
- SendClientMessage(i, COLOR_RED, str);
- }
- if(Player[i][TeamRank] >= 1 && Player[playerid][TeamRank] == 3)
- {
- format(str, 128, "Rank 3(Killer) %s Says : %s", pName, text[1]);
- SendClientMessage(i, COLOR_RED, str);
- }
- if(Player[i][TeamRank] >= 1 && Player[playerid][TeamRank] == 4)
- {
- format(str, 128, "Rank 4(Pro) %s Says : %s", pName, text[1]);
- SendClientMessage(i, COLOR_RED, str);
- }
- if(Player[i][TeamRank] >= 1 && Player[playerid][TeamRank] == 5)
- {
- format(str, 128, "Rank 5 (Co-Leader) %s Says : %s", pName, text[1]);
- SendClientMessage(i, COLOR_RED, str);
- }
- if(Player[i][TeamRank] >= 1 && Player[playerid][TeamRank] == 6)
- {
- format(str, 128, "Rank 1(Leader) %s Says : %s", pName, text[1]);
- SendClientMessage(i, COLOR_RED, str);
- }
- }
- }
- return 0;
- }
- if(Player[playerid][AfkMute] == 1)
- {
- SendClientMessage(playerid, COLOR_RED, "You are AFK! You cannot talk");
- return 0;
- }
- if(Player[playerid][Mute] == 1)
- {
- SendClientMessage(playerid, COLOR_RED, "You are Muted! You cannot talk");
- return 0;
- }
- if(IsChatOnOrOff[playerid] == true)
- {
- SendClientMessage(playerid, COLOR_RED, "Chat channel is turned off by an admin");
- return 0;
- }
- return 1;
- }
- //This is the callback that sets player team from class
- SetPlayerTeamFromClass(playerid, classid)
- {
- if(classid == 0 || classid == 1 || classid == 2 || classid == 3 || classid == 4 || classid == 5 || classid == 6 || classid == 7 )
- {
- gTeam[playerid] = TEAM_POLICE;
- GameTextForPlayer(playerid,"~b~Police",3000,4);
- }
- if(classid == 8 || classid == 9 || classid == 10 || classid == 11 || classid == 12 || classid == 13 || classid == 14)
- {
- gTeam[playerid] = TEAM_HOBOS;
- GameTextForPlayer(playerid,"~W~Hobos",3000,4);
- }
- if(classid == 15 || classid == 16 || classid == 17 || classid == 18 || classid == 19 || classid == 20 || classid == 21)
- {
- gTeam[playerid] = TEAM_GROVE;
- GameTextForPlayer(playerid,"~g~Grove Street",3000,4);
- }
- else if(classid == 22 || classid == 23 || classid == 24 || classid == 25 || classid == 26 || classid == 27 || classid == 28)
- {
- gTeam[playerid] = TEAM_MAFIA;
- GameTextForPlayer(playerid,"~y~The Mafia",3000,4);
- }
- }
- //This is the callback that sets player colour according to team when he spawns
- SetPlayerToTeamColour(playerid)
- {
- if(gTeam[playerid] == TEAM_POLICE)
- {
- SetPlayerColor(playerid,TEAM_POLICE_COLOUR);
- }
- if(gTeam[playerid] == TEAM_HOBOS)
- {
- SetPlayerColor(playerid,TEAM_HOBOS_COLOUR);
- }
- if(gTeam[playerid] == TEAM_GROVE)
- {
- SetPlayerColor(playerid,TEAM_GROVE_COLOUR);
- }
- else if(gTeam[playerid] == TEAM_MAFIA)
- {
- SetPlayerColor(playerid,TEAM_MAFIA_COLOUR);
- }
- }
- /*----------------------------------------------------------------------------*-
- Function:
- sscanf
- Params:
- string[] - String to extract parameters from.
- format[] - Parameter types to get.
- {Float,_}:... - Data return variables.
- Return:
- 0 - Successful, not 0 - fail.
- Notes:
- A fail is either insufficient variables to store the data or insufficient
- data for the format string - excess data is disgarded.
- A string in the middle of the input data is extracted as a single word, a
- string at the end of the data collects all remaining text.
- The format codes are:
- c - A character.
- d, i - An integer.
- h, x - A hex number (e.g. a colour).
- f - A float.
- s - A string.
- z - An optional string.
- pX - An additional delimiter where X is another character.
- '' - Encloses a litteral string to locate.
- u - User, takes a name, part of a name or an id and returns the id if they're connected.
- Now has IsNumeric integrated into the code.
- Added additional delimiters in the form of all whitespace and an
- optioanlly specified one in the format string.
- -*----------------------------------------------------------------------------*/
- stock sscanf(string[], format[], {Float,_}:...)
- {
- #if defined isnull
- if (isnull(string))
- #else
- if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
- #endif
- {
- return format[0];
- }
- #pragma tabsize 4
- new
- formatPos = 0,
- stringPos = 0,
- paramPos = 2,
- paramCount = numargs(),
- delim = ' ';
- while (string[stringPos] && string[stringPos] <= ' ')
- {
- stringPos++;
- }
- while (paramPos < paramCount && string[stringPos])
- {
- switch (format[formatPos++])
- {
- case '\0':
- {
- return 0;
- }
- case 'i', 'd':
- {
- new
- neg = 1,
- num = 0,
- ch = string[stringPos];
- if (ch == '-')
- {
- neg = -1;
- ch = string[++stringPos];
- }
- do
- {
- stringPos++;
- if ('0' <= ch <= '9')
- {
- num = (num * 10) + (ch - '0');
- }
- else
- {
- return -1;
- }
- }
- while ((ch = string[stringPos]) > ' ' && ch != delim);
- setarg(paramPos, 0, num * neg);
- }
- case 'h', 'x':
- {
- new
- num = 0,
- ch = string[stringPos];
- do
- {
- stringPos++;
- switch (ch)
- {
- case 'x', 'X':
- {
- num = 0;
- continue;
- }
- case '0' .. '9':
- {
- num = (num << 4) | (ch - '0');
- }
- case 'a' .. 'f':
- {
- num = (num << 4) | (ch - ('a' - 10));
- }
- case 'A' .. 'F':
- {
- num = (num << 4) | (ch - ('A' - 10));
- }
- default:
- {
- return -1;
- }
- }
- }
- while ((ch = string[stringPos]) > ' ' && ch != delim);
- setarg(paramPos, 0, num);
- }
- case 'c':
- {
- setarg(paramPos, 0, string[stringPos++]);
- }
- case 'f':
- {
- new changestr[16], changepos = 0, strpos = stringPos;
- while(changepos < 16 && string[strpos] && string[strpos] != delim)
- {
- changestr[changepos++] = string[strpos++];
- }
- changestr[changepos] = '\0';
- setarg(paramPos,0,_:floatstr(changestr));
- }
- case 'p':
- {
- delim = format[formatPos++];
- continue;
- }
- case '\'':
- {
- new
- end = formatPos - 1,
- ch;
- while ((ch = format[++end]) && ch != '\'') {}
- if (!ch)
- {
- return -1;
- }
- format[end] = '\0';
- if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
- {
- if (format[end + 1])
- {
- return -1;
- }
- return 0;
- }
- format[end] = '\'';
- stringPos = ch + (end - formatPos);
- formatPos = end + 1;
- }
- case 'u':
- {
- new
- end = stringPos - 1,
- id = 0,
- bool:num = true,
- ch;
- while ((ch = string[++end]) && ch != delim)
- {
- if (num)
- {
- if ('0' <= ch <= '9')
- {
- id = (id * 10) + (ch - '0');
- }
- else
- {
- num = false;
- }
- }
- }
- if (num && IsPlayerConnected(id))
- {
- setarg(paramPos, 0, id);
- }
- else
- {
- #if !defined foreach
- #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
- #define __SSCANF_FOREACH__
- #endif
- string[end] = '\0';
- num = false;
- new
- name[MAX_PLAYER_NAME];
- id = end - stringPos;
- foreach (Player, playerid)
- {
- GetPlayerName(playerid, name, sizeof (name));
- if (!strcmp(name, string[stringPos], true, id))
- {
- setarg(paramPos, 0, playerid);
- num = true;
- break;
- }
- }
- if (!num)
- {
- setarg(paramPos, 0, INVALID_PLAYER_ID);
- }
- string[end] = ch;
- #if defined __SSCANF_FOREACH__
- #undef foreach
- #undef __SSCANF_FOREACH__
- #endif
- }
- stringPos = end;
- }
- case 's', 'z':
- {
- new
- i = 0,
- ch;
- if (format[formatPos])
- {
- while ((ch = string[stringPos++]) && ch != delim)
- {
- setarg(paramPos, i++, ch);
- }
- if (!i)
- {
- return -1;
- }
- }
- else
- {
- while ((ch = string[stringPos++]))
- {
- setarg(paramPos, i++, ch);
- }
- }
- stringPos--;
- setarg(paramPos, i, '\0');
- }
- default:
- {
- continue;
- }
- }
- while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
- {
- stringPos++;
- }
- while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
- {
- stringPos++;
- }
- paramPos++;
- }
- do
- {
- if ((delim = format[formatPos++]) > ' ')
- {
- if (delim == '\'')
- {
- while ((delim = format[formatPos++]) && delim != '\'') {}
- }
- else if (delim != 'z')
- {
- return delim;
- }
- }
- }
- while (delim > ' ');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment