Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dofile("scripts/inifiles.nut");
- ////Variables & colors////
- //////////////////////////
- //colors:
- const COLOR_RED = 0xff0000ff;
- const COLOR_DARKRED = 0x610000ff;
- const COLOR_ORANGE = 0xff9000ff;
- const COLOR_DARKORANGE = 0xff5600ff;
- const COLOR_PINK = 0xff00ffff;
- const COLOR_YELLOW = 0xffff00ff;
- const COLOR_GREEN = 0x00ff00ff;
- const COLOR_DARKGREEN = 0x008100ff;
- const COLOR_BLACK = 0x000000ff;
- const COLOR_TRANSPARENT = 0xffffff00;
- const COLOR_BROWN = 0x7f4300ff;;
- const COLOR_BROWNGREEN = 0x7fa000ff;;
- const COLOR_BLUE = 0x0000ffff;
- const COLOR_DARKBLUE = 0x000069ff;;
- const COLOR_PURPLE = 0x940069ff;
- const COLOR_BRIGHTPURPLE = 0xff0069ff;
- const COLOR_CYAN = 0x00ffffff;
- const COLOR_DARKPINK = 0xe62dffff;
- const COLOR_DARKWHITE = 0xe6e0c4ff;
- const COLOR_LIMEGREEN = 0xe6ff00ff;
- const COLOR_NICEBLUE = 0x0087cbff;
- // END COLORS
- // CONSTANT VALUES:
- local VehicleNames =
- [
- "Admiral", "Airtug", "Ambulance", "Banshee", "Benson", "Biff", "Blista Compact", "Bobcat", "Boxville", "Buccaneer",
- "Burrito", "Burrito", "Bus", "Cabby", "Cavalcade", "Chavos", "Cognoscenti", "Comet", "Coquette",
- "DF8", "Dilettante", "Dukes", "E109", "Emperor", "Emperor", "Esperanto", "Faction", "FBI", "Feltzer",
- "Feroci", "Feroci", "Firetruck", "Flatbed", "Fortune", "Forklift", "Futo", "FXT", "Habanero", "Hakumai",
- "Huntley", "Infernus", "Ingot", "Intruder", "Landstalker", "Lokus", "Manana", "Marbella", "Merit", "Minivan",
- "Moonbeam", "MrTasty", "Mule", "Noose", "Nstockade", "Oracle", "Packer", "Patriot", "Perennial", "Perennial",
- "Peyote", "Phantom", "Pinnacle", "PMP600", "Police", "Police", "Polpatriot", "Pony", "Premier", "Pres", "Primo",
- "Pstockade", "Rancher", "Rebla", "Ripley", "Romero", "Rom", "Ruiner", "Sabre", "Sabre", "Sabre GT", "Schafter",
- "Sentinel", "Solair", "Speedo", "Stalion", "Steed", "Stockade", "Stratum", "Stretch", "Sultan", "Sultan RS",
- "Super GT", "Taxi", "Taxi", "Trash", "Turismo", "Uranus", "Vigero", "Vigero", "Vincent", "Virgo", "Voodoo",
- "Washington", "Willard", "Yankee", "Bobber", "Faggio", "Hellfury", "NRG900", "PCJ600", "Sanchez", "Zombieb",
- "Annihilator", "Maverick", "Polmav", "Tourmav", "Dinghy", "Jetmax", "Marquis", "Predator", "Reefer", "Squalo",
- "Tuga", "Tropic", "Cablecar", "Subway"
- ];
- local weaponsarray =
- [
- "Hand", "Baseball Bat", "Pool Cue", "Knife", "Grenade", "Molotov", "Invalidweapon", "Pistol", "Desert Eagle", "Shotgun", "Beretta", "Micro Uzi",
- "MP 5", "AK-47", "M4", "Sniper Rifle", "M40A1", "Rocket Launcher"
- ];
- local skinsArray =
- [
- "invalid", "invalid", "invalid", "invalid", "Anna_Faustin", "Anthony", "Badman", "Bernie_Crane", "Bledar_Morina", "Brian_Meech", "Brucie_Kibbutz", "Rodislav_Bulgarin", "Cherise_Glover",
- "IG_CHARLIEUC", "Clarence_Little", "IG_DARDAN", "Darko_Brevic", "Derrick_McReary", "Dimitri_Rascalov", "Dwayne_Forge", "Eddie_Low",
- "Mikhail_Faustin", "Francis_McReary", "French_Tom", "IG_GORDON", "Gracie_Ancelotti", "Hossan_Ramzy", "Ilyena_Faustin", "IG_ISAAC",
- "Ivan_Bytchkov", "IG_JAY", "IG_JASON", "Jeff", "Jimmy_Pegorino", "Johnny_Klebitz", "Kate_McReary", "Lenny_Petrovic",
- "Little_Jacob", "IG_LILJACOBW", "Luca", "Luis_Fernando_Lopez", "Mallorie_Bardas", "IG_MAMC", "Manny_Escuela", "Marnie_Allen",
- "Mel", "IG_MICHAEL", "Michelle", "IG_MICKEY", "Packie_McReary", "Pathos", "Kenny_Petrovic", "Phil_Bell",
- "Playboy_X", "Ray_Boccino", "Ricky_Gervais", "Roman_Bellic", "IG_ROMANW", "Sara", "Tuna", "M_Y_GAFR_LO_1",
- "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",
- "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",
- "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",
- "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",
- "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",
- "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",
- "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",
- "Stripper_1", "Stripper_2", "F_Y_WAITRESS_1", "Alcoholic", "Armoured", "M_M_BUSDRIVER", "M_M_CHINATOWN_1", "M_M_CRACKHEAD",
- "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",
- "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",
- "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",
- "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",
- "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",
- "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",
- "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",
- "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",
- "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",
- "M_Y_RUNNER", "M_Y_SHOPASST_1", "M_Y_STROOPER", "SWAT", "M_Y_SWORDSWALLO", "M_Y_THIEF", "M_Y_VALET", "M_Y_VENDOR",
- "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",
- "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",
- "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",
- "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",
- "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",
- "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",
- "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",
- "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",
- "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",
- "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",
- "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",
- "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",
- "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",
- "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",
- "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",
- "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",
- "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",
- "M_Y_STREETPUNK5", "M_Y_TOUGH_5", "M_Y_TOURIST_2", "Vinny_Spaz", "Vlad"
- ];
- //User variables:
- local spawnnumber = array(getPlayerSlots(), 0);
- local status = array(getPlayerSlots(), 0); //0 = not logged in. 1 = logged in.
- local aLvl = array(getPlayerSlots(), 0);
- local savedPos;
- local skin = array(getPlayerSlots(), 4);
- local muted = array(getPlayerSlots(), false);
- local frozen = array(getPlayerSlots(), false);
- ////Variables & colors////
- //////////////////////////
- function onScriptInit()
- {
- return 1;
- }
- function onScriptExit()
- {
- log("onScriptExit()");
- return 1;
- }
- function onConsoleInput(input)
- {
- log("onConsoleInput(" + input + ")");
- sendMessageToAll(COLOR_GREEN,"Admin message from console: " + input);
- return 1;
- }
- function onPlayerConnect(playerid)
- {
- log("onPlayerConnect(" + playerid + ")");
- return 1;
- }
- function onPlayerDisconnect(playerid, reason)
- {
- log("onPlayerDisconnect(" + playerid + ", " + reason + ")");
- return 1;
- }
- function onPlayerSpawn(playerid)
- {
- log("onPlayerSpawn(" + playerid + ")");
- if (spawnnumber[playerid] == 0)
- {
- spawnnumber[playerid]++;
- sendPlayerMessage(playerid, COLOR_NICEBLUE, "Welcome to Liberty Role play...");
- setPlayerCoordinates(playerid, -32.000000, 24.606373, 14.195262);
- setPlayerHeading(playerid, 90.330009);
- togglePlayerControls(playerid, false);
- local ini = EasyINI(pFileName(playerid));
- if (fileExists(pFileName(playerid)) == false)
- {
- sendPlayerMessage(playerid, COLOR_GREEN, "Since this is the first time you enter this server, you must register before you can start playing.");
- sendPlayerMessage(playerid, COLOR_GREEN, "In order to register please write the command [ /register ] and after the space write your password.");
- sendPlayerMessage(playerid, COLOR_ORANGE, "For more information enter the command /Userhelp");
- return 1;
- }
- if (ini.getKey("Userdata", "ip") == getPlayerIp(playerid))
- {
- loginPlayer(playerid, ini.getKey("Userdata", "password"));
- }
- }
- setPlayerCoordinates(playerid, -32.000000, 24.606373, 14.195262);
- setPlayerHeading(playerid, 90.330009);
- return 1;
- }
- function onPlayerDeath(playerid)
- {
- log("onPlayerDeath(" + playerid + ")");
- return 1;
- }
- function onPlayerText(playerid, text)
- {
- log("onPlayerText(" + playerid + ", " + text + ")");
- return 1;
- }
- function onPlayerEnterVehicle(playerid, vehicleid, ispassenger, seatid)
- {
- log("onPlayerEnterVehicle(" + playerid + ", " + vehicleid + ", " + ispassenger + ", " + seatid + ")");
- return 1;
- }
- function onPlayerCommand(playerid, command)
- {
- log("onPlayerCommand(" + playerid + ", " + command + ")");
- local cmd = split(command.tolower()," ");
- //////////Main COMMANDS START HERE
- //////////Main COMMANDS START HERE
- //////////Main COMMANDS START HERE
- //////////Main COMMANDS START HERE
- if(cmd[0] == "/userhelp")
- {
- sendPlayerMessage(playerid,COLOR_DARKORANGE,"This server uses a user system in order to remember you.");
- sendPlayerMessage(playerid, COLOR_DARKORANGE, "Every user has his own password and username.");
- sendPlayerMessage(playerid, COLOR_DARKORANGE, "The first time you enter the server, if the nickname you use isn't already registered, then you");
- sendPlayerMessage(playerid, COLOR_DARKORANGE, "will be asked to register with a password, once you've registered your nickname, all the details");
- sendPlayerMessage(playerid, COLOR_DARKORANGE, "are saved and you will need to login with your password the next time you enter the server.");
- 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.");
- sendPlayerMessage(playerid, COLOR_ORANGE, "In order to register write the command \"/Register [password]\" with your password (password is case-sensitive");
- sendPlayerMessage(playerid, COLOR_ORANGE, "In order to login write the command \"/Login [password]\" with your password (password is case-sensitive");
- return 0;
- }
- //register
- if (cmd[0] == "/register")
- {
- if (status[playerid] == 1) return sendPlayerMessage(playerid, COLOR_RED, "You are logged in, which means you are already registered.");
- local password = command.slice(11, command.len());
- registerPlayer(playerid, password);
- sendPlayerMessage(playerid,COLOR_DARKORANGE ,"You have registered successfuly, please remember your password, and you can now play.");
- togglePlayerControls(playerid, true);
- status[playerid] == 1;
- return 0;
- }
- //login
- if (cmd[0] == "/login")
- {
- if (status[playerid] == 1) return sendPlayerMessage(playerid, COLOR_RED, "You are already logged in.");
- local password = command.slice(11, command.len());
- 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.");
- loginPlayer(playerid);
- return 0;
- }
- //////////NORMAL COMMANDS START HERE
- //////////NORMAL COMMANDS START HERE
- //////////NORMAL COMMANDS START HERE
- //////////NORMAL COMMANDS START HERE
- if (status[playerid] == 0) {
- sendPlayerMessage(playerid, COLOR_RED, "You can't do any commands until you registered/logged in, you can only do the following commands:");
- sendPlayerMessage(playerid, COLOR_RED, "/Userhelp - Help topics about the user system and the register and login commands.");
- sendPlayerMessage(playerid, COLOR_RED, "/Register - Registering to the server.");
- sendPlayerMessage(playerid, COLOR_RED, "/Login - Login with your password.");
- return 0;
- }
- //help
- if (cmd[0] == "/help")
- {
- sendPlayerMessage(playerid,COLOR_YELLOW,"Welcome to OmerT`s free stunting mode... the commands are:");
- sendPlayerMessage(playerid,COLOR_GREEN,"/Help - Game mode help.");
- sendPlayerMessage(playerid,COLOR_GREEN,"[/T]eleports - A list of places you can go to.");
- sendPlayerMessage(playerid,COLOR_GREEN,"[/V]ehicle [ID/Name] - Telports a vehicle.");
- sendPlayerMessage(playerid,COLOR_GREEN,"[/W]eapon [ID/Name] - Gives you a weapon.");
- return 0;
- }
- //vehicle
- if (cmd[0] == "/vehicle" || cmd[0] == "/v")
- {
- if (!(1 in cmd)) return sendPlayerMessage(playerid,COLOR_DARKWHITE,"USAGE: [/Vehicle|/V] [Vehicle ID|Name].");
- if (isNumeric(cmd[1]))
- {
- if (between(cmd[1].tointeger(),0,123,true) == false) return sendPlayerMessage(playerid,COLOR_RED,"You must enter a value between 0 and 123 inclusive.");
- createVehicleNearPlayer(playerid, cmd[1].tointeger(), 0, 0 , 0 , 0);
- sendPlayerMessage(playerid,COLOR_ORANGE,"Vehicle created. Name: " + VehicleNames[cmd[1].tointeger()] + " | ID: " + cmd[1] + "." );
- }
- else
- {
- local vehicleId = getVehicleIdFromName(cmd[1]);
- if (vehicleId == -1) return sendPlayerMessage(playerid,COLOR_RED,"ERROR: Can't find this vehicle.");
- createVehicleNearPlayer(playerid, vehicleId, 0, 0, 0, 0);
- sendPlayerMessage(playerid,COLOR_ORANGE,"Vehicle created. Name: " + VehicleNames[vehicleId] + " | ID: " + vehicleId + ".");
- }
- return 0;
- }
- if (cmd[0] == "/stunt1")
- {
- setPlayerCoordinates(playerid, -32.000000, 24.606373, 14.195262);
- setPlayerHeading(playerid, 90.330009);
- return 0;
- }
- //Fix weather
- if (cmd[0] == "/fixweather" || cmd[0] == "/fw")
- {
- //setPlayerWeather(playerid, 2);
- setPlayerTime(playerid, 12, 0);
- sendPlayerMessage(playerid, COLOR_ORANGE, "Sunny 12:00 has been set has your weather and time.");
- return 0;
- }
- //skin
- if (cmd[0] == "/skin")
- {
- if (!(1 in cmd)) return sendPlayerMessage(playerid,COLOR_DARKWHITE,"USAGE: /Skin [Skin ID|Name].");
- if (isNumeric(cmd[1]))
- {
- if (between(cmd[1].tointeger(),4,345,true) == false) return sendPlayerMessage(playerid,COLOR_RED,"You must enter a value between 4 and 345 inclusive.");
- setPlayerModel(playerid, getSkinIdFromName(cmd[1]));
- sendPlayerMessage(playerid,COLOR_ORANGE,"Your skin has been changed. Name: " + skinsArray[cmd[1].tointeger()] + " | ID: " + cmd[1] + "." );
- }
- else
- {
- local skinId = getSkinIdFromName(cmd[1]);
- if (skinId == -1) return sendPlayerMessage(playerid,COLOR_RED,"ERROR: Can't find this skin.");
- setPlayerModel(playerid, skinId);
- sendPlayerMessage(playerid,COLOR_ORANGE,"Your has skin has been changed. Name: " + skinsArray[skinId] + " | ID: " + skinId + ".");
- }
- return 0;
- }
- //weapon
- if (cmd[0] == "/weapon" || cmd[0] == "/w")
- {
- if (!(1 in cmd)) return sendPlayerMessage(playerid,COLOR_DARKWHITE,"USAGE: [/Weapon|/W] [Weapon ID|Name].");
- if (isNumeric(cmd[1]))
- {
- if (between(cmd[1].tointeger(),1,17,true) == false) return sendPlayerMessage(playerid,COLOR_RED,"You must enter a value between 1 and 17 inclusive.");
- 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.");
- addPlayerWeapon(playerid, cmd[1].tointeger(), 1000);
- sendPlayerMessage(playerid,COLOR_ORANGE,"You have recieved the weapon: Name - " + weaponsarray[cmd[1].tointeger()] + " | ID: " + cmd[1] + ".");
- }
- else
- {
- local weaponId = getWeaponIdFromName(cmd[1]);
- if (weaponId == 6 || weaponId == -1) return sendPlayerMessage(playerid,COLOR_RED,"ERROR: This is an invalid name.");
- addPlayerWeapon(playerid, weaponId, 1000);
- sendPlayerMessage(playerid,COLOR_ORANGE,"You have recieved the weapon: Name - " + weaponsarray[weaponId] + " | ID: " + weaponId + ".");
- }
- return 0;
- }
- //////////ADMIN COMMANDS START HERE
- //////////ADMIN COMMANDS START HERE
- //////////ADMIN COMMANDS START HERE
- //////////ADMIN COMMANDS START HERE
- //if (cmd[0] == "/tele")
- //{
- //if (cmd[1] == "isl") setPlayerCoordinates(playerid, 674.718872, 1450.182983, 14.627093);
- //if (cmd[1] == "stat") setPlayerCoordinates(playerid, -603.908630, -750.358521, 52.80759);
- //if (cmd[1] == "sol") setPlayerCoordinates(playerid, -555.961304, -738.891602, 5.354599);
- //return 0;
- // }
- //get
- if (cmd[0] == "/get")
- {
- if (!(1 in cmd)) return sendPlayerMessage(playerid, COLOR_DARKWHITE, "USAGE: /Get [ID].");
- if (!(isNumeric(cmd[1]))) return sendPlayerMessage(playerid, COLOR_DARKWHITE, "You must enter a number.");
- if (!(isPlayerConnected(cmd[1].tointeger()))) return sendPlayerMessage(playerid, COLOR_DARKWHITE, "The player is not connected.");
- local playerPos = getPlayerCoordinates(playerid);
- setPlayerCoordinates(cmd[1].tointeger(), playerPos[0], playerPos[1] + 1, playerPos[2]);
- sendPlayerMessage(playerid, COLOR_ORANGE, "You have teleported the player " + getPlayerName(cmd[1].tointeger()) + " (ID: " + cmd[1] + ") to your position.");
- sendPlayerMessage(cmd[1].tointeger(), COLOR_ORANGE, "You have been teleported by the admin " + getPlayerName(playerid) + " (ID: " + playerid.tostring() + ") to his position.");
- return 0;
- }
- //goto
- if (cmd[0] == "/goto")
- {
- if (!(1 in cmd)) return sendPlayerMessage(playerid, COLOR_DARKWHITE, "USAGE: /Goto [ID].");
- if (!(isNumeric(cmd[1]))) return sendPlayerMessage(playerid, COLOR_DARKWHITE, "You must enter a number.");
- if (!(isPlayerConnected(cmd[1].tointeger()))) return sendPlayerMessage(playerid, COLOR_DARKWHITE, "The player is not connected.");
- local playerPos = getPlayerCoordinates(cmd[1].tointeger());
- setPlayerCoordinates(playerid, playerPos[0], playerPos[1] + 1, playerPos[2]);
- sendPlayerMessage(playerid, COLOR_ORANGE, "You have teleported to the player " + getPlayerName(cmd[1].tointeger()) + " (ID: " + cmd[1] + ").");
- sendPlayerMessage(cmd[1].tointeger(), COLOR_ORANGE, "The admin " + getPlayerName(playerid) + " (ID: " + playerid.tostring() + ") has teleported to your position.");
- return 0;
- }
- //kick
- if (cmd[0] == "/kick")
- {
- if (!(1 in cmd)) return sendPlayerMessage(playerid, COLOR_DARKWHITE, "USAGE: /Kick [ID] [REASON]");
- if (!(isNumeric(cmd[1]))) return sendPlayerMessage(playerid, COLOR_DARKWHITE, "The ID must be a number.");
- if (!(isPlayerConnected(cmd[1].tointeger()))) return sendPlayerMessage(playerid, COLORWHITE, "The ID you wrote is not connected.");
- log((cmd[0].len() + cmd[1].len()+ 2).tostring);
- log(command.slice((cmd[0].len() + cmd[1].len()+ 2), command.len()));
- 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");
- local reason = command.slice((cmd[0].len() + cmd[1].len()+ 2), command.len());
- sendMessageToAll(COLOR_RED, "The player " + getPlayerName(cmd[1]) + " [ID: " + cmd[1] + "] was kicked by the admin " + getPlayerName(playerid) + " [ID: " + playerid.tostring() + "]. Reason: " + reason);
- return 0;
- }
- return sendPlayerMessage(playerid,COLOR_DARKWHITE, "This command does not exist. [" + command + "].") ;
- }
- function onPlayerCancelVehicleEntry(playerid, waspassenger)
- {
- log("onPlayerCancelVehicleEntry(" + playerid + ", " + waspassenger + ")");
- return 1;
- }
- function onPlayerSelectSkin(playerid, skinid)
- {
- log("onPlayerSelectSkin(" + playerid + ", " + skinid + ")");
- return 1;
- }
- function onVehicleCreate(vehicleid)
- {
- log("onVehicleCreate(" + vehicleid + ")");
- return 1;
- }
- function onVehicleDelete(vehicleid)
- {
- log("onVehicleDelete(" + vehicleid + ")");
- return 1;
- }
- function onObjectCreate(objectid)
- {
- log("onObjectCreate(" + objectid + ")");
- return 1;
- }
- function onObjectDelete(objectid)
- {
- log("onObjectDelete(" + objectid + ")");
- return 1;
- }
- //////////////////////////////////////////////
- // Variables and functions //
- // Variables and functions //
- // Variables and functions //
- // Variables and functions //
- // Variables and functions //
- // Variables and functions //
- // Variables and functions //
- // Variables and functions //
- // Variables and functions //
- //////////////////////////////////////////////
- //////////////Classes/////
- //////////////////////////
- function pFileName(playerid)
- {
- return ("modefiles/users/" + getPlayerName(playerid) + ".ini");
- }
- function registerPlayer(playerid, password)
- {
- fileCreate(pFileName(playerid));
- local ini = EasyINI(pFileName(playerid));
- ini.createSection("Userdata");
- ini.createKey("Userdata", "ip", getPlayerIp(playerid));
- ini.createKey("Userdata", "password", password);
- ini.createKey("Userdata", "adminLvl", 0);
- ini.createSection("Savedposes");
- ini.saveData()
- }
- function loginPlayer(playerid, inpassword)
- {
- local ini = EasyINI(pFileName(playerid));
- local password = ini.getKey("Userdata", "password");
- if (password != inpassword) return sendPlayerMessage(playerid, COLOR_RED, "Invalid password.");
- status[playerid] = 1;
- aLvl[playerid] = ini.getKey("Userdata", "adminLvl");
- ini.setKey("Userdata", "ip", getPlayerIp(playerid));
- togglePlayerControls(playerid, true);
- sendPlayerMessage(playerid, COLOR_GREEN, "You have logged in successfuly.");
- }
- //some useful functions
- function between(number,min,max,in_true__ex_false)
- {
- switch (in_true__ex_false)
- {
- case true:
- {
- if (number >= min && number <= max)
- {
- return true
- }
- else
- {
- return false
- }
- }
- case false:
- {
- if (number > min && number < max)
- {
- return true
- }
- else
- {
- return false
- }
- }
- }
- }
- //////////////////////////
- function PlayerToPoint(radi, playerid, x, y, z)
- {
- if(isPlayerConnected(playerid))
- {
- local oldposx, oldposy, oldposz;
- local tempposx, tempposy, tempposz;
- local oldpos = getPlayerCoordinates(playerid);
- tempposx = (oldpos[0] -x);
- tempposy = (oldpos[1] -y);
- tempposz = (oldpos[2] -z);
- if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- return 1;
- }
- }
- return 0;
- }
- //////////////////////////
- function createVehicleNearPlayer(playerid, vehicleid, color1, color2, color3, color4)
- {
- local playerPosition = getPlayerCoordinates(playerid);
- createVehicle(vehicleid,playerPosition[0], playerPosition[1] + 5, playerPosition[2], getPlayerHeading(playerid), color1, color2, color3, color4);
- return 1;
- }
- //////////////////////////
- function getWeaponIdFromName(name) //Bad written
- {
- local i = 0;
- for (i = 0; i < weaponsarray.len(); i++)
- {
- local weaponname = weaponsarray[i].tolower();
- local tofind = name.tolower();
- local result = weaponname.find(tofind);
- if (typeof(result) != null && typeof(result) == typeof(i))
- {
- return i;
- }
- }
- return -1;
- }
- //////////////////////////
- function getVehicleIdFromName(name) //Bad written
- {
- local i = 0;
- for (i = 0; i < VehicleNames.len(); i++)
- {
- local vehiclename = VehicleNames[i].tolower();
- local tofind = name.tolower();
- local result = vehiclename.find(tofind);
- if (typeof(result) != null && typeof(result) == typeof(i))
- {
- return i;
- }
- }
- return -1;
- }
- //////////////////////////
- //////////////////////////
- function getSkinIdFromName(name) //Bad written
- {
- local i = 0;
- for (i = 0; i < skinsArray.len(); i++)
- {
- local skinname = skinsArray[i].tolower();
- local tofind = name.tolower();
- local result = skinname.find(tofind);
- if (typeof(result) != null && typeof(result) == typeof(i))
- {
- return i;
- }
- }
- return -1;
- }
- //////////////////////////
- function any(val, ...)
- {
- for(local i = 0; vargc - 1; i++)
- {
- if(vargv[i] = val)
- {
- return 1;
- }
- }
- return 0;
- }
- //////////////////////////
- function isNumeric(string)
- {
- try
- {
- string.tointeger()
- }
- catch(string)
- {
- return 0;
- }
- return 1;
- }
- //////////////////////////
- function returnUser(string)
- {
- if(isNumeric(string) && isPlayerConnected(string.tointeger()))
- {
- return string.tointeger();
- }
- else
- {
- for(local i = 0; i < getPlayerSlots(); i++)
- {
- if(isPlayerConnected(i))
- {
- if(getPlayerName(i).tolower() == string.tolower())
- {
- return i;
- }
- }
- }
- }
- return 0;
- }
- //////////////////////////
- function getWeaponName(id)
- {
- return weaponsarray[id.tointeger()];
- }
- function random(min = 0,max = 0xFFFF)
- {
- return (rand() % ((max + 1) - min)) + min;
- }
Advertisement
Add Comment
Please, Sign In to add comment