LucasRed

IVMP

Jun 17th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. dofile("scripts/inifiles.nut");
  2.  
  3. ////Variables & colors////
  4. //////////////////////////
  5.  
  6. //colors:
  7.     const COLOR_RED = 0xff0000ff;
  8.     const COLOR_DARKRED = 0x610000ff;
  9.     const COLOR_ORANGE = 0xff9000ff;
  10.     const COLOR_DARKORANGE = 0xff5600ff;
  11.     const COLOR_PINK = 0xff00ffff;
  12.     const COLOR_YELLOW = 0xffff00ff;
  13.     const COLOR_GREEN = 0x00ff00ff;
  14.     const COLOR_DARKGREEN = 0x008100ff;
  15.     const COLOR_BLACK = 0x000000ff;
  16.     const COLOR_TRANSPARENT = 0xffffff00;
  17.     const COLOR_BROWN = 0x7f4300ff;;
  18.     const COLOR_BROWNGREEN = 0x7fa000ff;;
  19.     const COLOR_BLUE = 0x0000ffff;
  20.     const COLOR_DARKBLUE = 0x000069ff;;
  21.     const COLOR_PURPLE = 0x940069ff;
  22.     const COLOR_BRIGHTPURPLE = 0xff0069ff;
  23.     const COLOR_CYAN = 0x00ffffff;
  24.     const COLOR_DARKPINK = 0xe62dffff;
  25.     const COLOR_DARKWHITE = 0xe6e0c4ff;
  26.     const COLOR_LIMEGREEN = 0xe6ff00ff;
  27.     const COLOR_NICEBLUE = 0x0087cbff;
  28.     // END COLORS
  29.     // CONSTANT VALUES:
  30.  
  31.  
  32.     local VehicleNames =
  33.     [
  34.         "Admiral", "Airtug", "Ambulance", "Banshee", "Benson", "Biff", "Blista Compact", "Bobcat", "Boxville", "Buccaneer",
  35.         "Burrito", "Burrito", "Bus", "Cabby", "Cavalcade", "Chavos", "Cognoscenti", "Comet", "Coquette",
  36.         "DF8", "Dilettante", "Dukes", "E109", "Emperor", "Emperor", "Esperanto", "Faction", "FBI", "Feltzer",
  37.         "Feroci", "Feroci", "Firetruck", "Flatbed", "Fortune", "Forklift", "Futo", "FXT", "Habanero", "Hakumai",
  38.         "Huntley", "Infernus", "Ingot", "Intruder", "Landstalker", "Lokus", "Manana", "Marbella", "Merit", "Minivan",
  39.         "Moonbeam", "MrTasty", "Mule", "Noose", "Nstockade", "Oracle", "Packer", "Patriot", "Perennial", "Perennial",
  40.         "Peyote", "Phantom", "Pinnacle", "PMP600", "Police", "Police", "Polpatriot", "Pony", "Premier", "Pres", "Primo",
  41.         "Pstockade", "Rancher", "Rebla", "Ripley", "Romero", "Rom", "Ruiner", "Sabre", "Sabre", "Sabre GT", "Schafter",
  42.         "Sentinel", "Solair", "Speedo", "Stalion", "Steed", "Stockade", "Stratum", "Stretch", "Sultan", "Sultan RS",
  43.         "Super GT", "Taxi", "Taxi", "Trash", "Turismo", "Uranus", "Vigero", "Vigero", "Vincent", "Virgo", "Voodoo",
  44.         "Washington", "Willard", "Yankee", "Bobber", "Faggio", "Hellfury", "NRG900", "PCJ600", "Sanchez", "Zombieb",
  45.         "Annihilator", "Maverick", "Polmav", "Tourmav", "Dinghy", "Jetmax", "Marquis", "Predator", "Reefer", "Squalo",
  46.         "Tuga", "Tropic", "Cablecar", "Subway"
  47.     ];
  48.    
  49.     local weaponsarray =
  50.     [
  51.         "Hand", "Baseball Bat", "Pool Cue", "Knife", "Grenade", "Molotov", "Invalidweapon", "Pistol", "Desert Eagle", "Shotgun", "Beretta", "Micro Uzi",
  52.         "MP 5", "AK-47", "M4", "Sniper Rifle", "M40A1", "Rocket Launcher"
  53.     ];
  54.    
  55.     local skinsArray =
  56.     [
  57.         "invalid", "invalid", "invalid", "invalid", "Anna_Faustin", "Anthony", "Badman", "Bernie_Crane", "Bledar_Morina", "Brian_Meech", "Brucie_Kibbutz", "Rodislav_Bulgarin", "Cherise_Glover",
  58.         "IG_CHARLIEUC", "Clarence_Little", "IG_DARDAN", "Darko_Brevic", "Derrick_McReary", "Dimitri_Rascalov", "Dwayne_Forge", "Eddie_Low",
  59.         "Mikhail_Faustin", "Francis_McReary", "French_Tom", "IG_GORDON", "Gracie_Ancelotti", "Hossan_Ramzy", "Ilyena_Faustin", "IG_ISAAC",
  60.         "Ivan_Bytchkov", "IG_JAY", "IG_JASON", "Jeff", "Jimmy_Pegorino", "Johnny_Klebitz", "Kate_McReary", "Lenny_Petrovic",
  61.         "Little_Jacob", "IG_LILJACOBW", "Luca", "Luis_Fernando_Lopez", "Mallorie_Bardas", "IG_MAMC", "Manny_Escuela", "Marnie_Allen",
  62.         "Mel", "IG_MICHAEL", "Michelle", "IG_MICKEY", "Packie_McReary", "Pathos", "Kenny_Petrovic", "Phil_Bell",
  63.         "Playboy_X", "Ray_Boccino", "Ricky_Gervais", "Roman_Bellic", "IG_ROMANW", "Sara", "Tuna", "M_Y_GAFR_LO_1",
  64.         "M_Y_GAFR_LO_2", "M_Y_GAFR_HI_1", "M_Y_GAFR_HI_2", "M_Y_GALB_LO_1", "M_Y_GALB_LO_2", "M_Y_GALB_LO_3", "M_Y_GALB_LO_4", "M_M_GBIK_LO_3",
  65.         "M_Y_GBIK_HI_1", "M_Y_GBIK_HI_2", "M_Y_GBIK3_LO2", "M_Y_GBIK_LO_1", "M_Y_GBIK_LO_2", "M_Y_GIRI_LO_1", "M_Y_GIRI_LO_2", "M_Y_GIRI_LO_3",
  66.         "M_M_GJAM_HI_1", "M_M_GJAM_HI_2", "M_M_GJAM_HI_3", "M_Y_GJAM_LO_1", "M_Y_GJAM_LO_2", "M_Y_GKOR_LO_1", "M_Y_GKOR_LO_2", "M_Y_GLAT_LO_1",
  67.         "M_Y_GLAT_LO_2", "M_Y_GLAT_HI_1", "M_Y_GLAT_HI_2", "M_Y_GMAF_HI_1", "M_Y_GMAF_HI_2", "M_Y_GMAF_LO_1", "M_Y_GMAF_LO_2", "M_O_GRUS_HI_1",
  68.         "M_Y_GRUS_LO_1", "M_Y_GRUS_LO_2", "M_Y_GRUS_HI_2", "M_M_GRU3_HI_1", "M_M_GRU3_HI_2", "M_M_GRU3_LO_2", "M_Y_GRU3_LO_1", "M_M_GTRI_HI_1",
  69.         "M_M_GTRI_HI_2", "M_Y_GTRI_LO_1", "M_Y_GTRI_LO_2", "F_O_MAID_1", "F_O_BINCO", "F_Y_BANK_2", "Female_Doctor", "F_Y_GYMGAL_0",
  70.         "F_Y_FF_BURGER_R", "F_Y_FF_CLUCK_R", "F_Y_FF_RSCAFE", "F_Y_FF_TWCAFE", "F_Y_FF_WSPIZZAR", "Fat_Hooker", "Hooker", "Nurse",
  71.         "Stripper_1", "Stripper_2", "F_Y_WAITRESS_1", "Alcoholic", "Armoured", "M_M_BUSDRIVER", "M_M_CHINATOWN_1", "M_M_CRACKHEAD",
  72.         "M_M_DOC_SCRUBS1", "M_M_DOCTOR_1", "M_M_DODGYDOC", "M_M_EECOOK", "M_M_ENFORCER", "M_M_FACTORY_1", "Fat_Policeman", "FBI_Agent",
  73.         "M_M_FEDCO", "M_M_FIRECHIEF", "M_M_GUNNUT_1", "M_M_HELIPILOT_1", "M_M_HPORTER_1", "M_M_KOREACOOK_1", "M_M_LAWYER_1", "Tom_Goldberg",
  74.         "M_M_LOONYBLACK", "M_M_PILOT", "M_M_PINDUS_1", "M_M_POSTAL_1", "M_M_SAXPLAYER_1", "Security", "M_M_SELLER_1", "M_M_SHORTORDER",
  75.         "M_M_STREETFOOD1", "M_M_SWEEPER", "M_M_TAXIDRIVER", "M_M_TELEPHONE", "M_M_TENNIS", "M_M_TRAIN_1", "M_M_TRAMPBLACK", "M_M_TRUCKER_1",
  76.         "M_O_JANITOR", "M_O_HOTEL_FOOT", "M_O_MPMOBBOSS", "M_Y_AIRWORKER", "M_Y_BARMAN_1", "M_Y_BOUNCER_1", "M_Y_BOUNCER_2", "M_Y_BOWL_1",
  77.         "M_Y_BOWL_2", "M_Y_CHINVEND_1", "M_Y_CLUBFIT", "M_Y_CONSTRUCT_1", "M_Y_CONSTRUCT_2", "M_Y_CONSTRUCT_3", "Policeman", "Traffic_Policeman",
  78.         "M_Y_COURIER", "M_Y_COWBOY_1", "M_Y_DEALER", "M_Y_DRUG_1", "M_Y_FF_BURGER_R", "M_Y_FF_CLUCK_R", "M_Y_FF_RSCAFE", "M_Y_FF_TWCAFE",
  79.         "M_Y_FF_WSPIZZAR", "M_Y_FIREMAN", "M_Y_GARBAGE", "M_Y_GOON_1", "M_Y_GYMGUY_1", "M_Y_MECHANIC_2", "M_Y_MODO", "M_Y_NHELIPILOT",
  80.         "M_Y_PERSEUS", "M_Y_PINDUS_1", "M_Y_PINDUS_2", "M_Y_PINDUS_3", "M_Y_PMEDIC", "M_Y_PRISON", "M_Y_PRISONAOM", "M_Y_ROMANCAB",
  81.         "M_Y_RUNNER", "M_Y_SHOPASST_1", "M_Y_STROOPER", "SWAT", "M_Y_SWORDSWALLO", "M_Y_THIEF", "M_Y_VALET", "M_Y_VENDOR",
  82.         "M_Y_FRENCHTOM", "M_Y_JIM_FITZ", "F_O_PEASTEURO_1", "F_O_PEASTEURO_2", "F_O_PHARBRON_1", "F_O_PJERSEY_1", "F_O_PORIENT_1", "F_O_RICH_1",
  83.         "F_M_BUSINESS_1", "F_M_BUSINESS_2", "F_M_CHINATOWN", "F_M_PBUSINESS", "F_M_PEASTEURO_1", "F_M_PHARBRON_1", "F_M_PJERSEY_1", "F_M_PJERSEY_2",
  84.         "F_M_PLATIN_1", "F_M_PLATIN_2", "F_M_PMANHAT_1", "F_M_PMANHAT_2", "F_M_PORIENT_1", "F_M_PRICH_1", "F_Y_BUSINESS_1", "F_Y_CDRESS_1",
  85.         "F_Y_PBRONX_1", "F_Y_PCOOL_1", "F_Y_PCOOL_2", "F_Y_PEASTEURO_1", "F_Y_PHARBRON_1", "F_Y_PHARLEM_1", "F_Y_PJERSEY_2", "F_Y_PLATIN_1",
  86.         "F_Y_PLATIN_2", "F_Y_PLATIN_3", "F_Y_PMANHAT_1", "F_Y_PMANHAT_2", "F_Y_PMANHAT_3", "F_Y_PORIENT_1", "F_Y_PQUEENS_1", "F_Y_PRICH_1",
  87.         "F_Y_PVILLBO_2", "F_Y_SHOP_3", "F_Y_SHOP_4", "F_Y_SHOPPER_5", "F_Y_SOCIALITE", "F_Y_STREET_2", "F_Y_STREET_5", "F_Y_STREET_9",
  88.         "F_Y_STREET_12", "F_Y_STREET_30", "F_Y_STREET_34", "F_Y_TOURIST_1", "F_Y_VILLBO_1", "M_M_BUSINESS_2", "M_M_BUSINESS_3", "M_M_EE_HEAVY_1",
  89.         "M_M_EE_HEAVY_2", "M_M_FATMOB_1", "M_M_GAYMID", "M_M_GENBUM_1", "M_M_LOONYWHITE", "M_M_MIDTOWN_1", "M_M_PBUSINESS_1", "M_M_PEASTEURO_1",
  90.         "M_M_PHARBRON_1", "M_M_PINDUS_2", "M_M_PITALIAN_1", "M_M_PITALIAN_2", "M_M_PLATIN_1", "M_M_PLATIN_2", "M_M_PLATIN_3", "M_M_PMANHAT_1",
  91.         "M_M_PMANHAT_2", "M_M_PORIENT_1", "M_M_PRICH_1", "M_O_EASTEURO_1", "M_O_HASID_1", "M_O_MOBSTER", "M_O_PEASTEURO_2", "M_O_PHARBRON_1",
  92.         "M_O_PJERSEY_1", "M_O_STREET_1", "M_O_SUITED", "M_Y_BOHO_1", "M_Y_BOHOGUY_1", "M_Y_BRONX_1", "M_Y_BUSINESS_1", "M_Y_BUSINESS_2",
  93.         "M_Y_CHINATOWN_3", "M_Y_CHOPSHOP_1", "M_Y_CHOPSHOP_2", "M_Y_DODGY_1", "M_Y_DORK_2", "M_Y_DOWNTOWN_1", "M_Y_DOWNTOWN_2", "M_Y_DOWNTOWN_3",
  94.         "M_Y_GAYYOUNG", "M_Y_GENSTREET11", "M_Y_GENSTREET16", "M_Y_GENSTREET20", "M_Y_GENSTREET34", "M_Y_HARDMAN_1", "M_Y_HARLEM_1", "M_Y_HARLEM_2",
  95.         "M_Y_HARLEM_4", "M_Y_HASID_1", "M_Y_LEASTSIDE_1", "M_Y_PBRONX_1", "M_Y_PCOOL_1", "M_Y_PCOOL_2", "M_Y_PEASTEURO_1", "M_Y_PHARBRON_1",
  96.         "M_Y_PHARLEM_1", "M_Y_PJERSEY_1", "M_Y_PLATIN_1", "M_Y_PLATIN_2", "M_Y_PLATIN_3", "M_Y_PMANHAT_1", "M_Y_PMANHAT_2", "M_Y_PORIENT_1",
  97.         "M_Y_PQUEENS_1", "M_Y_PRICH_1", "M_Y_PVILLBO_1", "M_Y_PVILLBO_2", "M_Y_PVILLBO_3", "M_Y_QUEENSBRIDG", "M_Y_SHADY_2", "M_Y_SKATEBIKE_1",
  98.         "M_Y_SOHO_1", "M_Y_STREET_1", "M_Y_STREET_3", "M_Y_STREET_4", "M_Y_STREETBLK_2", "M_Y_STREETBLK_3", "M_Y_STREETPUNK2", "M_Y_STREETPUNK4",
  99.         "M_Y_STREETPUNK5", "M_Y_TOUGH_5", "M_Y_TOURIST_2", "Vinny_Spaz", "Vlad"
  100.     ];
  101.    
  102.        
  103.     //User variables:
  104.     local spawnnumber = array(getPlayerSlots(), 0);
  105.     local status = array(getPlayerSlots(), 0);    //0  =  not logged in.       1 = logged in.  
  106.     local aLvl = array(getPlayerSlots(), 0);
  107.     local savedPos;
  108.     local skin = array(getPlayerSlots(), 4);
  109.     local muted = array(getPlayerSlots(), false);
  110.     local frozen = array(getPlayerSlots(), false);
  111.    
  112.    
  113.  
  114. ////Variables & colors////
  115. //////////////////////////
  116.  
  117.  
  118. function onScriptInit()
  119. {
  120.    
  121.     return 1;
  122. }
  123.  
  124. function onScriptExit()
  125. {
  126.     log("onScriptExit()");
  127.     return 1;
  128. }
  129.  
  130. function onConsoleInput(input)
  131. {
  132.  
  133.     log("onConsoleInput(" + input + ")");
  134.     sendMessageToAll(COLOR_GREEN,"Admin message from console: " + input);
  135.     return 1;
  136. }
  137.  
  138. function onPlayerConnect(playerid)
  139. {
  140.     log("onPlayerConnect(" + playerid + ")");
  141.     return 1;
  142. }
  143.  
  144. function onPlayerDisconnect(playerid, reason)
  145. {
  146.     log("onPlayerDisconnect(" + playerid + ", " + reason + ")");
  147.     return 1;
  148. }
  149.  
  150. function onPlayerSpawn(playerid)
  151. {
  152.     log("onPlayerSpawn(" + playerid + ")");
  153.     if (spawnnumber[playerid] == 0)
  154.     {
  155.         spawnnumber[playerid]++;
  156.         sendPlayerMessage(playerid, COLOR_NICEBLUE, "Welcome to Liberty Role play...");
  157.         setPlayerCoordinates(playerid, -32.000000, 24.606373, 14.195262);
  158.         setPlayerHeading(playerid, 90.330009);
  159.         togglePlayerControls(playerid, false);
  160.         local ini = EasyINI(pFileName(playerid));
  161.         if (fileExists(pFileName(playerid)) == false)
  162.         {
  163.             sendPlayerMessage(playerid, COLOR_GREEN, "Since this is the first time you enter this server, you must register before you can start playing.");
  164.             sendPlayerMessage(playerid, COLOR_GREEN, "In order to register please write the command [ /register ] and after the space write your password.");
  165.             sendPlayerMessage(playerid, COLOR_ORANGE, "For more information enter the command /Userhelp");
  166.             return 1;
  167.         }
  168.         if (ini.getKey("Userdata", "ip") == getPlayerIp(playerid))
  169.         {
  170.             loginPlayer(playerid, ini.getKey("Userdata", "password"));
  171.         }
  172.     }
  173.     setPlayerCoordinates(playerid, -32.000000, 24.606373, 14.195262);
  174.     setPlayerHeading(playerid, 90.330009);
  175.     return 1;
  176. }
  177.  
  178. function onPlayerDeath(playerid)
  179. {
  180.     log("onPlayerDeath(" + playerid + ")");
  181.     return 1;
  182. }
  183.  
  184. function onPlayerText(playerid, text)
  185. {
  186.     log("onPlayerText(" + playerid + ", " + text + ")");
  187.     return 1;
  188. }
  189.  
  190.  
  191. function onPlayerEnterVehicle(playerid, vehicleid, ispassenger, seatid)
  192. {
  193.     log("onPlayerEnterVehicle(" + playerid + ", " + vehicleid + ", " + ispassenger + ", " + seatid + ")");
  194.     return 1;
  195. }
  196.  
  197.  
  198.  
  199. function onPlayerCommand(playerid, command)
  200. {
  201.  
  202.     log("onPlayerCommand(" + playerid + ", " + command + ")");
  203.     local cmd = split(command.tolower()," ");
  204.     //////////Main COMMANDS START HERE
  205.     //////////Main COMMANDS START HERE
  206.     //////////Main COMMANDS START HERE
  207.     //////////Main COMMANDS START HERE
  208.    
  209.    
  210.    
  211.     if(cmd[0] == "/userhelp")
  212.     {
  213.         sendPlayerMessage(playerid,COLOR_DARKORANGE,"This server uses a user system in order to remember you.");
  214.         sendPlayerMessage(playerid, COLOR_DARKORANGE, "Every user has his own password and username.");
  215.         sendPlayerMessage(playerid, COLOR_DARKORANGE, "The first time you enter the server, if the nickname you use isn't already registered, then you");
  216.         sendPlayerMessage(playerid, COLOR_DARKORANGE, "will be asked to register with a password, once you've registered your nickname, all the details");
  217.         sendPlayerMessage(playerid, COLOR_DARKORANGE, "are saved and you will need to login with your password the next time you enter the server.");
  218.         sendPlayerMessage(playerid, COLOR_DARKORANGE, "If your IP hasn't changed since the last time you logged in, you will be logged in automatically without a password.");
  219.         sendPlayerMessage(playerid, COLOR_ORANGE, "In order to register write the command \"/Register [password]\" with your password (password is case-sensitive");
  220.         sendPlayerMessage(playerid, COLOR_ORANGE, "In order to login write the command \"/Login [password]\" with your password (password is case-sensitive");
  221.         return 0;
  222.     }
  223.    
  224.     //register
  225.     if (cmd[0] == "/register")
  226.     {
  227.         if (status[playerid] == 1) return sendPlayerMessage(playerid, COLOR_RED, "You are logged in, which means you are already registered.");
  228.         local password = command.slice(11, command.len());
  229.  
  230.         registerPlayer(playerid, password);
  231.         sendPlayerMessage(playerid,COLOR_DARKORANGE ,"You have registered successfuly, please remember your password, and you can now play.");
  232.         togglePlayerControls(playerid, true);
  233.         status[playerid] == 1;
  234.         return 0;
  235.     }
  236.    
  237.     //login
  238.     if (cmd[0] == "/login")
  239.     {
  240.         if (status[playerid] == 1) return sendPlayerMessage(playerid, COLOR_RED, "You are already logged in.");
  241.         local password = command.slice(11, command.len());
  242.         if ( between(password.len(),5,16,true) == false ) return sendPlayerMessage(playerid, COLOR_RED, "Your password cannot be longer than 16 or shorter than 5 letters.");
  243.         loginPlayer(playerid);
  244.        
  245.         return 0;
  246.     }
  247.    
  248.    
  249.     //////////NORMAL COMMANDS START HERE
  250.     //////////NORMAL COMMANDS START HERE
  251.     //////////NORMAL COMMANDS START HERE
  252.     //////////NORMAL COMMANDS START HERE
  253.  
  254.    
  255.     if (status[playerid] == 0) {
  256.          sendPlayerMessage(playerid, COLOR_RED, "You can't do any commands until you registered/logged in, you can only do the following commands:");
  257.          sendPlayerMessage(playerid, COLOR_RED, "/Userhelp - Help topics about the user system and the register and login commands.");
  258.          sendPlayerMessage(playerid, COLOR_RED, "/Register - Registering to the server.");
  259.          sendPlayerMessage(playerid, COLOR_RED, "/Login - Login with your password.");
  260.          return 0;
  261.     }
  262.    
  263.        
  264.     //help
  265.     if (cmd[0] == "/help")
  266.     {
  267.         sendPlayerMessage(playerid,COLOR_YELLOW,"Welcome to OmerT`s free stunting mode... the commands are:");
  268.         sendPlayerMessage(playerid,COLOR_GREEN,"/Help - Game mode help.");
  269.         sendPlayerMessage(playerid,COLOR_GREEN,"[/T]eleports - A list of places you can go to.");
  270.         sendPlayerMessage(playerid,COLOR_GREEN,"[/V]ehicle [ID/Name] - Telports a vehicle.");
  271.         sendPlayerMessage(playerid,COLOR_GREEN,"[/W]eapon [ID/Name] - Gives you a weapon.");
  272.         return 0;
  273.     }
  274.    
  275.     //vehicle
  276.     if (cmd[0] == "/vehicle" || cmd[0] == "/v")
  277.     {
  278.         if (!(1 in cmd)) return sendPlayerMessage(playerid,COLOR_DARKWHITE,"USAGE: [/Vehicle|/V] [Vehicle ID|Name].");
  279.         if (isNumeric(cmd[1]))
  280.         {
  281.             if (between(cmd[1].tointeger(),0,123,true) == false) return sendPlayerMessage(playerid,COLOR_RED,"You must enter a value between 0 and 123 inclusive.");
  282.             createVehicleNearPlayer(playerid, cmd[1].tointeger(), 0, 0 , 0 , 0);
  283.             sendPlayerMessage(playerid,COLOR_ORANGE,"Vehicle created. Name: " + VehicleNames[cmd[1].tointeger()] + " | ID: " + cmd[1] + "." );
  284.         }
  285.         else
  286.         {
  287.             local vehicleId =  getVehicleIdFromName(cmd[1]);
  288.             if (vehicleId == -1) return sendPlayerMessage(playerid,COLOR_RED,"ERROR: Can't find this vehicle.");
  289.             createVehicleNearPlayer(playerid, vehicleId, 0, 0, 0, 0);
  290.             sendPlayerMessage(playerid,COLOR_ORANGE,"Vehicle created. Name: " + VehicleNames[vehicleId] + " | ID: " + vehicleId + ".");    
  291.         }
  292.         return 0;
  293.     }
  294.     if (cmd[0] == "/stunt1")
  295.     {
  296.         setPlayerCoordinates(playerid, -32.000000, 24.606373, 14.195262);
  297.         setPlayerHeading(playerid, 90.330009);
  298.         return 0;
  299.     }
  300.     //Fix weather
  301.     if (cmd[0] == "/fixweather" || cmd[0] == "/fw")
  302.     {
  303.         //setPlayerWeather(playerid, 2);
  304.         setPlayerTime(playerid, 12, 0);
  305.         sendPlayerMessage(playerid, COLOR_ORANGE, "Sunny 12:00 has been set has your weather and time.");
  306.         return 0;
  307.     }
  308.     //skin
  309.     if (cmd[0] == "/skin")
  310.     {
  311.         if (!(1 in cmd)) return sendPlayerMessage(playerid,COLOR_DARKWHITE,"USAGE: /Skin [Skin ID|Name].");
  312.         if (isNumeric(cmd[1]))
  313.         {
  314.             if (between(cmd[1].tointeger(),4,345,true) == false) return sendPlayerMessage(playerid,COLOR_RED,"You must enter a value between 4 and 345 inclusive.");
  315.             setPlayerModel(playerid, getSkinIdFromName(cmd[1]));
  316.             sendPlayerMessage(playerid,COLOR_ORANGE,"Your skin has been changed. Name: " + skinsArray[cmd[1].tointeger()] + " | ID: " + cmd[1] + "." );
  317.         }
  318.         else
  319.         {
  320.             local skinId =  getSkinIdFromName(cmd[1]);
  321.             if (skinId == -1) return sendPlayerMessage(playerid,COLOR_RED,"ERROR: Can't find this skin.");
  322.             setPlayerModel(playerid, skinId);
  323.             sendPlayerMessage(playerid,COLOR_ORANGE,"Your has skin has been changed. Name: " + skinsArray[skinId] + " | ID: " + skinId + ".");     
  324.         }
  325.         return 0;
  326.     }
  327.        
  328.     //weapon
  329.     if (cmd[0] == "/weapon" || cmd[0] == "/w")
  330.     {
  331.         if (!(1 in cmd)) return sendPlayerMessage(playerid,COLOR_DARKWHITE,"USAGE: [/Weapon|/W] [Weapon ID|Name].");
  332.         if (isNumeric(cmd[1]))
  333.         {
  334.             if (between(cmd[1].tointeger(),1,17,true) == false) return sendPlayerMessage(playerid,COLOR_RED,"You must enter a value between 1 and 17 inclusive.");
  335.             if (cmd[1].tointeger() == 6) return sendPlayerMessage(playerid,COLOR_RED,"ERROR: Weapon 6 does not exist and will crash your game so it has been disabled.");
  336.             addPlayerWeapon(playerid, cmd[1].tointeger(), 1000);
  337.             sendPlayerMessage(playerid,COLOR_ORANGE,"You have recieved the weapon: Name - " + weaponsarray[cmd[1].tointeger()] + " | ID: " + cmd[1] + ".");
  338.         }
  339.         else
  340.         {
  341.             local weaponId = getWeaponIdFromName(cmd[1]);
  342.             if (weaponId == 6 || weaponId == -1) return sendPlayerMessage(playerid,COLOR_RED,"ERROR: This is an invalid name.");
  343.             addPlayerWeapon(playerid, weaponId, 1000);
  344.             sendPlayerMessage(playerid,COLOR_ORANGE,"You have recieved the weapon: Name - " + weaponsarray[weaponId] + " | ID: " + weaponId + ".");
  345.         }
  346.         return 0;
  347.     }
  348.     //////////ADMIN COMMANDS START HERE
  349.     //////////ADMIN COMMANDS START HERE
  350.     //////////ADMIN COMMANDS START HERE
  351.     //////////ADMIN COMMANDS START HERE
  352.    
  353.    
  354.     //if (cmd[0] == "/tele")
  355.     //{
  356.         //if (cmd[1] == "isl") setPlayerCoordinates(playerid,  674.718872, 1450.182983, 14.627093);
  357.         //if (cmd[1] == "stat") setPlayerCoordinates(playerid,  -603.908630, -750.358521, 52.80759);
  358.         //if (cmd[1] == "sol") setPlayerCoordinates(playerid,  -555.961304, -738.891602, 5.354599);
  359.         //return 0;
  360. //  }
  361.        
  362.        
  363.     //get
  364.     if (cmd[0] == "/get")
  365.     {
  366.         if (!(1 in cmd)) return sendPlayerMessage(playerid, COLOR_DARKWHITE, "USAGE: /Get [ID].");
  367.         if (!(isNumeric(cmd[1]))) return sendPlayerMessage(playerid, COLOR_DARKWHITE, "You must enter a number.");
  368.         if (!(isPlayerConnected(cmd[1].tointeger()))) return sendPlayerMessage(playerid, COLOR_DARKWHITE, "The player is not connected.");
  369.         local playerPos = getPlayerCoordinates(playerid);
  370.         setPlayerCoordinates(cmd[1].tointeger(), playerPos[0], playerPos[1] + 1, playerPos[2]);
  371.         sendPlayerMessage(playerid, COLOR_ORANGE, "You have teleported the player " + getPlayerName(cmd[1].tointeger()) + " (ID: " + cmd[1] + ") to your position.");
  372.         sendPlayerMessage(cmd[1].tointeger(), COLOR_ORANGE, "You have been teleported by the admin " + getPlayerName(playerid) + " (ID: " + playerid.tostring() + ") to his position.");
  373.         return 0;
  374.     }
  375.     //goto
  376.     if (cmd[0] == "/goto")
  377.     {
  378.         if (!(1 in cmd)) return sendPlayerMessage(playerid, COLOR_DARKWHITE, "USAGE: /Goto [ID].");
  379.         if (!(isNumeric(cmd[1]))) return sendPlayerMessage(playerid, COLOR_DARKWHITE, "You must enter a number.");
  380.         if (!(isPlayerConnected(cmd[1].tointeger()))) return sendPlayerMessage(playerid, COLOR_DARKWHITE, "The player is not connected.");
  381.         local playerPos = getPlayerCoordinates(cmd[1].tointeger());
  382.         setPlayerCoordinates(playerid, playerPos[0], playerPos[1] + 1, playerPos[2]);
  383.         sendPlayerMessage(playerid, COLOR_ORANGE, "You have teleported to the player " + getPlayerName(cmd[1].tointeger()) + " (ID: " + cmd[1] + ").");
  384.         sendPlayerMessage(cmd[1].tointeger(), COLOR_ORANGE, "The admin " + getPlayerName(playerid) + " (ID: " + playerid.tostring() + ") has teleported to your position.");
  385.         return 0;
  386.     }
  387.    
  388.     //kick
  389.     if (cmd[0] == "/kick")
  390.     {
  391.         if (!(1 in cmd)) return sendPlayerMessage(playerid, COLOR_DARKWHITE, "USAGE: /Kick [ID] [REASON]");
  392.         if (!(isNumeric(cmd[1]))) return sendPlayerMessage(playerid, COLOR_DARKWHITE, "The ID must be a number.");
  393.         if (!(isPlayerConnected(cmd[1].tointeger()))) return sendPlayerMessage(playerid, COLORWHITE, "The ID you wrote is not connected.");
  394.         log((cmd[0].len() + cmd[1].len()+ 2).tostring);
  395.         log(command.slice((cmd[0].len() + cmd[1].len()+ 2), command.len()));
  396.         log("The player " + getPlayerName(cmd[1].tointeger()) + " [ID: " + cmd[1] + "] was kicked by the admin " + getPlayerName(playerid) + " [ID: " + playerid.tostring() + "]. Reason: " + "no reason for me to do thats");
  397.         local reason = command.slice((cmd[0].len() + cmd[1].len()+ 2), command.len());
  398.         sendMessageToAll(COLOR_RED, "The player " + getPlayerName(cmd[1]) + " [ID: " + cmd[1] + "] was kicked by the admin " + getPlayerName(playerid) + " [ID: " + playerid.tostring() + "]. Reason: " + reason);
  399.         return 0;
  400.     }
  401.    
  402.     return sendPlayerMessage(playerid,COLOR_DARKWHITE, "This command does not exist. [" + command + "].") ;
  403. }
  404.  
  405.  
  406. function onPlayerCancelVehicleEntry(playerid, waspassenger)
  407. {
  408.     log("onPlayerCancelVehicleEntry(" + playerid + ", " + waspassenger + ")");
  409.     return 1;
  410. }
  411.  
  412. function onPlayerSelectSkin(playerid, skinid)
  413. {
  414.     log("onPlayerSelectSkin(" + playerid + ", " + skinid + ")");
  415.     return 1;
  416. }
  417.  
  418. function onVehicleCreate(vehicleid)
  419. {
  420.     log("onVehicleCreate(" + vehicleid + ")");
  421.     return 1;
  422. }
  423.  
  424. function onVehicleDelete(vehicleid)
  425. {
  426.     log("onVehicleDelete(" + vehicleid + ")");
  427.     return 1;
  428. }
  429.  
  430. function onObjectCreate(objectid)
  431. {
  432.     log("onObjectCreate(" + objectid + ")");
  433.     return 1;
  434. }
  435.  
  436. function onObjectDelete(objectid)
  437. {
  438.     log("onObjectDelete(" + objectid + ")");
  439.     return 1;
  440. }
  441. //////////////////////////////////////////////
  442. //           Variables and functions        //
  443. //     Variables and functions              //
  444. //   Variables and functions                //
  445. //         Variables and functions          //
  446. //        Variables and functions           //
  447. //            Variables and functions       //
  448. //        Variables and functions           //
  449. //          Variables and functions         //
  450. //          Variables and functions         //
  451. //////////////////////////////////////////////
  452.  
  453. //////////////Classes/////
  454. //////////////////////////
  455.  
  456. function pFileName(playerid)
  457. {
  458.     return ("modefiles/users/" + getPlayerName(playerid) + ".ini");
  459. }
  460.  
  461. function registerPlayer(playerid, password)
  462. {
  463.     fileCreate(pFileName(playerid));
  464.     local ini = EasyINI(pFileName(playerid));
  465.     ini.createSection("Userdata");
  466.     ini.createKey("Userdata", "ip", getPlayerIp(playerid));
  467.     ini.createKey("Userdata", "password", password);
  468.     ini.createKey("Userdata", "adminLvl", 0);
  469.     ini.createSection("Savedposes");
  470.     ini.saveData()
  471. }
  472.  
  473. function loginPlayer(playerid, inpassword)
  474. {
  475.  
  476.     local ini = EasyINI(pFileName(playerid));
  477.     local password = ini.getKey("Userdata", "password");
  478.     if (password != inpassword) return sendPlayerMessage(playerid, COLOR_RED, "Invalid password.");
  479.     status[playerid] = 1;
  480.     aLvl[playerid] = ini.getKey("Userdata", "adminLvl");
  481.     ini.setKey("Userdata", "ip", getPlayerIp(playerid));
  482.     togglePlayerControls(playerid, true);
  483.     sendPlayerMessage(playerid, COLOR_GREEN, "You have logged in successfuly.");
  484. }
  485.        
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507. //some useful functions
  508. function between(number,min,max,in_true__ex_false)
  509. {
  510.     switch (in_true__ex_false)
  511.     {
  512.         case true:
  513.         {
  514.             if (number >= min && number <= max)
  515.             {
  516.                 return true
  517.             }
  518.             else
  519.             {
  520.                 return false
  521.             }
  522.         }
  523.         case false:
  524.         {
  525.             if (number > min && number < max)
  526.             {
  527.                 return true
  528.             }
  529.             else
  530.             {
  531.                 return false
  532.             }
  533.         }
  534.     }
  535. }
  536. //////////////////////////
  537. function PlayerToPoint(radi, playerid, x, y, z)
  538. {
  539.     if(isPlayerConnected(playerid))
  540.     {
  541.         local oldposx, oldposy, oldposz;
  542.         local tempposx, tempposy, tempposz;
  543.         local oldpos = getPlayerCoordinates(playerid);
  544.         tempposx = (oldpos[0] -x);
  545.         tempposy = (oldpos[1] -y);
  546.         tempposz = (oldpos[2] -z);
  547.         if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  548.         {
  549.             return 1;
  550.         }
  551.    }
  552.    return 0;
  553. }
  554. //////////////////////////
  555. function createVehicleNearPlayer(playerid, vehicleid, color1, color2, color3, color4)
  556. {
  557.     local playerPosition = getPlayerCoordinates(playerid);
  558.     createVehicle(vehicleid,playerPosition[0], playerPosition[1] + 5, playerPosition[2], getPlayerHeading(playerid), color1, color2, color3, color4);
  559.     return 1;
  560. }
  561. //////////////////////////
  562. function getWeaponIdFromName(name) //Bad written
  563. {
  564.     local i = 0;
  565.     for (i = 0; i < weaponsarray.len(); i++)
  566.     {
  567.         local weaponname = weaponsarray[i].tolower();
  568.         local tofind = name.tolower();
  569.         local result = weaponname.find(tofind);
  570.         if (typeof(result) != null && typeof(result) == typeof(i))
  571.         {
  572.             return i;
  573.         }
  574.     }
  575.     return -1;
  576. }
  577. //////////////////////////
  578. function getVehicleIdFromName(name) //Bad written
  579. {
  580.     local i = 0;
  581.     for (i = 0; i < VehicleNames.len(); i++)
  582.     {
  583.         local vehiclename = VehicleNames[i].tolower();
  584.         local tofind = name.tolower();
  585.         local result = vehiclename.find(tofind);
  586.         if (typeof(result) != null && typeof(result) == typeof(i))
  587.         {
  588.             return i;
  589.         }
  590.     }
  591.     return -1;
  592. }
  593. //////////////////////////
  594.  
  595. //////////////////////////
  596. function getSkinIdFromName(name) //Bad written
  597. {
  598.     local i = 0;
  599.     for (i = 0; i < skinsArray.len(); i++)
  600.     {
  601.         local skinname = skinsArray[i].tolower();
  602.         local tofind = name.tolower();
  603.         local result = skinname.find(tofind);
  604.         if (typeof(result) != null && typeof(result) == typeof(i))
  605.         {
  606.             return i;
  607.         }
  608.     }
  609.     return -1;
  610. }
  611. //////////////////////////
  612. function any(val, ...)
  613. {
  614.     for(local i = 0; vargc - 1; i++)
  615.     {
  616.         if(vargv[i] = val)
  617.         {
  618.             return 1;
  619.         }
  620.     }
  621.     return 0;
  622. }
  623. //////////////////////////
  624. function isNumeric(string)
  625. {
  626.     try
  627.     {
  628.         string.tointeger()
  629.     }
  630.     catch(string)
  631.     {
  632.         return 0;
  633.     }
  634.     return 1;
  635. }
  636. //////////////////////////
  637. function returnUser(string)
  638. {
  639.     if(isNumeric(string) && isPlayerConnected(string.tointeger()))
  640.     {
  641.         return string.tointeger();
  642.     }
  643.     else
  644.     {
  645.         for(local i = 0; i < getPlayerSlots(); i++)
  646.         {
  647.             if(isPlayerConnected(i))
  648.             {
  649.                 if(getPlayerName(i).tolower() == string.tolower())
  650.                 {
  651.                     return i;
  652.                 }
  653.             }
  654.         }
  655.     }
  656.     return 0;
  657. }
  658. //////////////////////////
  659. function getWeaponName(id)
  660. {
  661.     return weaponsarray[id.tointeger()];
  662. }
  663. function random(min = 0,max = 0xFFFF)
  664. {
  665.     return (rand() % ((max + 1) - min)) + min;
  666. }
Advertisement
Add Comment
Please, Sign In to add comment