Advertisement
Guest User

roleplay

a guest
Sep 2nd, 2014
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 147.52 KB | None | 0 0
  1.     #include <a_samp>
  2.     #include <sscanf2>
  3.     #include <mSelection>
  4.     #include <YSI\y_ini>
  5.     #include <zcmd>
  6.  
  7.     native WP_Hash(buffer[], len, const str[]);
  8.  
  9.     #define MAX_FACTIONS                    10
  10.     #define MAX_HOUSES                      100
  11.     #define MAX_BIZZES                      100
  12.     #define MAX_LABELS                      1000
  13.  
  14.     #define dialog_Register                         1
  15.     #define dialog_Login                            2
  16.     #define dialog_DealershipConfirm        3
  17.     #define dialog_Buy                              4
  18.  
  19.     #define mselection_Dealership                   10
  20.  
  21.     main()
  22.     {
  23.             print("\n=-=-=-=-=-=-=-=-=-=-=-=-=");
  24.             print("=-=  Loading systems  =-=");
  25.             print("=-=-=-=-=-=-=-=-=-=-=-=-=\n");
  26.  
  27.             LoadFactions();
  28.             LoadVehicles();
  29.             LoadBizzes();
  30.             LoadHouses();
  31.             LoadLabels();
  32.  
  33.             print("\n=-=-=-=-=-=-=-=-=-=-=-=-=");
  34.             print("=-= Loading finished! =-=");
  35.             print("=-=-=-=-=-=-=-=-=-=-=-=-=\n");
  36.     }
  37.  
  38.     enum PlayerInfo
  39.     {
  40.         Pass[129],
  41.         Admin,
  42.         Helper,
  43.             Level,
  44.             Exp,
  45.             ExpLeft,
  46.  
  47.         FactionID,
  48.         FactionTier,
  49.         FactionRank[24],
  50.  
  51.         HouseOwner,
  52.         CarOwner,
  53.         BizOwner,
  54.  
  55.             Weapon1,
  56.             Weapon1Ammo,
  57.             Weapon2,
  58.             Weapon2Ammo,
  59.             Weapon3,
  60.             Weapon3Ammo,
  61.  
  62.             HandMoney,
  63.             BankMoney,
  64.  
  65.             Phone,
  66.             PhoneNumber,
  67.             Mask,
  68.             MaskNumber,
  69.             SkinID,
  70.     }
  71.  
  72.     enum VehicleInfo
  73.     {
  74.             ID,
  75.             Type, // 0 = playerowned, 1 = faction, 2 = rent car
  76.             Owner[MAX_PLAYER_NAME],
  77.             Model,
  78.  
  79.             Float: xPos,
  80.             Float: yPos,
  81.             Float: zPos,
  82.             Float: aPos,
  83.  
  84.             ColorA,
  85.             ColorB,
  86.  
  87.             Faction,
  88.             Plate,
  89.             Price,
  90.             Fuel,
  91.  
  92.             StoredSlot1,
  93.             StoredSlot1Ammo,
  94.             StoredSlot2,
  95.             StoredSlot2Ammo,
  96.     }
  97.  
  98.     enum HouseInfo
  99.     {
  100.             ID,
  101.             Owner[MAX_PLAYER_NAME],
  102.  
  103.             Price,
  104.             Bought,
  105.  
  106.             Float: ExtX,
  107.             Float: ExtY,
  108.             Float: ExtZ,
  109.  
  110.             Float: IntX,
  111.             Float: IntY,
  112.             Float: IntZ,
  113.  
  114.             IntInterior,
  115.             IntVirtualW,
  116.             World,
  117.             Interior,
  118.  
  119.             Locked,
  120.             Initialised,
  121.             Text3D: Label
  122.     }
  123.  
  124.     enum LabelInfo
  125.     {
  126.             ID,
  127.             Type,
  128.             Text[40],
  129.  
  130.             Float: xPos,
  131.             Float: yPos,
  132.             Float: zPos,
  133.  
  134.             Float: Radius,
  135.             VirtualWorld,
  136.     }
  137.  
  138.     enum BusinessInfo
  139.     {
  140.             ID,
  141.             Name[40],
  142.             Owner[MAX_PLAYER_NAME],
  143.  
  144.             Price,
  145.             Bought,
  146.  
  147.             Float: ExtX,
  148.             Float: ExtY,
  149.             Float: ExtZ,
  150.  
  151.             Float: IntX,
  152.             Float: IntY,
  153.             Float: IntZ,
  154.  
  155.             IntInterior,
  156.             IntVirtualW,
  157.             World,
  158.             Interior,
  159.  
  160.             Locked,
  161.             Initialised,
  162.             Text3D: Label
  163.     }
  164.  
  165.     enum FactionInfo
  166.     {
  167.             ID,
  168.             Name[40],
  169.             Type // 0 = general, 1 = radio access (lspd/lsfd?)
  170.     }
  171.  
  172.     new VehicleNames[][] =
  173.     {
  174.         "Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel",
  175.         "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
  176.         "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
  177.         "Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection",
  178.         "Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus",
  179.         "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie",
  180.         "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral",
  181.         "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder",
  182.         "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair", "Berkley's RC Van",
  183.         "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider", "Glendale",
  184.         "Oceanic","Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy",
  185.         "Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina", "Comet", "BMX",
  186.         "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper",
  187.         "Rancher", "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking",
  188.         "Blista Compact", "Police Maverick", "Boxville", "Benson", "Mesa", "RC Goblin",
  189.         "Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher", "Super GT",
  190.         "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster", "Stunt",
  191.         "Tanker", "Roadtrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra",
  192.         "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune",
  193.         "Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer",
  194.         "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent",
  195.         "Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder", "Primo",
  196.         "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite",
  197.         "Windsor", "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratium",
  198.         "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
  199.         "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper",
  200.         "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400",
  201.         "News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
  202.         "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car",
  203.         "Police Car", "Police Car", "Police Ranger", "Picador", "S.W.A.T", "Alpha",
  204.         "Phoenix", "Glendale", "Sadler", "Luggage", "Luggage", "Stairs", "Boxville",
  205.         "Tiller", "Utility Trailer"
  206.     };
  207.  
  208.     new PriceArray[][] =
  209.     {
  210.             {475, 30000},
  211.             {542, 30000},
  212.             {575, 30000},
  213.             {518, 30000},
  214.  
  215.             {535, 45000},
  216.             {536, 45000},
  217.             {540, 45000},
  218.             {507, 45000},
  219.             {546, 45000},
  220.             {547, 45000},
  221.             {551, 45000},
  222.             {585, 45000},
  223.             {405, 45000},
  224.             {412, 45000},
  225.             {496, 45000},
  226.             {458, 45000},
  227.             {404, 45000},
  228.             {589, 45000},
  229.  
  230.             {421, 50000},
  231.             {426, 50000},
  232.             {580, 50000},
  233.             {533, 50000},
  234.             {567, 50000},
  235.             {576, 50000},
  236.             {566, 50000},
  237.             {517, 50000},
  238.             {600, 50000},
  239.  
  240.             {489, 60000},
  241.             {579, 60000},
  242.             {400, 60000},
  243.             {579, 60000},
  244.  
  245.             {402, 75000},
  246.             {562, 75000},
  247.             {565, 75000},
  248.             {560, 75000},
  249.             {559, 75000}
  250.     };
  251.  
  252.     // Enumerator Variables:
  253.     new pInfo[MAX_PLAYERS][PlayerInfo];
  254.     new fInfo[MAX_FACTIONS][FactionInfo];
  255.     new vInfo[MAX_VEHICLES][VehicleInfo];
  256.     new bInfo[MAX_BIZZES][BusinessInfo];
  257.     new hInfo[MAX_HOUSES][HouseInfo];
  258.     new lInfo[MAX_LABELS][LabelInfo];
  259.  
  260.     // Multiplication Variables
  261.     new bCount;
  262.     new fCount;
  263.     new vCount = 1;
  264.     new hCount;
  265.     new lCount;
  266.  
  267.     // Phone Variables
  268.     new bool: pOnCall[MAX_PLAYERS];
  269.     new bool: pIsCalled[MAX_PLAYERS];
  270.     new pCalling[MAX_PLAYERS];
  271.     new pPhoneStatus[MAX_PLAYERS] = true;
  272.  
  273.     // Alternate Variables
  274.     new bool: fChat[MAX_FACTIONS] = true;
  275.     new bool: Logged[MAX_PLAYERS];
  276.     new bool: pMasked[MAX_PLAYERS];
  277.     new pOldBalance[MAX_PLAYERS];
  278.     new Text3D: Holder[MAX_LABELS];
  279.     new WorldTime; // time handler
  280.     new skinlist = mS_INVALID_LISTID;
  281.  
  282.     // Deathmode Variables
  283.     new bool: pDeath[MAX_PLAYERS];
  284.     new pDeathTimer[MAX_PLAYERS];
  285.     new pDeathTimerTick[MAX_PLAYERS];
  286.  
  287.     // Vehicle Variables:
  288.     new bool: vEngine[MAX_VEHICLES];
  289.     new bool: vLocked[MAX_VEHICLES];
  290.     new bool: vHood[MAX_VEHICLES];
  291.     new bool: vTrunk[MAX_VEHICLES];
  292.  
  293.     // Fuel System:
  294.     new FuelTimer[MAX_VEHICLES];
  295.     new FillingTimer[MAX_PLAYERS];
  296.  
  297.     // Dealership Variables
  298.     new pBuyingCar[MAX_PLAYERS];
  299.     new pBuyingCarModel[MAX_PLAYERS];
  300.     new Float: pDlOldPos[MAX_PLAYERS][3];
  301.  
  302.     // Textdraws
  303.     new PlayerText: vSpeedTD[MAX_PLAYERS];
  304.     new PlayerText: vSpeedTDText[MAX_PLAYERS];
  305.     new PlayerText: vFuelTD[MAX_PLAYERS];
  306.     new PlayerText: vFuelTDText[MAX_PLAYERS];
  307.  
  308.    
  309.  
  310.     public OnGameModeInit()
  311.     {
  312.             SetGameModeText("Basic Roleplay");
  313.             SendRconCommand("mapname Los Santos");
  314.             skinlist = LoadModelSelectionMenu("skins.txt");
  315.  
  316.             SetWeather(3); // inb4 weatherhandler
  317.             SetWorldTime(random(23));
  318.             SetTimer("TimeHandler", 3600000, true); // 1 hour
  319.  
  320.             DisableInteriorEnterExits();
  321.             ShowPlayerMarkers(PLAYER_MARKERS_MODE_OFF);
  322.             EnableStuntBonusForAll(false);
  323.             DisableNameTagLOS();
  324.  
  325.             return true;
  326.     }
  327.  
  328.     public OnGameModeExit()
  329.     {
  330.             SaveFactions();
  331.             SaveVehicles();
  332.             SaveHouses();
  333.             SaveLabels();
  334.             SaveBizzes();
  335.  
  336.             return true;
  337.     }
  338.  
  339.     public OnPlayerConnect(playerid)
  340.     {
  341.         new name[MAX_PLAYER_NAME];
  342.         GetPlayerName(playerid, name, sizeof(name));
  343.  
  344.         LoadVehicleSpeedoTextdraws(playerid);
  345.         TogglePlayerSpectating(playerid, true);
  346.  
  347.         if(fexist(Path(playerid)))
  348.         {
  349.             INI_ParseFile(Path(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid);
  350.             ShowPlayerDialog(playerid, dialog_Login, DIALOG_STYLE_PASSWORD, "Authenticate", "Please enter a password below in order to log in.", "Login", "Quit");
  351.         }
  352.  
  353.         else return ShowPlayerDialog(playerid, dialog_Register, DIALOG_STYLE_INPUT, "Authenticate", "Please enter a password below in order to register.", "Register", "Quit");
  354.  
  355.         return true;
  356.     }
  357.  
  358.  
  359.     public OnPlayerDisconnect(playerid, reason)
  360.     {
  361.             SetPlayerColor(playerid, 0xA3A3A3FF);
  362.  
  363.             PlayerTextDrawDestroy(playerid, vSpeedTD[playerid]);
  364.             PlayerTextDrawDestroy(playerid, vSpeedTDText[playerid]);
  365.             PlayerTextDrawDestroy(playerid, vFuelTD[playerid]);
  366.             PlayerTextDrawDestroy(playerid, vFuelTDText[playerid]);
  367.  
  368.             if(Logged[playerid]) return SavePlayer(playerid);
  369.  
  370.             return true;
  371.     }
  372.     public OnPlayerRequestClass(playerid, classid) return SpawnPlayer(playerid);
  373.     public OnPlayerRequestSpawn(playerid) return SpawnPlayer(playerid);
  374.  
  375.     public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  376.     {
  377.             new hashpass[129], sHolder[MAX_PLAYER_NAME];
  378.  
  379.             if(dialogid == dialog_Register)
  380.         {
  381.             if(!response) return Kick(playerid);
  382.  
  383.             if(response)
  384.             {
  385.                 if(!strlen(inputtext)) return ShowPlayerDialog(playerid, dialog_Register, DIALOG_STYLE_INPUT, "Authenticate", "Please enter a password below in order to register.", "Register", "Quit");
  386.  
  387.                 WP_Hash(hashpass, sizeof(hashpass), inputtext);
  388.  
  389.                 pInfo[playerid][Pass] = hashpass;
  390.  
  391.                 pInfo[playerid][HouseOwner] = 999;
  392.                 pInfo[playerid][BizOwner] = 999;
  393.                 pInfo[playerid][CarOwner] = 999;
  394.  
  395.                 pInfo[playerid][MaskNumber] = random(1000 + 2500);
  396.                 pInfo[playerid][PhoneNumber] = random(1000 + 2500);
  397.  
  398.                 pInfo[playerid][ExpLeft] = 8;
  399.                 pInfo[playerid][Level] = 1;
  400.  
  401.                 format(sHolder, sizeof(sHolder), "None");
  402.                 pInfo[playerid][FactionRank] = sHolder;
  403.                 SavePlayer(playerid);
  404.  
  405.                 TogglePlayerSpectating(playerid, false);
  406.                 SetSpawnInfo(playerid, 0, 299, 1740.6188, -1949.9669, 14.1172, 176.0951, 0, 0, 0, 0, 0, 0);
  407.                 SetTimerEx("LevelTimer", 1800000, true, "i", playerid);
  408.  
  409.                 SpawnPlayer(playerid);
  410.                 Logged[playerid] = true;
  411.  
  412.                 ShowModelSelectionMenu(playerid, skinlist, "Select Skin");
  413.  
  414.                 return true;
  415.                 }
  416.                 }
  417.  
  418.             if(dialogid == dialog_Login)
  419.                 {
  420.                 if(!response) return Kick(playerid);
  421.  
  422.                 if(response)
  423.                 {
  424.                 WP_Hash(hashpass, sizeof(hashpass), inputtext);
  425.  
  426.                 if(!strcmp(hashpass, pInfo[playerid][Pass], false))
  427.                 {
  428.                 INI_ParseFile(Path(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid);
  429.                 SendClientMessage(playerid, -1, "Welcome back! You have successfully logged in!");
  430.  
  431.                 TogglePlayerSpectating(playerid, false);
  432.                 SetSpawnInfo(playerid, 0, 299, 1740.6188, -1949.9669, 14.1172, 176.0951, 0, 0, 0, 0, 0, 0);
  433.                 SetTimerEx("LevelTimer", 1800000, true, "i", playerid);
  434.  
  435.                 SpawnPlayer(playerid);
  436.                 Logged[playerid] = true;
  437.                 }
  438.  
  439.                 else // if statement is anything BUT the above
  440.                             {
  441.                                     TogglePlayerSpectating(playerid, true);
  442.                                     ShowPlayerDialog(playerid, dialog_Login, DIALOG_STYLE_PASSWORD, "Authenticate", "Please enter a password below in order to log in\n\nThe password you entered is incorrect.", "Login", "Quit");
  443.                             }
  444.                 }
  445.         }
  446.  
  447.             if(dialogid == dialog_DealershipConfirm)
  448.         {
  449.             if(!response)
  450.                     {
  451.                         SetPlayerPos(playerid, pDlOldPos[playerid][0], pDlOldPos[playerid][1], pDlOldPos[playerid][2]);
  452.                         DestroyVehicle(pBuyingCar[playerid]);
  453.  
  454.                         pBuyingCar[playerid] = 0, pBuyingCarModel[playerid] = 0;
  455.                         TogglePlayerControllable(playerid, true);
  456.  
  457.                         SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Vehicle purchasement cancelled, taking you back to the vehicle dealership menu..");
  458.  
  459.                         return cmd_vbuy(playerid);
  460.             }
  461.  
  462.             if(response)
  463.             {
  464.                         for (new i; i != sizeof (PriceArray); ++ i)
  465.                         {
  466.                         if (PriceArray[i][0] == pBuyingCarModel[playerid])
  467.                         {
  468.                         if(GetPlayerMoney(playerid) >= PriceArray[i][1])
  469.                         {
  470.                         GivePlayerMoney(playerid, -PriceArray[i][1]);
  471.                         AddPlayerVehicle(playerid, pBuyingCarModel[playerid], PriceArray[0][i]);
  472.                         }
  473.  
  474.                         else if(GetPlayerMoney(playerid) < PriceArray[i][1])
  475.                         {
  476.                         SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have enough money!");
  477.  
  478.                         SetPlayerPos(playerid, pDlOldPos[playerid][0], pDlOldPos[playerid][1], pDlOldPos[playerid][2]);
  479.                         DestroyVehicle(pBuyingCar[playerid]);
  480.  
  481.                         pBuyingCar[playerid] = 0, pBuyingCarModel[playerid] = 0;
  482.                         TogglePlayerControllable(playerid, true);
  483.  
  484.                         return cmd_vbuy(playerid);
  485.                         }
  486.  
  487.                         break;
  488.                         }
  489.                         }
  490.  
  491.                         pInfo[playerid][CarOwner] = pBuyingCar[playerid];
  492.                         PutPlayerInVehicle(playerid, pBuyingCar[playerid], 0);
  493.                         SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have successfully bought your vehicle! Make sure to repark it!");
  494.  
  495.                         TogglePlayerControllable(playerid, true);
  496.                         }
  497.  
  498.             return true;
  499.     }
  500.  
  501.             if(dialogid == dialog_Buy)
  502.         {
  503.             if(response)
  504.             {
  505.                 switch(listitem)
  506.                 {
  507.                     case 0: // mask
  508.                     {
  509.                         if(GetPlayerMoney(playerid) >= 1000)
  510.                         {
  511.                             pInfo[playerid][Mask] = 1;
  512.                             SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have bought a mask for $1000!");
  513.                         }
  514.  
  515.                         else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have enough money!");
  516.                     }
  517.  
  518.                     case 1: // phone
  519.                     {
  520.                         if(GetPlayerMoney(playerid) >= 750)
  521.                         {
  522.                             pInfo[playerid][Phone] = 1;
  523.                             SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have bought a phone for $750!");
  524.                                             }
  525.  
  526.                         else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have enough money!");
  527.                                     }
  528.                 }
  529.             }
  530.             return true;
  531.         }
  532.  
  533.             return true;
  534.     }
  535.  
  536.     public OnPlayerSpawn(playerid)
  537.     {
  538.             if(pDeath[playerid])
  539.             {
  540.                     pDeathTimer[playerid] = SetTimerEx("DeathTimer", 1000, true, "i", playerid);
  541.                     pDeathTimerTick[playerid] = 60;
  542.  
  543.                     TogglePlayerControllable(playerid, false);
  544.  
  545.                     SetPlayerPos(playerid, 2003.9069, -1453.6417, 31.2220);
  546.                     SetPlayerVirtualWorld(playerid, 666);
  547.  
  548.                     SetPlayerCameraPos(playerid, 2003.9069, -1453.6417, 27.2220);
  549.                     SetPlayerCameraLookAt(playerid, 2004.4561, -1452.8013, 27.0119);
  550.             }
  551.  
  552.             GivePlayerMoney(playerid, pInfo[playerid][HandMoney]);
  553.             SetPlayerSkin(playerid, pInfo[playerid][SkinID]);
  554.  
  555.             return true;
  556.     }
  557.  
  558.     public OnPlayerDeath(playerid, killerid, reason)
  559.     {
  560.             pDeath[playerid] = true;
  561.  
  562.             return true;
  563.     }
  564.  
  565.     public OnPlayerText(playerid, text[])
  566.     {
  567.             new msg[129];
  568.  
  569.             if(pOnCall[playerid])
  570.             {
  571.                     for(new i; i < MAX_PLAYERS; i ++)
  572.                     {
  573.                             if(pCalling[i] == playerid)
  574.                             {
  575.                                     new string[126];
  576.  
  577.                                     format(string, sizeof(string), "%s says (cellphone): %s", GetPlayerName(playerid), text);
  578.                                     SendNearbyMessage(playerid, 0xF2F2F2FF, 0xD6D6D6FF, 0xC7C7C7FF, 0xB0B0B0FF, string);
  579.                                     SendClientMessage(i, 0xFFFB00FF, string);
  580.  
  581.                                     break;
  582.                             }
  583.                     }
  584.             }
  585.  
  586.             else if(!pOnCall[playerid])
  587.             {
  588.                     format(msg, sizeof msg, "%s says: %s", GetPlayerName(playerid), text);
  589.                     SplitMessage(playerid, 0xF2F2F2FF, 0xD6D6D6FF, 0xC7C7C7FF, 0xB0B0B0FF, msg);
  590.             }
  591.  
  592.             return false;
  593.     }
  594.  
  595.     public OnPlayerModelSelection(playerid, response, listid, modelid)
  596.     {
  597.         if(listid == skinlist)
  598.         {
  599.             if(response)
  600.             {
  601.                 SetPlayerSkin(playerid, modelid);
  602.             }
  603.  
  604.             else if(!response) return ShowModelSelectionMenu(playerid, skinlist, "Select Skin");
  605.         }
  606.  
  607.         return true;
  608.     }
  609.  
  610.     public OnPlayerModelSelectionEx(playerid, response, extraid, modelid)
  611.     {
  612.             new Float: x, Float: y, Float: z;
  613.             GetPlayerPos(playerid, x, y, z);
  614.  
  615.             pDlOldPos[playerid][0] = x;
  616.             pDlOldPos[playerid][1] = y;
  617.             pDlOldPos[playerid][2] = z;
  618.  
  619.             if(extraid == mselection_Dealership)
  620.         {
  621.             if(response)
  622.             {
  623.                             pBuyingCar[playerid] = CreateVehicle(modelid, 1607.9554, -1836.0122, 13.5089, 311.1762, 0, 0, -1);
  624.                             PutPlayerInVehicle(playerid, pBuyingCar[playerid], 0);
  625.  
  626.                             pBuyingCarModel[playerid] = modelid;
  627.                             ShowDealershipDialog(playerid, pBuyingCarModel[playerid]);
  628.             }
  629.  
  630.             else SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have closed the dealership menu.");
  631.         }
  632.  
  633.             return true;
  634.     }
  635.  
  636.     public OnPlayerStateChange(playerid, newstate, oldstate)
  637.     {
  638.             new vehicleid = GetPlayerVehicleID(playerid);
  639.  
  640.             switch(newstate)
  641.             {
  642.                 case PLAYER_STATE_DRIVER:
  643.                 {
  644.                             if(vInfo[vehicleid][Type] == 1 && pInfo[playerid][FactionID] == vInfo[vehicleid][Faction])
  645.                     {
  646.                                 SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Welcome to your faction's vehicle!");
  647.                     }
  648.  
  649.                                 else if(vInfo[vehicleid][Type] == 1 && pInfo[playerid][FactionID] != vInfo[vehicleid][Faction])
  650.                             {
  651.                                 RemovePlayerFromVehicle(playerid);
  652.                                 SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: This vehicle isn't part of your faction!");
  653.                             }
  654.  
  655.                             PlayerTextDrawShow(playerid, vSpeedTD[playerid]);
  656.                             PlayerTextDrawShow(playerid, vSpeedTDText[playerid]);
  657.                             PlayerTextDrawShow(playerid, vFuelTD[playerid]);
  658.                             PlayerTextDrawShow(playerid, vFuelTDText[playerid]);
  659.                             }
  660.  
  661.                             case PLAYER_STATE_ONFOOT:
  662.                             {
  663.                                 PlayerTextDrawHide(playerid, vSpeedTD[playerid]);
  664.                                 PlayerTextDrawHide(playerid, vSpeedTDText[playerid]);
  665.                                 PlayerTextDrawHide(playerid, vFuelTD[playerid]);
  666.                                 PlayerTextDrawHide(playerid, vFuelTDText[playerid]);
  667.                     }
  668.             }
  669.  
  670.             return true;
  671.     }
  672.  
  673.     public OnPlayerUpdate(playerid)
  674.     {
  675.         new string[16];
  676.  
  677.         if(IsPlayerInAnyVehicle(playerid))
  678.         {
  679.             format(string, sizeof(string), "~p~%0.0f", GetVehicleSpeed(GetPlayerVehicleID(playerid)));
  680.             PlayerTextDrawSetString(playerid, vSpeedTD[playerid], string);
  681.  
  682.             format(string, sizeof(string), "~p~%d", vInfo[GetPlayerVehicleID(playerid)][Fuel]);
  683.             PlayerTextDrawSetString(playerid, vFuelTD[playerid], string);
  684.         }
  685.  
  686.         return true;
  687.     }
  688.  
  689.     CMD:stats(playerid, params[])
  690.     {
  691.             new string[110], sHolder[40], sHolder2[40];
  692.  
  693.             SendClientMessage(playerid, 0x8EB2D6FF, "Your ingame statistics");
  694.  
  695.             format(string, sizeof(string), "[Name: %s] [Admin: %d] [Helper: %d] [Level: %d] [Exp: %d/%d] [Session ID: %d]", GetPlayerName(playerid), pInfo[playerid][Admin], pInfo[playerid][Helper], pInfo[playerid][Level], pInfo[playerid][Exp], pInfo[playerid][ExpLeft], playerid);
  696.             SendClientMessage(playerid, 0xC4C4C4FF, string);
  697.  
  698.             if(pInfo[playerid][FactionID] == 0) format(sHolder, sizeof(sHolder), "Civilians");
  699.             else if(pInfo[playerid][FactionID] > 0) format(sHolder, sizeof(sHolder), "%s", fInfo[pInfo[playerid][FactionID]][Name]);
  700.  
  701.             format(string, sizeof(string), "[Faction: %s (%d)] [Tier: %d] [Rank: %s]", sHolder, pInfo[playerid][FactionID], pInfo[playerid][FactionTier], pInfo[playerid][FactionRank]);
  702.             SendClientMessage(playerid, 0xABABABFF, string);
  703.  
  704.             format(string, sizeof(string), "[House: %d] [Car: %d] [Biz: %d] [Bank: $%d] [Money: $%d]", pInfo[playerid][HouseOwner], pInfo[playerid][CarOwner], pInfo[playerid][BizOwner], pInfo[playerid][BankMoney], GetPlayerMoney(playerid));
  705.             SendClientMessage(playerid, 0xC4C4C4FF, string);
  706.  
  707.             if(pInfo[playerid][Phone] == 0) format(sHolder, sizeof(sHolder), "No");
  708.             else if(pInfo[playerid][Phone] == 1) format(sHolder, sizeof(sHolder), "Yes");
  709.  
  710.             if(pInfo[playerid][Mask] == 0) format(sHolder2, sizeof(sHolder2), "No");
  711.             else if(pInfo[playerid][Mask] == 1) format(sHolder2, sizeof(sHolder2), "Yes");
  712.  
  713.             format(string, sizeof(string), "[Phone: %s] [Phone Number: %d] [Mask: %s] [Mask Number: %d] ", sHolder, pInfo[playerid][PhoneNumber], sHolder2, pInfo[playerid][MaskNumber], pInfo[playerid][SkinID]);
  714.             SendClientMessage(playerid, 0xABABABFF, string);
  715.  
  716.             return true;
  717.     }
  718.  
  719.     CMD:deposit(playerid, params[])
  720.     {
  721.             new string[90], input;
  722.  
  723.             if(sscanf(params, "i", input)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF} /deposit [amount]");
  724.             if(GetPlayerMoney(playerid) < input) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF} You don't have that much money!");
  725.  
  726.             if(IsPlayerInRangeOfPoint(playerid, 3.0, 0.00, 0.00, 0.00))
  727.             {
  728.                     pOldBalance[playerid] = pInfo[playerid][BankMoney]; // save old var
  729.                     pInfo[playerid][BankMoney] += input, GivePlayerMoney(playerid, -input);
  730.  
  731.                     format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF} You have deposited $%d into your bank account.", input);
  732.                     SendClientMessage(playerid, -1, string);
  733.  
  734.                     format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF} Old balance: $%d | New balance: $%d", pOldBalance[playerid], pInfo[playerid][BankMoney]);
  735.                     SendClientMessage(playerid, -1, string);
  736.             }
  737.  
  738.             else return     SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in range of the bank! [[Make sure to change this in the script]]");
  739.  
  740.             return true;
  741.     }
  742.  
  743.     CMD:withdraw(playerid, params[])
  744.     {
  745.             new string[90], input;
  746.  
  747.             if(sscanf(params, "i", input)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF} /withdraw [amount]");
  748.             if(pInfo[playerid][BankMoney] < input) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF} Your bank account doesn't hold that much money!");
  749.  
  750.             if(IsPlayerInRangeOfPoint(playerid, 3.0, 0.00, 0.00, 0.00))
  751.             {
  752.                     pOldBalance[playerid] = pInfo[playerid][BankMoney]; // save old var
  753.                     pInfo[playerid][BankMoney] -= input, GivePlayerMoney(playerid, input);
  754.  
  755.                     format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF} You have withdrawn $%d from your bank account.", input);
  756.                     SendClientMessage(playerid, -1, string);
  757.  
  758.                     format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF} Old balance: $%d | New balance: $%d", pOldBalance[playerid], pInfo[playerid][BankMoney]);
  759.                     SendClientMessage(playerid, -1, string);
  760.             }
  761.  
  762.             else return     SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in range of the bank! [[Make sure to change this in the script]]");
  763.  
  764.             return true;
  765.     }
  766.  
  767.     CMD:bankinfo(playerid, params[])
  768.     {
  769.             new string[90];
  770.  
  771.             if(IsPlayerInRangeOfPoint(playerid, 3.0, 0.00, 0.00, 0.00))
  772.             {
  773.                     format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF} Bank account balance: $%d", pInfo[playerid][BankMoney]);
  774.                     SendClientMessage(playerid, -1, string);
  775.             }
  776.  
  777.             else return     SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in range of the bank! [[Make sure to change this in the script]]");
  778.  
  779.             return true;
  780.     }
  781.  
  782.     CMD:buy(playerid, params[])
  783.     {
  784.             if(IsPlayerInRangeOfPoint(playerid, 3.0, 0.00, 0.00, 0.00))
  785.             {
  786.                     ShowPlayerDialog(playerid, dialog_Buy, DIALOG_STYLE_LIST, "24/7", "Mask $1000\nPhone $750", "Buy", "Cancel");
  787.             }
  788.  
  789.             else return     SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in range of the 24/7! [[Make sure to change this in the script]]");
  790.  
  791.             return true;
  792.     }
  793.  
  794.     CMD:report(playerid, params[])
  795.     {
  796.             new string[144], text[80];
  797.  
  798.             if(sscanf(params, "s[80]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /report [text]");
  799.  
  800.             format(string, sizeof(string), "(%d) %s reported: %s", playerid, GetPlayerName(playerid), text);
  801.             SendAdminMsg(string);
  802.  
  803.             return true;
  804.     }
  805.  
  806.     CMD:help(playerid, params[])
  807.     {
  808.             SendClientMessage(playerid, 0x8EB2D6FF, "Commands available to you");
  809.  
  810.             SendClientMessage(playerid, -1, "{8EB2D6}[CHAT]{FFFFFF}: /pm, /me, /do, /o, /b, /low, /s(hout), /mes, /mask");
  811.             SendClientMessage(playerid, -1, "{8EB2D6}[PHONE]{FFFFFF}: /call, /pickup, /hangup, /togphone");
  812.             SendClientMessage(playerid, -1, "{8EB2D6}[GENERAL]{FFFFFF}: /report, /admins, /deposit, /withdraw, /bankinfo, /stats");
  813.             SendClientMessage(playerid, -1, "{8EB2D6}[SYSTEMS]{FFFFFF}: /carhelp, /househelp, /factionhelp, /bizhelp, /ahelp");
  814.  
  815.             return true;
  816.     }
  817.  
  818.     CMD:admins(playerid, params[])
  819.     {
  820.         new string[50], sendername[MAX_PLAYER_NAME];
  821.  
  822.         SendClientMessage(playerid, 0x8EB2D6FF, "Online Administrators");
  823.  
  824.         for(new i = 0; i < MAX_PLAYERS; i++)
  825.             {
  826.         if(pInfo[playerid][Admin] > 0)
  827.             {
  828.                 GetPlayerName(i, sendername, sizeof(sendername));
  829.                 format(string, sizeof(string), "(Lvl: %d) %s (%d)", pInfo[playerid][Admin], sendername, i);
  830.                 SendClientMessage(playerid, 0xA3A3A3FF, string);
  831.             }
  832.             }
  833.  
  834.         return true;
  835.     }
  836.  
  837.     CMD:mask(playerid, params[])
  838.     {
  839.             if(!pMasked[playerid])
  840.             {
  841.                     pMasked[playerid] = true;
  842.                     SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have put your mask on!");
  843.             }
  844.  
  845.             else if(pMasked[playerid])
  846.             {
  847.                     pMasked[playerid] = false;
  848.                     SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have taken your mask off!");
  849.             }
  850.  
  851.             return true;
  852.     }
  853.  
  854.     CMD:bizhelp(playerid, params[])
  855.     {
  856.             SendClientMessage(playerid, 0x8EB2D6FF, "Business commands available to you");
  857.  
  858.             SendClientMessage(playerid, -1, "{8EB2D6}[OWNED]{FFFFFF}: /bnear, /bbuy, /bsell, /baccess, /block");
  859.  
  860.             return true;
  861.     }
  862.  
  863.     CMD:achat(playerid, params[])
  864.     {
  865.             new string[144], text[80];
  866.  
  867.             if(pInfo[playerid][Admin] == 0) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not an administrator!");
  868.             if(sscanf(params, "s[80]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /report [text]");
  869.  
  870.             format(string, sizeof(string), "(%d) %s: %s", playerid, GetPlayerName(playerid), text);
  871.             SendAdminMsg(string);
  872.  
  873.             return true;
  874.     }
  875.  
  876.     CMD:ahelp(playerid, params[])
  877.     {
  878.             if(pInfo[playerid][Admin] == 0) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not an administrator!");
  879.  
  880.             if(pInfo[playerid][Admin] >= 1)
  881.             {
  882.                     SendClientMessage(playerid, 0xCC9D76FF, "Trial  Admin commands [Lvl. 1]");
  883.  
  884.                     SendClientMessage(playerid, -1, "{96CC76}[PLAYERS]{FFFFFF}: /achat");
  885.             }
  886.  
  887.             if(pInfo[playerid][Admin] >= 2)
  888.             {
  889.                     SendClientMessage(playerid, 0xCC9D76FF, "Basic Admin commands [Lvl. 2]");
  890.             }
  891.  
  892.             if(pInfo[playerid][Admin] >= 3)
  893.             {
  894.                     SendClientMessage(playerid, 0xCC9D76FF, "General Admin commands [Lvl. 3]");
  895.  
  896.                     SendClientMessage(playerid, -1, "{96CC76}[FACTIONS]{FFFFFF}: /fset, /frename, /fsettype");
  897.                     SendClientMessage(playerid, -1, "{96CC76}[HOUSES]{FFFFFF}: /hgoto, /hsetint, /hmove");
  898.                     SendClientMessage(playerid, -1, "{96CC76}[LABELS]{FFFFFF}: /labelrename, /labelmove");
  899.                     SendClientMessage(playerid, -1, "{96CC76}[BIZZES]{FFFFFF}: /bgoto, /bsetint, /bmove");
  900.             }
  901.  
  902.             if(pInfo[playerid][Admin] >= 4)
  903.             {
  904.                     SendClientMessage(playerid, 0xCC9D76FF, "Management commands [Lvl. 4]");
  905.  
  906.                     SendClientMessage(playerid, -1, "{96CC76}[VEHICLES]{FFFFFF}: /vcreate, /vdelete");
  907.                     SendClientMessage(playerid, -1, "{96CC76}[HOUSES]{FFFFFF}: /hcreate, hdelete");
  908.                     SendClientMessage(playerid, -1, "{96CC76}[FACTIONS]{FFFFFF}: /fcreate, /fdelete");
  909.                     SendClientMessage(playerid, -1, "{96CC76}[LABELS]{FFFFFF}: /labelcreate, /labeldelete");
  910.                     SendClientMessage(playerid, -1, "{96CC76}[BIZZES]{FFFFFF}: /bdelete, /bcreate");
  911.             }
  912.  
  913.             return true;
  914.     }
  915.  
  916.     CMD:pm(playerid, params[])
  917.     {
  918.         new str[128], text[68], targetid;
  919.  
  920.         if(sscanf(params, "us[128]", targetid, text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /pm [player] [text]");
  921.  
  922.         if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Player isn't connected!");
  923.  
  924.         format(str, sizeof(str), "PM to %s (%d): %s", GetPlayerName(targetid), targetid, text);
  925.         SendClientMessage(playerid, 0xE0E800FF, str);
  926.  
  927.         format(str, sizeof(str), "PM from %s (%d): %s", GetPlayerName(playerid), playerid, text);
  928.         SendClientMessage(targetid, 0xE8C900FF, str);
  929.  
  930.         return true;
  931.     }
  932.  
  933.     CMD:privmsg(playerid, params[]) return cmd_pm(playerid, params);
  934.  
  935.     CMD:o(playerid, params[])
  936.     {
  937.             new text[128], string[128];
  938.  
  939.             if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /o [text]");
  940.  
  941.             format(string, sizeof(string), "(( [%d] %s: %s ))", playerid, GetPlayerName(playerid), text);
  942.             SendClientMessageToAll(0xF2F2F2FF, string);
  943.  
  944.             return true;
  945.     }
  946.  
  947.     CMD:ooc(playerid, params[]) return cmd_o(playerid, params);
  948.  
  949.     CMD:b(playerid, params[])
  950.     {
  951.             new text[128], string[128];
  952.  
  953.             if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /b [text]");
  954.  
  955.             format(string, sizeof(string), "(( [%d] %s: %s ))", playerid, GetPlayerName(playerid), text);
  956.             SplitMessage(playerid,  0xA3A3A3FF, 0xA3A3A3FF, 0x8C8C8CFF, 0x8C8C8CFF, string);
  957.  
  958.             return true;
  959.     }
  960.  
  961.     CMD:low(playerid, params[])
  962.     {
  963.             new text[128], string[128];
  964.  
  965.             if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /low [text]");
  966.  
  967.             format(string, sizeof(string), "%s says [low]: %s", GetPlayerName(playerid), text);
  968.             SplitMessage(playerid,  0xA3A3A3FF, 0xA3A3A3FF, 0x8C8C8CFF, 0x8C8C8CFF, string);
  969.  
  970.             return true;
  971.     }
  972.  
  973.     CMD:shout(playerid, params[])
  974.     {
  975.             new text[128], string[128];
  976.  
  977.             if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /s(hout) [text]");
  978.  
  979.             format(string, sizeof(string), "%s shouts: %s", GetPlayerName(playerid), text);
  980.             SplitMessage(playerid,  0xF2F2F2FF, 0xF2F2F2FF, 0xC7C7C7FF, 0xB0B0B0FF, string);
  981.  
  982.             return true;
  983.     }
  984.     CMD:s(playerid, params[]) return cmd_shout(playerid, params);
  985.  
  986.     CMD:me(playerid, params[])
  987.     {
  988.             new text[128], string[128];
  989.  
  990.             if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /me [action]");
  991.  
  992.             format(string, sizeof(string), "%s %s", GetPlayerName(playerid), text);
  993.             SplitMessage(playerid,  0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, string);
  994.  
  995.             return true;
  996.     }
  997.  
  998.     CMD:mes(playerid, params[])
  999.     {
  1000.             new text[128], string[128];
  1001.  
  1002.             if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /mes [action]");
  1003.  
  1004.             format(string, sizeof(string), "%s's %s", GetPlayerName(playerid), text);
  1005.             SplitMessage(playerid,  0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, string);
  1006.  
  1007.             return true;
  1008.     }
  1009.  
  1010.     CMD:do(playerid, params[])
  1011.     {
  1012.             new text[128], string[128];
  1013.  
  1014.             if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /do [action]");
  1015.  
  1016.             format(string, sizeof(string), "%s (( %s ))", text, GetPlayerName(playerid));
  1017.             SplitMessage(playerid,  0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, string);
  1018.  
  1019.             return true;
  1020.     }
  1021.     // phone system
  1022.  
  1023.     CMD:call(playerid, params[])
  1024.     {
  1025.             new tnum, string[75], sender = pInfo[playerid][PhoneNumber];
  1026.  
  1027.             if(pInfo[playerid][Phone] != 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have a phone!");
  1028.             if(sscanf(params, "i", tnum)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /call [number]");
  1029.  
  1030.             for(new i = 0; i <      MAX_PLAYERS; i++)
  1031.             {
  1032.                     if(pInfo[i][PhoneNumber] == tnum)
  1033.                     {
  1034.                             if(!pPhoneStatus[i]) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The number you entered may not exist or the device is turned off.");
  1035.                             if(pOnCall[i]) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The number you entered is already in a call.");
  1036.                             if(pIsCalled[i]) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The number you entered is already being called.");
  1037.  
  1038.                             pCalling[playerid] = i;
  1039.                             SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
  1040.  
  1041.                             format(string, sizeof(string), "Your cellphone is ringing (/pickup). The calling number is %d.", sender);
  1042.                             SendClientMessage(i, -1, string);
  1043.  
  1044.                             pIsCalled[i] = true;
  1045.  
  1046.                             break;
  1047.                     }
  1048.             }
  1049.  
  1050.             return true;
  1051.     }
  1052.  
  1053.     CMD:pickup(playerid, params)
  1054.     {
  1055.             if(pInfo[playerid][Phone] != 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have a phone!");
  1056.             if(!pIsCalled[playerid]) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You are currently not connected to a phone call.");
  1057.  
  1058.             for(new i; i < MAX_PLAYERS; i ++)
  1059.             {
  1060.                     if(pCalling[i] == playerid)
  1061.                     {
  1062.                             pCalling[playerid] = i; //caller connecting
  1063.  
  1064.                             SendClientMessage(i, -1, "{8EB2D6}[INFO]{FFFFFF}: The call has been connected.");
  1065.  
  1066.                             SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
  1067.                             SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
  1068.                             ClearAnimations(playerid);
  1069.  
  1070.                             pOnCall[playerid] = true;
  1071.                             pOnCall[i] = true;
  1072.                     }
  1073.             }
  1074.  
  1075.             return true;
  1076.     }
  1077.  
  1078.     CMD:hangup(playerid, params[])
  1079.     {
  1080.             if(pInfo[playerid][Phone] != 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have a phone!");
  1081.             if(!pIsCalled[playerid]) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You are currently not connected to a phone call.");
  1082.  
  1083.             for(new i; i < MAX_PLAYERS; i ++)
  1084.             {
  1085.                     if(pCalling[i] == playerid)
  1086.                     {
  1087.                             pCalling[playerid] = i; //caller connecting
  1088.  
  1089.                             SendClientMessage(i, -1, "{8EB2D6}[INFO]{FFFFFF}: The call has been disconnected.");
  1090.                             SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have disconnected the call.");
  1091.  
  1092.                             SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
  1093.                             SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
  1094.                             SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
  1095.                             ClearAnimations(playerid);
  1096.  
  1097.                             pOnCall[playerid] = false;
  1098.                             pIsCalled[playerid] = false;
  1099.  
  1100.                             pOnCall[i] = false;
  1101.                             pIsCalled[i] = false;
  1102.  
  1103.                             break;
  1104.                     }
  1105.             }
  1106.  
  1107.             return true;
  1108.     }
  1109.  
  1110.     CMD:togphone(playerid, params[])
  1111.     {
  1112.             if(pInfo[playerid][Phone] != 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have a phone!");
  1113.  
  1114.             if(pPhoneStatus[playerid])
  1115.             {
  1116.                     SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have switched your cellphone off.");
  1117.                     pPhoneStatus[playerid] = false;
  1118.             }
  1119.  
  1120.             else if(!pPhoneStatus[playerid])
  1121.             {
  1122.                     SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have switched your cellphone on.");
  1123.                     pPhoneStatus[playerid] = true;
  1124.             }
  1125.  
  1126.             return true;
  1127.     }
  1128.  
  1129.     // biz system
  1130.  
  1131.     CMD:bcreate(playerid, params[])
  1132.     {
  1133.             new Float: pos[3], string[100], str2[MAX_PLAYER_NAME], price, name[40];
  1134.             GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  1135.  
  1136.             if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
  1137.             if(sscanf(params, "is[40]", price, name)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /bcreate [price] [name]");
  1138.             format(str2, sizeof(str2), "None"); // to avoid array error -- size is MAX_PLAYER_NAME, as is "Owner"
  1139.  
  1140.             new INI:File = INI_Open(BusinessPath(bCount));
  1141.  
  1142.             INI_SetTag(File, "Business Data");
  1143.  
  1144.             INI_WriteString(File, "Name", name);
  1145.             bInfo[bCount][Name] = name;
  1146.  
  1147.             INI_WriteString(File, "Owner", str2);
  1148.             bInfo[bCount][Owner] = str2;
  1149.  
  1150.             INI_WriteInt(File, "Price", price);
  1151.             bInfo[bCount][Price] = price;
  1152.  
  1153.             INI_WriteInt(File, "Bought", 0);
  1154.             bInfo[bCount][Bought] = 0;
  1155.  
  1156.             INI_WriteFloat(File, "ExtX", pos[0]);
  1157.             bInfo[bCount][ExtX] = pos[0];
  1158.  
  1159.             INI_WriteFloat(File, "ExtY", pos[1]);
  1160.             bInfo[bCount][ExtY] = pos[1];
  1161.  
  1162.             INI_WriteFloat(File, "ExtZ", pos[2]);
  1163.             bInfo[bCount][ExtZ] = pos[2];
  1164.  
  1165.             INI_WriteFloat(File, "IntX", 0.0);
  1166.             bInfo[bCount][IntX] = 0.0;
  1167.  
  1168.             INI_WriteFloat(File, "IntY", 0.0);
  1169.             bInfo[bCount][IntX] = 0.0;
  1170.  
  1171.             INI_WriteFloat(File, "IntZ", 0.0);
  1172.             bInfo[bCount][IntX] = 0.0;
  1173.  
  1174.             INI_WriteInt(File, "IntWorld", 2);
  1175.             bInfo[bCount][IntInterior] = 2;
  1176.  
  1177.             INI_WriteInt(File, "IntVW", 0);
  1178.             bInfo[bCount][IntVirtualW] = random(250);
  1179.  
  1180.             INI_WriteInt(File, "VW", GetPlayerVirtualWorld(playerid));
  1181.             bInfo[bCount][World] = GetPlayerVirtualWorld(playerid);
  1182.  
  1183.             INI_WriteInt(File, "World", GetPlayerInterior(playerid));
  1184.             bInfo[bCount][Interior] = GetPlayerInterior(playerid);
  1185.  
  1186.             INI_WriteInt(File, "Locked", 0);
  1187.             bInfo[bCount][Locked] = 0;
  1188.  
  1189.             INI_WriteInt(File, "Initialised", 0);
  1190.             bInfo[bCount][Initialised] = 0;
  1191.  
  1192.             INI_Close(File);
  1193.  
  1194.             format(string, sizeof(string), "{8EB2D6}[Business]{FFFFFF}\nName: %s\nOwner: %s\nPrice: %d", bInfo[bCount][Name], bInfo[bCount][Owner], bInfo[bCount][Price]);
  1195.             bInfo[bCount][Label] = Create3DTextLabel(string, 0xFFFFFFFF, pos[0], pos[1], pos[2], 10.0, GetPlayerVirtualWorld(playerid), 1);
  1196.             bCount ++;
  1197.  
  1198.             SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have created a business at your position! Use /bsetint to set it's interior!");
  1199.  
  1200.             return true;
  1201.     }
  1202.  
  1203.     CMD:bdelete(playerid, params[])
  1204.     {
  1205.             new bid, loc[30], string[80];
  1206.  
  1207.             if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
  1208.             if(sscanf(params, "i", bid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /bdelete [bid]");
  1209.  
  1210.             format(loc, 30, "Businesses/%d.ini", bid);
  1211.  
  1212.             if(!fexist(loc)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The business ID you entered doesn't exist.");
  1213.  
  1214.             else if(fexist(loc))
  1215.             {
  1216.                     format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have deleted business ID: %d", bid);
  1217.                     SendClientMessage(playerid, -1, string);
  1218.  
  1219.                     Delete3DTextLabel(bInfo[bid][Label]);
  1220.                     fremove(loc);
  1221.             }
  1222.  
  1223.             return true;
  1224.     }
  1225.  
  1226.     CMD:bsetint(playerid, params[])
  1227.     {
  1228.             new interior, bid, string[80];
  1229.  
  1230.             if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
  1231.             if(sscanf(params, "ii", bid, interior)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /bsetint [bid] [interior]");
  1232.             if(interior < 1 && interior > 5) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: No more than 25 and no less than 1!");
  1233.  
  1234.             if(interior == 1) // 24/7
  1235.             {
  1236.                 bInfo[bid][IntX] = -25.884498;
  1237.                 bInfo[bid][IntY] = -185.868988;
  1238.                 bInfo[bid][IntZ] = 1003.546875;
  1239.  
  1240.                 bInfo[bid][IntInterior] = 17;
  1241.             }
  1242.  
  1243.             if(interior == 2) // ammunation
  1244.             {
  1245.                 bInfo[bid][IntX] = 286.148986;
  1246.                 bInfo[bid][IntY] = -40.644397;
  1247.                 bInfo[bid][IntZ] = 1001.515625;
  1248.  
  1249.                 bInfo[bid][IntInterior] = 1;
  1250.             }
  1251.  
  1252.             if(interior == 3) // sex shop
  1253.             {
  1254.                 bInfo[bid][IntX] = -103.559165;
  1255.                 bInfo[bid][IntY] = -24.225606;
  1256.                 bInfo[bid][IntZ] = 1000.718750;
  1257.  
  1258.                 bInfo[bid][IntInterior] = 3;
  1259.             }
  1260.  
  1261.             if(interior == 4) // zero's
  1262.             {
  1263.                 bInfo[bid][IntX] = -2240.468505;
  1264.                 bInfo[bid][IntY] = 137.060440;
  1265.                 bInfo[bid][IntZ] = 1035.414062;
  1266.  
  1267.                 bInfo[bid][IntInterior] = 6;
  1268.             }
  1269.  
  1270.             if(interior == 5) // clothing store
  1271.             {
  1272.                 bInfo[bid][IntX] = 207.737991;
  1273.                 bInfo[bid][IntY] = -109.019996;
  1274.                 bInfo[bid][IntZ] = 1005.132812;
  1275.  
  1276.                 bInfo[bid][IntInterior] = 15;
  1277.             }
  1278.  
  1279.             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: Set business ID %d's interior to ID %d.", bid, interior);
  1280.             SendClientMessage(playerid, -1, string);
  1281.  
  1282.             bInfo[bid][Initialised] = 1;
  1283.             SaveBizzes();
  1284.  
  1285.             return true;
  1286.     }
  1287.  
  1288.     CMD:bgoto(playerid, params[])
  1289.     {
  1290.             new bid, string[50];
  1291.  
  1292.             if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
  1293.             if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You need to be an admin in order to do this command!");
  1294.             if(sscanf(params, "i", bid)) return SendClientMessage(playerid, -1, "/bgoto [bid]");
  1295.  
  1296.             format(string, sizeof(string), "You teleported to business ID %d", bid);
  1297.             SendClientMessage(playerid, -1, string);
  1298.  
  1299.             SetPlayerPos(playerid, bInfo[bid][ExtX], bInfo[bid][ExtY], bInfo[bid][ExtZ]);
  1300.  
  1301.             return true;
  1302.     }
  1303.  
  1304.     CMD:bmove(playerid, params[])
  1305.     {
  1306.             new bid, string[50], Float: pos[3], hlabel[100];
  1307.             GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  1308.  
  1309.             if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
  1310.             if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You need to be an admin in order to do this command!");
  1311.             if(sscanf(params, "i", bid)) return SendClientMessage(playerid, -1, "/bmove [bid]");
  1312.  
  1313.             format(string, sizeof(string), "You teleported to business ID %d", bid);
  1314.             SendClientMessage(playerid, -1, string);
  1315.  
  1316.             bInfo[bid][ExtX] = pos[0];
  1317.             bInfo[bid][ExtY] = pos[1];
  1318.             bInfo[bid][ExtZ] = pos[2];
  1319.  
  1320.             if(bInfo[bid][Bought] == 0) format(hlabel, sizeof(hlabel), "{8EB2D6}[Business]{FFFFFF}\nName: %s\nOwner: %s\nPrice: %d", bInfo[bid][Name], bInfo[bid][Owner], bInfo[bid][Price]);
  1321.             else if(bInfo[bid][Bought] == 1) format(hlabel, sizeof(hlabel), "{8EB2D6}[Business]{FFFFFF}\nName: %s\nOwner: %s", bInfo[bid][Name], bInfo[bid][Owner]);
  1322.  
  1323.             Delete3DTextLabel(bInfo[bid][Label]);
  1324.             bInfo[bid][Label] = Create3DTextLabel(hlabel, 0xFFFFFF, pos[0], pos[1], pos[2], 15.0, bInfo[bid][World], 1);
  1325.  
  1326.             SaveBizzes();
  1327.  
  1328.             return true;
  1329.     }
  1330.  
  1331.     CMD:bnear(playerid, params[])
  1332.     {
  1333.             new string[30];
  1334.  
  1335.             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a business entrance!");
  1336.  
  1337.             for(new i; i < MAX_BIZZES; i ++)
  1338.             {
  1339.                 if(IsPlayerInRangeOfPoint(playerid, 2.0, bInfo[i][ExtX], bInfo[i][ExtY], bInfo[i][ExtZ]))
  1340.             {
  1341.                     format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're near business ID %d", i);
  1342.                 }
  1343.             }
  1344.  
  1345.             SendClientMessage(playerid, -1, string);
  1346.  
  1347.             return true;
  1348.     }
  1349.  
  1350.     CMD:bbuy(playerid, params[])
  1351.     {
  1352.             new string[80], name[MAX_PLAYER_NAME];
  1353.             GetPlayerName(playerid, name, sizeof(name));
  1354.  
  1355.             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a business entrance!");
  1356.  
  1357.             for(new i; i < MAX_BIZZES; i ++)
  1358.             {
  1359.                 if(IsPlayerInRangeOfPoint(playerid, 2.0, bInfo[i][ExtX], bInfo[i][ExtY], bInfo[i][ExtZ]))
  1360.             {
  1361.                             if(bInfo[i][Bought] == 0)
  1362.                             {
  1363.                                 if(GetPlayerMoney(playerid) >= bInfo[i][Price])
  1364.                                 {
  1365.                                             GivePlayerMoney(playerid, - bInfo[i][Price]);
  1366.                                             pInfo[playerid][BizOwner] = i;
  1367.  
  1368.                                             bInfo[i][Owner] = name;
  1369.                                             bInfo[i][Bought] = 1;
  1370.  
  1371.                                             format(string, sizeof(string), "{8EB2D6}[Business]{FFFFFF}\nName: %s\nOwner: %s", bInfo[i][Name], bInfo[i][Owner]);
  1372.                                             Update3DTextLabelText(bInfo[i][Label], 0xFFFFFF, string);
  1373.  
  1374.                                             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have purchased business ID %d for %d!", i, bInfo[i][Price]);
  1375.                                             break;
  1376.                                     }
  1377.  
  1378.                                     else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have enough money!");
  1379.                             }
  1380.  
  1381.                             else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: This business is not for sale!");
  1382.                 }
  1383.             }
  1384.  
  1385.             SendClientMessage(playerid, -1, string);
  1386.  
  1387.             return true;
  1388.     }
  1389.  
  1390.     CMD:bsell(playerid, params[])
  1391.     {
  1392.             new string[80], name[MAX_PLAYER_NAME];
  1393.             GetPlayerName(playerid, name, sizeof(name));
  1394.  
  1395.             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a business entrance!");
  1396.             format(name, sizeof(name), "None");
  1397.  
  1398.             for(new i; i < MAX_BIZZES; i ++)
  1399.             {
  1400.                 if(IsPlayerInRangeOfPoint(playerid, 2.0, bInfo[i][ExtX], bInfo[i][ExtY], bInfo[i][ExtZ]))
  1401.             {
  1402.                             if(pInfo[playerid][BizOwner] == i)
  1403.                             {
  1404.                                 if(GetPlayerMoney(playerid) >= bInfo[i][Price])
  1405.                                 {
  1406.                                             GivePlayerMoney(playerid, bInfo[i][Price]);
  1407.                                             pInfo[playerid][BizOwner] = 0;
  1408.  
  1409.                                             bInfo[i][Owner] = name;
  1410.                                             bInfo[i][Bought] = 0;
  1411.  
  1412.                                             format(string, sizeof(string), "{8EB2D6}[Business]{FFFFFF}\nName: %s\nOwner: %s\nPrice: %d", bInfo[i][Name], bInfo[i][Owner], bInfo[i][Price]);
  1413.                                             Update3DTextLabelText(bInfo[i][Label], 0xFFFFFF, string);
  1414.  
  1415.                                             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have sold business ID %d for %d!", i, bInfo[i][Price]);
  1416.                                             break;
  1417.                                     }
  1418.  
  1419.                                     else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have enough money!");
  1420.                             }
  1421.  
  1422.                             else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't own this business!");
  1423.                 }
  1424.             }
  1425.  
  1426.             SendClientMessage(playerid, -1, string);
  1427.  
  1428.             return true;
  1429.     }
  1430.  
  1431.     CMD:block(playerid, params[])
  1432.     {
  1433.             new string[80];
  1434.  
  1435.             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a business entrance!");
  1436.  
  1437.             for(new i; i < MAX_BIZZES; i ++)
  1438.             {
  1439.                 if(IsPlayerInRangeOfPoint(playerid, 2.0, bInfo[i][ExtX], bInfo[i][ExtY], bInfo[i][ExtZ]))
  1440.             {
  1441.                             if(pInfo[playerid][BizOwner] == i)
  1442.                             {
  1443.                                     if(bInfo[playerid][Locked] == 1)
  1444.                                     {
  1445.                                         bInfo[playerid][Locked] = 0;
  1446.                                         format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have unlocked your business!");
  1447.                                     }
  1448.  
  1449.                                     else if(bInfo[playerid][Locked] == 0)
  1450.                                     {
  1451.                                         bInfo[playerid][Locked] = 1;
  1452.                                         format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have locked your business!");
  1453.                                     }
  1454.  
  1455.                                     SaveBizzes();
  1456.                                     break;
  1457.                             }
  1458.  
  1459.                             else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't own this business!");
  1460.                 }
  1461.             }
  1462.  
  1463.             SendClientMessage(playerid, -1, string);
  1464.  
  1465.             return true;
  1466.     }
  1467.  
  1468.     CMD:baccess(playerid, params[])
  1469.     {
  1470.             new string[100];
  1471.  
  1472.             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a business entrance or exit!");
  1473.  
  1474.             for(new i; i < MAX_BIZZES; i ++)
  1475.             {
  1476.                     if(bInfo[i][Locked] == 0)
  1477.                     {
  1478.                 if(bInfo[i][Initialised] == 1)
  1479.                     {
  1480.                                 if(IsPlayerInRangeOfPoint(playerid, 2.0, bInfo[i][ExtX], bInfo[i][ExtY], bInfo[i][ExtZ]))
  1481.                             {
  1482.                                     SetPlayerPos(playerid, bInfo[i][IntX], bInfo[i][IntY], bInfo[i][IntZ]);
  1483.                                     SetPlayerInterior(playerid, bInfo[i][IntInterior]);
  1484.                                     SetPlayerVirtualWorld(playerid, bInfo[i][IntVirtualW]);
  1485.  
  1486.                                     format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You entered business ID %d.", i);
  1487.                                     break;
  1488.                                 }
  1489.  
  1490.                                 else if(IsPlayerInRangeOfPoint(playerid, 2.0, bInfo[i][IntX], bInfo[i][IntY], bInfo[i][IntZ]) && GetPlayerVirtualWorld(playerid) == bInfo[i][IntVirtualW])
  1491.                                 {
  1492.                                     SetPlayerPos(playerid, bInfo[i][ExtX], bInfo[i][ExtY], bInfo[i][ExtZ]);
  1493.                                     SetPlayerInterior(playerid, bInfo[i][Interior]);
  1494.                                     SetPlayerVirtualWorld(playerid, bInfo[i][World]);
  1495.  
  1496.                                     format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You left business ID %d.", i);
  1497.                                     break;
  1498.                                     }
  1499.                             }
  1500.                     }
  1501.  
  1502.                     else format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: The business you're trying to enter is locked!");
  1503.             }
  1504.  
  1505.             SendClientMessage(playerid, -1, string);
  1506.  
  1507.             return true;
  1508.     }
  1509.  
  1510.     // car system
  1511.  
  1512.     CMD:carhelp(playerid, params[])
  1513.     {
  1514.             SendClientMessage(playerid, 0x8EB2D6FF, "Vehicle commands available to you");
  1515.  
  1516.             SendClientMessage(playerid, -1, "{8EB2D6}[OWNED CAR]{FFFFFF}: /vbuy, /vscrap, /vpark, /vgive, /vsetcolor, /engine, /lock");
  1517.             SendClientMessage(playerid, -1, "{8EB2D6}[EVERY CAR]{FFFFFF}: /vstoregun, /vtakegun, /vcheck, /vhood, /vtrunk");
  1518.  
  1519.             return true;
  1520.     }
  1521.  
  1522.     CMD:vhood(playerid, params[])
  1523.     {
  1524.             new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid = GetPlayerVehicleID(playerid);
  1525.             GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1526.  
  1527.             if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle when performing this command!");
  1528.  
  1529.             if(!vHood[vehicleid])
  1530.             {
  1531.             SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, 1, boot, objective);
  1532.             SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have opened the hood!");
  1533.  
  1534.             vHood[vehicleid] = true;
  1535.             }
  1536.  
  1537.             else if(vHood[vehicleid])
  1538.             {
  1539.                     SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, 0, boot, objective);
  1540.                     SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have closed the hood!");
  1541.  
  1542.                     vHood[vehicleid] = false;
  1543.             }
  1544.  
  1545.             return true;
  1546.     }
  1547.  
  1548.     CMD:vtrunk(playerid, parmas[])
  1549.     {
  1550.             new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid = GetPlayerVehicleID(playerid);
  1551.             GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1552.  
  1553.             if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle when performing this command!");
  1554.  
  1555.             if(!vTrunk[vehicleid])
  1556.             {
  1557.                     SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, 1, objective);
  1558.                     SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have opened the trunk!");
  1559.  
  1560.                     vTrunk[vehicleid] = true;
  1561.             }
  1562.  
  1563.             else if(vTrunk[vehicleid])
  1564.             {
  1565.                     SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, 0, objective);
  1566.                     SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have closed the trunk!");
  1567.  
  1568.                     vTrunk[vehicleid] = false;
  1569.             }
  1570.  
  1571.             return true;
  1572.     }
  1573.  
  1574.     CMD:vcheck(playerid, params[])
  1575.     {
  1576.             new string[100], gunname[32], gunname2[32], veh = GetPlayerVehicleID(playerid);
  1577.  
  1578.             GetWeaponName(vInfo[veh][StoredSlot1], gunname, sizeof(gunname));
  1579.             GetWeaponName(vInfo[veh][StoredSlot2], gunname2, sizeof(gunname2));
  1580.  
  1581.             if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle when performing this command!");
  1582.  
  1583.             SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Vehicle's trunk containments:");
  1584.  
  1585.             if(vInfo[veh][StoredSlot1] == 0) format(gunname, sizeof(gunname), "None");
  1586.             if(vInfo[veh][StoredSlot2] == 0) format(gunname2, sizeof(gunname2), "None");
  1587.  
  1588.             format(string, sizeof(string), "{8EB2D6}[Slot 1]{FFFFFF}: %s (%d) with %d ammo.", gunname, vInfo[veh][StoredSlot1], vInfo[veh][StoredSlot1Ammo]);
  1589.             SendClientMessage(playerid, -1, string);
  1590.  
  1591.             format(string, sizeof(string), "{8EB2D6}[Slot 2]{FFFFFF}: %s (%d) with %d ammo.", gunname2, vInfo[veh][StoredSlot2], vInfo[veh][StoredSlot2Ammo]);
  1592.             SendClientMessage(playerid, -1, string);
  1593.  
  1594.             return true;
  1595.     }
  1596.  
  1597.     CMD:vlock(playerid, params[])
  1598.     {
  1599.             new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid = GetPlayerVehicleID(playerid);
  1600.             GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1601.  
  1602.             if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle when performing this command!");
  1603.  
  1604.             if(pInfo[playerid][CarOwner] == GetPlayerVehicleID(playerid))
  1605.             {
  1606.                     if(vLocked[vehicleid])
  1607.                     {
  1608.                             SetVehicleParamsEx(vehicleid, engine, lights, alarm, 0, bonnet, boot, objective);
  1609.                             SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have unlocked your vehicle!");
  1610.  
  1611.                             vLocked[vehicleid] = false;
  1612.                     }
  1613.  
  1614.                     else if(!vLocked[vehicleid])
  1615.                     {
  1616.                             SetVehicleParamsEx(vehicleid, engine, lights, alarm, 1, bonnet, boot, objective);
  1617.                             SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have locked your vehicle!");
  1618.  
  1619.                             vLocked[vehicleid] = true;
  1620.                     }
  1621.             }
  1622.  
  1623.             else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in your personal vehicle!");
  1624.  
  1625.             return true;
  1626.     }
  1627.  
  1628.     CMD:engine(playerid, params[])
  1629.     {
  1630.             new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid = GetPlayerVehicleID(playerid);
  1631.             GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1632.  
  1633.             if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle when performing this command!");
  1634.             if(vInfo[vehicleid][Fuel] < 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Your car has ran out of fuel!");
  1635.  
  1636.             if(pInfo[playerid][CarOwner] == GetPlayerVehicleID(playerid))
  1637.             {
  1638.                     if(!vEngine[vehicleid])
  1639.                     {
  1640.                             SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
  1641.                             SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have turned your vehicle's engine on!");
  1642.  
  1643.                             FuelTimer[vehicleid] = SetTimerEx("FuelTimerTick", 1000, true, "i", vehicleid);
  1644.                             vEngine[vehicleid] = true;
  1645.                     }
  1646.  
  1647.                     else if(vEngine[vehicleid])
  1648.                     {
  1649.                             SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
  1650.                             SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have turned your vehicle's engine off!");
  1651.  
  1652.                             KillTimer(FuelTimer[vehicleid]);
  1653.                             vEngine[vehicleid] = false;
  1654.                     }
  1655.             }
  1656.  
  1657.             else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in your personal vehicle!");
  1658.  
  1659.             return true;
  1660.     }
  1661.  
  1662.     CMD:fuelcar(playerid, params[])
  1663.     {
  1664.             new veh = GetPlayerVehicleID(playerid);
  1665.  
  1666.             if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You must be in a vehicle in order to do this command!");
  1667.             if(vEngine[veh]) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Your engine must be off in order to be able to do this command!");
  1668.  
  1669.             if(IsPlayerInRangeOfPoint(playerid, 8.0, 1940.9299, -1772.8094, 13.6406))
  1670.             {
  1671.                 FillingTimer[playerid] = SetTimerEx("FillingTimerEx", 1000, true, "ii", playerid, veh);
  1672.                 TogglePlayerControllable(playerid, false);
  1673.  
  1674.                 SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have started to refill your vehicle.");
  1675.             }
  1676.  
  1677.             else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not at a fuel station!");
  1678.  
  1679.             return true;
  1680.     }
  1681.  
  1682.     CMD:vsetcolor(playerid, params[])
  1683.     {
  1684.             new colA, colB;
  1685.  
  1686.             if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle when performing this command!");
  1687.             if(sscanf(params, "ii", colA, colB)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /vsetcolor [color A] [color B]");
  1688.  
  1689.             if(IsPlayerInRangeOfPoint(playerid, 6.0, 1634.9066, -1865.3574, 13.5469))
  1690.             {
  1691.                     if(pInfo[playerid][CarOwner] == GetPlayerVehicleID(playerid))
  1692.                     {
  1693.                             ChangeVehicleColor(GetPlayerVehicleID(playerid), colA, colB);
  1694.  
  1695.                             vInfo[pInfo[playerid][CarOwner]][ColorA] = colA;
  1696.                             vInfo[pInfo[playerid][CarOwner]][ColorB] = colB;
  1697.  
  1698.                             SaveVehicles();
  1699.  
  1700.                             SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have parked your vehicle!");
  1701.                     }
  1702.  
  1703.                     else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in your personal vehicle!");
  1704.  
  1705.             }
  1706.  
  1707.             else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not near the dealership!");
  1708.  
  1709.             return true;
  1710.     }
  1711.  
  1712.     CMD:vstoregun(playerid, params[])
  1713.     {
  1714.             new slot, string[100], gunname[32], veh = GetPlayerVehicleID(playerid), Float: pos[3];
  1715.             GetWeaponName(GetPlayerWeapon(playerid), gunname, sizeof(gunname));
  1716.             GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  1717.  
  1718.             if(GetPlayerWeapon(playerid) == 0) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not holding any weapon that can be stored!");
  1719.             if(sscanf(params, "i", slot)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /vstoregun [slot: 1-2]");
  1720.  
  1721.             if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle in order to do this command!");
  1722.  
  1723.             if(slot == 1 && vInfo[veh][StoredSlot1] == 0)
  1724.             {
  1725.             vInfo[veh][StoredSlot1] = GetPlayerWeapon(playerid);
  1726.             vInfo[veh][StoredSlot1Ammo] = GetPlayerAmmo(playerid);
  1727.             }
  1728.  
  1729.             else if(vInfo[veh][StoredSlot1] != 0) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The slot you are trying to store a weapon in isn't empty.");
  1730.  
  1731.             if(slot == 2 && vInfo[veh][StoredSlot2] == 0)
  1732.         {
  1733.             vInfo[veh][StoredSlot2] = GetPlayerWeapon(playerid);
  1734.             vInfo[veh][StoredSlot2Ammo] = GetPlayerAmmo(playerid);
  1735.         }
  1736.  
  1737.             else if(vInfo[veh][StoredSlot2] != 0 && slot == 2) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The slot you are trying to store a weapon in isn't empty.");
  1738.  
  1739.             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have stored your %s (%d) in trunk slot %d.", gunname, GetPlayerWeapon(playerid), slot);
  1740.             SendClientMessage(playerid, -1, string);
  1741.  
  1742.             RemovePlayerWeapon(playerid, GetPlayerWeapon(playerid));
  1743.  
  1744.             // START DUPLICATION BUG FIX //
  1745.             SetPlayerPos(playerid, pos[0], pos[1], pos[2] +1);
  1746.             SetTimerEx("FixDuplicationBug", 100, false, "ii", playerid, veh);
  1747.             // END DUPLICATION BUG FIX //
  1748.             SaveVehicles();
  1749.  
  1750.             return true;
  1751.     }
  1752.  
  1753.     CMD:vtakegun(playerid, params[])
  1754.     {
  1755.             new slot, string[100], gunname[32], gunname2[32], veh = GetPlayerVehicleID(playerid), Float: pos[3];
  1756.             GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  1757.  
  1758.             GetWeaponName(vInfo[veh][StoredSlot1], gunname, sizeof(gunname));
  1759.             GetWeaponName(vInfo[veh][StoredSlot2], gunname2, sizeof(gunname2));
  1760.  
  1761.             if(GetPlayerWeapon(playerid) != 0) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're already holding a weapon!");
  1762.             if(sscanf(params, "i", slot)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /vtakegun [slot: 1-2]");
  1763.  
  1764.             if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle in order to do this command!");
  1765.  
  1766.             if(vInfo[veh][StoredSlot1] == 0 && slot == 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The slot you are trying to store a weapon in is empty.");
  1767.             else if(vInfo[veh][StoredSlot2] == 0 && slot == 2) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The slot you are trying to store a weapon in is empty.");
  1768.  
  1769.             if(slot == 1)
  1770.             {
  1771.             GivePlayerWeapon(playerid, vInfo[veh][StoredSlot1], vInfo[veh][StoredSlot1Ammo]);
  1772.             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have taken your %s (%d) from trunk slot %d.", gunname, vInfo[veh][StoredSlot1], slot);
  1773.  
  1774.             vInfo[veh][StoredSlot1] = 0;
  1775.             vInfo[veh][StoredSlot1Ammo] = 0;
  1776.             }
  1777.  
  1778.             else if(slot == 2)
  1779.             {
  1780.                     GivePlayerWeapon(playerid, vInfo[veh][StoredSlot2], vInfo[veh][StoredSlot2Ammo]);
  1781.                     format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have taken your %s (%d) from trunk slot %d.", gunname2, vInfo[veh][StoredSlot2], slot);
  1782.  
  1783.                     vInfo[veh][StoredSlot2] = 0;
  1784.                     vInfo[veh][StoredSlot2Ammo] = 0;
  1785.             }
  1786.  
  1787.             // START DUPLICATION BUG FIX //
  1788.             SetPlayerPos(playerid, pos[0], pos[1], pos[2] +1);
  1789.             SetTimerEx("FixDuplicationBug", 100, false, "ii", playerid, veh);
  1790.             // END DUPLICATION BUG FIX //
  1791.  
  1792.             SendClientMessage(playerid, -1, string);
  1793.  
  1794.             SaveVehicles();
  1795.  
  1796.             return true;
  1797.     }
  1798.  
  1799.     CMD:vpark(playerid, params[])
  1800.     {
  1801.             new Float: pos[4];
  1802.  
  1803.             if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle in order to do this command!");
  1804.  
  1805.             if(pInfo[playerid][CarOwner] == GetPlayerVehicleID(playerid))
  1806.             {
  1807.                 GetVehiclePos(GetPlayerVehicleID(playerid), pos[0], pos[1], pos[2]);
  1808.                 GetVehicleZAngle(GetPlayerVehicleID(playerid), pos[3]);
  1809.  
  1810.                 vInfo[pInfo[playerid][CarOwner]][xPos] = pos[0];
  1811.                 vInfo[pInfo[playerid][CarOwner]][yPos] = pos[1];
  1812.                 vInfo[pInfo[playerid][CarOwner]][zPos] = pos[2];
  1813.                 vInfo[pInfo[playerid][CarOwner]][aPos] = pos[3];
  1814.  
  1815.                 SaveVehicles();
  1816.  
  1817.                 SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have parked your vehicle!");
  1818.             }
  1819.  
  1820.             else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in your personal vehicle!");
  1821.  
  1822.             return true;
  1823.     }
  1824.  
  1825.     CMD:vbuy(playerid)
  1826.     {
  1827.             new count, cars[sizeof(PriceArray)];
  1828.  
  1829.             if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You can't be in a vehicle when performing this command!");
  1830.             if(pInfo[playerid][CarOwner] < 999) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You already own a vehicle!");
  1831.  
  1832.             if(IsPlayerInRangeOfPoint(playerid, 3.0, 1634.9066, -1865.3574, 13.5469))
  1833.             {
  1834.                     for(new i; i < sizeof(PriceArray); i ++)
  1835.                     {
  1836.                             cars[i] = PriceArray[i][0];
  1837.                             count ++;
  1838.                     }
  1839.  
  1840.                     ShowModelSelectionMenuEx(playerid, cars, count, "Dealership", mselection_Dealership, 16.0, 0.0, -55.0, 1.0, 0x333333FF, 0x474747FF, 0xE0E0E0FF);
  1841.             }
  1842.  
  1843.             else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not near the dealership!");
  1844.  
  1845.             return true;
  1846.     }
  1847.  
  1848.     CMD:vscrap(playerid, params[])
  1849.     {
  1850.             new loc[30];
  1851.  
  1852.             if(IsPlayerInRangeOfPoint(playerid, 3.0, 1616.5725, -1892.7927, 13.5482))
  1853.             {
  1854.                     format(loc, 30, "Vehicles/%d.ini", pInfo[playerid][CarOwner]);
  1855.  
  1856.                     if(!fexist(loc)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The vehicle ID you entered doesn't exist.");
  1857.  
  1858.                     else if(fexist(loc))
  1859.                     {
  1860.                             SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have scrapped your vehicle and got back 50 percent from the market price.");
  1861.  
  1862.                             GivePlayerMoney(playerid, vInfo[pInfo[playerid][CarOwner]][Price] / 50);
  1863.                             DestroyVehicle(pInfo[playerid][CarOwner]);
  1864.  
  1865.                             fremove(loc);
  1866.                             vCount --;
  1867.                     }
  1868.             }
  1869.  
  1870.             else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not near the scrapping area!");
  1871.  
  1872.             return true;
  1873.     }
  1874.  
  1875.     CMD:vgive(playerid, params[])
  1876.     {
  1877.             new name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME], string[30], Float: pos[3], targetid;
  1878.  
  1879.             if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle in order to do this command!");
  1880.             if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /vgive [target]");
  1881.  
  1882.             GetPlayerPos(targetid, pos[0], pos[1], pos[2]);
  1883.  
  1884.             if(IsPlayerInRangeOfPoint(playerid, 5.0, pos[0], pos[1], pos[2]))
  1885.             {
  1886.                     if(pInfo[playerid][CarOwner] == GetPlayerVehicleID(playerid))
  1887.                     {
  1888.                             GetPlayerName(playerid, name, sizeof(name));
  1889.                             GetPlayerName(targetid, name2, sizeof(name2));
  1890.  
  1891.                             vInfo[vCount][Owner] = name2;
  1892.  
  1893.                             format(string, sizeof(string), "8EB2D6}[INFO]{FFFFFF}: You have given your vehicle to %s!", name2);
  1894.                             SendClientMessage(playerid, -1, string);
  1895.  
  1896.                             format(string, sizeof(string), "8EB2D6}[INFO]{FFFFFF}: %s has given you their vehicle!", name);
  1897.                             SendClientMessage(targetid, -1, string);
  1898.  
  1899.                             pInfo[targetid][CarOwner] = pInfo[playerid][CarOwner];
  1900.                             pInfo[playerid][CarOwner] = 9999;
  1901.  
  1902.                             vCount ++;
  1903.                     }
  1904.  
  1905.                     else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in your personal vehicle!");
  1906.             }
  1907.  
  1908.             else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not near the player you're trying to interact with!");
  1909.  
  1910.             return true;
  1911.     }
  1912.  
  1913.     CMD:vcreate(playerid, params[])
  1914.     {
  1915.             new Float: pos[4], name[MAX_PLAYER_NAME], model, type, price, plate = random(1000 + 2500), newveh[MAX_PLAYERS], string[30];
  1916.  
  1917.             GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  1918.             GetPlayerFacingAngle(playerid, pos[3]);
  1919.  
  1920.             if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
  1921.             if(sscanf(params, "iii", model, type, price)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /vcreate [model] [type] [price]");
  1922.  
  1923.             format(name, sizeof(name), "None"); // to avoid array error -- size is MAX_PLAYER_NAME, as is hOwner
  1924.  
  1925.             new INI:File = INI_Open(VehiclePath(vCount));
  1926.  
  1927.             INI_SetTag(File, "Vehicle Data");
  1928.  
  1929.             INI_WriteString(File, "Owner", name);
  1930.             vInfo[vCount][Owner] = name;
  1931.  
  1932.             INI_WriteInt(File, "Model", model);
  1933.             vInfo[vCount][Model] = model;
  1934.  
  1935.             INI_WriteInt(File, "Type", type);
  1936.             vInfo[vCount][Type] = type;
  1937.  
  1938.             INI_WriteFloat(File, "xPos", pos[0]);
  1939.             vInfo[vCount][xPos] = pos[0];
  1940.  
  1941.             INI_WriteFloat(File, "yPos", pos[1]);
  1942.             vInfo[vCount][yPos] = pos[1];
  1943.  
  1944.             INI_WriteFloat(File, "zPos", pos[2]);
  1945.             vInfo[vCount][zPos] = pos[2];
  1946.  
  1947.             INI_WriteFloat(File, "aPos", pos[3]);
  1948.             vInfo[vCount][aPos] = pos[3];
  1949.  
  1950.             INI_WriteInt(File, "Price", price);
  1951.             vInfo[vCount][Price] = price;
  1952.  
  1953.             INI_WriteInt(File, "Plate", plate);
  1954.             vInfo[vCount][Plate] = plate;
  1955.  
  1956.             INI_WriteInt(File, "Fuel", 100);
  1957.             vInfo[vCount][Fuel] = 100;
  1958.  
  1959.             INI_WriteInt(File, "StoredSlot1", 0);
  1960.             vInfo[vCount][StoredSlot1] = 0;
  1961.  
  1962.             INI_WriteInt(File, "StoredSlot1Ammo", 0);
  1963.             vInfo[vCount][StoredSlot1Ammo] = 0;
  1964.  
  1965.             INI_WriteInt(File, "StoredSlot2", 0);
  1966.             vInfo[vCount][StoredSlot2] = 0;
  1967.  
  1968.             INI_WriteInt(File, "StoredSlot2Ammo", 0);
  1969.             vInfo[vCount][StoredSlot2Ammo] = 0;
  1970.  
  1971.             INI_Close(File);
  1972.  
  1973.             format(string, sizeof(string), "SA %d", vInfo[vCount][Plate]);
  1974.             newveh[playerid] = CreateVehicle(model, pos[0], pos[1], pos[2], pos[3], 0, 0, -1);
  1975.  
  1976.             SetVehicleNumberPlate(newveh[playerid], string);
  1977.             SetVehicleToRespawn(newveh[playerid]);
  1978.  
  1979.             vCount ++;
  1980.  
  1981.             PutPlayerInVehicle(playerid, newveh[playerid], 0);
  1982.             SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have created a vehicle at your position! Use /vsetvar to set it's variables!");
  1983.  
  1984.             return true;
  1985.     }
  1986.  
  1987.     CMD:vdelete(playerid, params[])
  1988.     {
  1989.             new vid, loc[30], string[80];
  1990.  
  1991.             if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
  1992.             if(sscanf(params, "i", vid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /vdelete [id]");
  1993.  
  1994.             format(loc, 30, "Vehicles/%d.ini", vid);
  1995.  
  1996.             if(!fexist(loc)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The vehicle ID you entered doesn't exist.");
  1997.  
  1998.             else if(fexist(loc))
  1999.             {
  2000.                     format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have deleted vehicle ID: %d.", vid);
  2001.                     SendClientMessage(playerid, -1, string);
  2002.  
  2003.                     KillTimer(FuelTimer[vid]);
  2004.                     DestroyVehicle(vid);
  2005.                     fremove(loc);
  2006.             }
  2007.  
  2008.             vCount --;
  2009.  
  2010.             return true;
  2011.     }
  2012.  
  2013.     // Faction commands
  2014.  
  2015.     CMD:fchat(playerid, params[])
  2016.     {
  2017.             new string[144], text[80];
  2018.  
  2019.             if(pInfo[playerid][FactionID] == 999) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in a faction!");
  2020.             if(sscanf(params, "s[80]", text)) return  SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /fchat [text]");
  2021.  
  2022.             if(strlen(text) > 80 || strlen(text) < 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Text can't be more than 80 or less than 1 character(s).");
  2023.             if(!fChat[pInfo[playerid][FactionID]]) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Your faction has it's chat turned off!");
  2024.  
  2025.             format(string, sizeof(string), "{ [CHAT]: (%d) %s %s: %s }", playerid, pInfo[playerid][FactionRank], GetPlayerName(playerid), text);
  2026.             SendFactionMessage(pInfo[playerid][FactionID], string);
  2027.  
  2028.             print(string);
  2029.  
  2030.             return true;
  2031.     }
  2032.  
  2033.     CMD:fradio(playerid, params[])
  2034.     {
  2035.             new string[144], text[80];
  2036.  
  2037.             if(pInfo[playerid][FactionID] == 999) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in a faction!");
  2038.             if(sscanf(params, "s[80]", text)) return  SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /fradio [text]");
  2039.  
  2040.             if(fInfo[pInfo[playerid][FactionID]][Type] == 1)
  2041.             {
  2042.                     if(strlen(text) > 80 || strlen(text) < 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Text can't be more than 80 or less than 1 character(s).");
  2043.  
  2044.                     format(string, sizeof(string), "{ [RADIO]: (%d) %s %s: %s }", playerid, pInfo[playerid][FactionRank], GetPlayerName(playerid), text);
  2045.                     SendFactionRadioMessage(pInfo[playerid][FactionID], string);
  2046.  
  2047.                     print(string);
  2048.             }
  2049.  
  2050.             else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Your faction doesn't have access to this command!");
  2051.  
  2052.             return true;
  2053.     }
  2054.  
  2055.     CMD:listfactions(playerid, params[])
  2056.     {
  2057.             new string[80];
  2058.  
  2059.             SendClientMessage(playerid, 0x8EB2D6FF, "All factions in the server are listed below.");
  2060.  
  2061.             for(new i; i < MAX_FACTIONS; i ++)
  2062.             {
  2063.                 format(string, sizeof(string), "[ID: %d] [%s] [Type: %d]", i, fInfo[i][Name], fInfo[i][Type]);
  2064.                 SendClientMessage(playerid, 0xDEDEDEFF, string);
  2065.             }
  2066.  
  2067.             return true;
  2068.     }
  2069.  
  2070.     CMD:fset(playerid, params[])
  2071.     {
  2072.             new string[144], targetid, factionid;
  2073.  
  2074.             if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
  2075.             if(sscanf(params, "ui", targetid, factionid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /fset [id/name] [faction]");
  2076.  
  2077.             pInfo[targetid][FactionID] = factionid;
  2078.             pInfo[targetid][FactionTier] = 1;
  2079.  
  2080.             format(string, sizeof(string), "[FACTION] (%d) %s has just set your faction to ID (%d) %s with tier 1.", playerid, GetPlayerName(playerid), factionid, fInfo[factionid][Name]);
  2081.             SendClientMessage(playerid, 0x00E1FFFF, string);
  2082.  
  2083.             format(string, sizeof(string), "[FACTION] You have set (%d) %s's faction to ID (%d) %s with tier 1.", targetid, GetPlayerName(targetid), factionid, fInfo[factionid][Name]);
  2084.             SendClientMessage(playerid, 0x00E1FFFF, string);
  2085.  
  2086.             return true;
  2087.     }
  2088.  
  2089.     CMD:fsettier(playerid, params[])
  2090.     {
  2091.             new string[144], targetid, tier;
  2092.  
  2093.             if(pInfo[playerid][FactionID] == 999) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in a faction!");
  2094.             if(pInfo[playerid][FactionTier] == 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have the correct priviledges to do this command!");
  2095.             if(sscanf(params, "ui", targetid, tier)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /fsettier [id/name] [tier]");
  2096.  
  2097.             pInfo[targetid][FactionTier] = tier;
  2098.  
  2099.             format(string, sizeof(string), "[FACTION]: (%d) %s has just set (%d) %s's tier to %d.", playerid, GetPlayerName(playerid), targetid, GetPlayerName(targetid), tier);
  2100.             SendFactionMessage(pInfo[playerid][FactionID], string);
  2101.  
  2102.             print(string);
  2103.  
  2104.             return true;
  2105.     }
  2106.  
  2107.     CMD:fsetrank(playerid, params[])
  2108.     {
  2109.             new string[144], targetid, rank[MAX_PLAYER_NAME];
  2110.  
  2111.             if(pInfo[playerid][FactionID] == 999) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in a faction!");
  2112.             if(pInfo[playerid][FactionTier] == 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have the correct priviledges to do this command!");
  2113.             if(sscanf(params, "us[24]", targetid, rank)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /fsetrank [id/name] [rank]");
  2114.             if(strlen(rank) > 40 || strlen(rank) < 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Rank can't be more than 40 or less than 1 character(s).");
  2115.  
  2116.             pInfo[targetid][FactionRank] = rank;
  2117.  
  2118.             format(string, sizeof(string), "[FACTION]: (%d) %s has just set (%d) %s's rank to %s.", playerid, GetPlayerName(playerid), targetid, GetPlayerName(targetid), rank);
  2119.             SendFactionMessage(pInfo[playerid][FactionID], string);
  2120.  
  2121.             print(string);
  2122.  
  2123.             return true;
  2124.     }
  2125.  
  2126.     CMD:factionhelp(playerid, params[])
  2127.     {
  2128.             SendClientMessage(playerid, 0x8EB2D6FF, "Faction commands available to you");
  2129.  
  2130.             SendClientMessage(playerid, -1, "{8EB2D6}[PLAYERS]{FFFFFF}: /listfactions");
  2131.             SendClientMessage(playerid, -1, "{8EB2D6}[MEMBER]{FFFFFF}: /fchat, /fradio, /fsetrank, /fsettier, /finvite, /funinvite");
  2132.  
  2133.             return true;
  2134.     }
  2135.  
  2136.     CMD:finvite(playerid, params[])
  2137.     {
  2138.             new string[144], targetid;
  2139.  
  2140.             if(pInfo[playerid][FactionID] == 999) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in a faction!");
  2141.             if(pInfo[playerid][FactionTier] == 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have the correct priviledges to do this command!");
  2142.             if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /finvite [id/name]");
  2143.  
  2144.             pInfo[targetid][FactionID] = pInfo[playerid][FactionID];
  2145.             pInfo[targetid][FactionTier] = 3;
  2146.  
  2147.             format(string, sizeof(string), "[FACTION]: (%d) %s has just invited (%d) %s.", playerid, GetPlayerName(playerid), targetid, GetPlayerName(targetid));
  2148.             SendFactionMessage(pInfo[playerid][FactionID], string);
  2149.  
  2150.             print(string);
  2151.  
  2152.             return true;
  2153.     }
  2154.  
  2155.     CMD:funinvite(playerid, params[])
  2156.     {
  2157.             new string[144], targetid;
  2158.  
  2159.             if(pInfo[playerid][FactionID] == 999) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in a faction!");
  2160.             if(pInfo[playerid][FactionTier] == 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have the correct priviledges to do this command!");
  2161.             if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /funinvite [id/name]");
  2162.  
  2163.             format(string, sizeof(string), "[FACTION]: (%d) %s has just uninvited (%d) %s.", playerid, GetPlayerName(playerid), targetid, GetPlayerName(targetid));
  2164.             SendFactionMessage(pInfo[playerid][FactionID], string);
  2165.  
  2166.             pInfo[targetid][FactionID] = 0;
  2167.             pInfo[targetid][FactionTier] = 0;
  2168.  
  2169.             print(string);
  2170.  
  2171.             return true;
  2172.     }
  2173.  
  2174.     CMD:fcreate(playerid, params[])
  2175.     {
  2176.             new string[110], type, name[40];
  2177.  
  2178.             if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
  2179.             if(sscanf(params, "is[40]", type, name)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /fcreate [type] [text]");
  2180.             if(strlen(name) > 40 || strlen(name) < 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Your text can't have more than 40, or less than 1 character(s)!");
  2181.  
  2182.             new INI:File = INI_Open(FactionPath(fCount));
  2183.  
  2184.             INI_SetTag(File, "Faction Data");
  2185.  
  2186.             INI_WriteString(File, "Name", name);
  2187.             fInfo[fCount][Name] = name;
  2188.  
  2189.             INI_WriteInt(File, "Type", type);
  2190.             fInfo[fCount][Type] = type;
  2191.  
  2192.             INI_Close(File);
  2193.  
  2194.             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You added faction (ID: %d) %s with type %d.", fCount, name, type);
  2195.             SendClientMessage(playerid, -1, string);
  2196.  
  2197.             fCount ++;
  2198.  
  2199.             return true;
  2200.     }
  2201.  
  2202.     CMD:frename(playerid, params[])
  2203.     {
  2204.             new name[40], string[110], factionid;
  2205.  
  2206.             if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
  2207.             if(sscanf(params, "is[40]", factionid, name)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /frename [factionid] [name]");
  2208.             if(strlen(name) > 40 || strlen(name) < 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Your text can't have more than 40, or less than 1 character(s)!");
  2209.  
  2210.             fInfo[factionid][Name] = name;
  2211.  
  2212.             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You added changed a faction ID %d's name to: %s", factionid, name);
  2213.             SendClientMessage(playerid, -1, string);
  2214.  
  2215.             SaveFactions();
  2216.  
  2217.             return true;
  2218.     }
  2219.  
  2220.     CMD:fsettype(playerid, params[])
  2221.     {
  2222.             new type, string[110], factionid;
  2223.  
  2224.             if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
  2225.             if(sscanf(params, "is[40]", factionid, type)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /fsettype [factionid] [type]");
  2226.             if(type < 1 || type > 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Type can't be less than one or more than four!");
  2227.  
  2228.             fInfo[factionid][Type] = type;
  2229.  
  2230.             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You added changed a faction ID %d's type to %d.", factionid, type);
  2231.             SendClientMessage(playerid, -1, string);
  2232.  
  2233.             SaveFactions();
  2234.  
  2235.             return true;
  2236.     }
  2237.  
  2238.     CMD:fdelete(playerid, params[])
  2239.     {
  2240.             new id, loc[30], string[80];
  2241.  
  2242.             if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
  2243.             if(sscanf(params, "i", id)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /fdelete [id]");
  2244.  
  2245.             format(loc, 30, "Factions/%d.ini", id);
  2246.  
  2247.             if(!fexist(loc)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The faction ID you entered doesn't exist.");
  2248.  
  2249.             else if(fexist(loc))
  2250.             {
  2251.                     format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have deleted faction ID: %d.", id);
  2252.                     SendClientMessage(playerid, -1, string);
  2253.  
  2254.                     fremove(loc);
  2255.             }
  2256.  
  2257.             fCount --;
  2258.  
  2259.             return true;
  2260.     }
  2261.  
  2262.     // house commands
  2263.  
  2264.     CMD:househelp(playerid, params[])
  2265.     {
  2266.             SendClientMessage(playerid, 0x8EB2D6FF, "House commands available to you");
  2267.  
  2268.             SendClientMessage(playerid, -1, "{8EB2D6}[OWNED]{FFFFFF}: /hnear, /hbuy, /hsell, /haccess, /hlock");
  2269.  
  2270.             return true;
  2271.     }
  2272.  
  2273.     CMD:hcreate(playerid, params[])
  2274.     {
  2275.             new Float: pos[3], string[100], str2[MAX_PLAYER_NAME], price;
  2276.             GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  2277.  
  2278.             if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
  2279.             if(sscanf(params, "i", price)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /hcreate [price]");
  2280.             format(str2, sizeof(str2), "None"); // to avoid array error -- size is MAX_PLAYER_NAME, as is "Owner"
  2281.  
  2282.             new INI:File = INI_Open(HousePath(hCount));
  2283.  
  2284.             INI_SetTag(File, "House Data");
  2285.  
  2286.             INI_WriteString(File, "Owner", str2);
  2287.             hInfo[hCount][Owner] = str2;
  2288.  
  2289.             INI_WriteInt(File, "Price", price);
  2290.             hInfo[hCount][Price] = price;
  2291.  
  2292.             INI_WriteInt(File, "Bought", 0);
  2293.             hInfo[hCount][Bought] = 0;
  2294.  
  2295.             INI_WriteFloat(File, "ExtX", pos[0]);
  2296.             hInfo[hCount][ExtX] = pos[0];
  2297.  
  2298.             INI_WriteFloat(File, "ExtY", pos[1]);
  2299.             hInfo[hCount][ExtY] = pos[1];
  2300.  
  2301.             INI_WriteFloat(File, "ExtZ", pos[2]);
  2302.             hInfo[hCount][ExtZ] = pos[2];
  2303.  
  2304.             INI_WriteFloat(File, "IntX", 0.0);
  2305.             hInfo[hCount][IntX] = 0.0;
  2306.  
  2307.             INI_WriteFloat(File, "IntY", 0.0);
  2308.             hInfo[hCount][IntX] = 0.0;
  2309.  
  2310.             INI_WriteFloat(File, "IntZ", 0.0);
  2311.             hInfo[hCount][IntX] = 0.0;
  2312.  
  2313.             INI_WriteInt(File, "IntWorld", 2);
  2314.             hInfo[hCount][IntInterior] = 2;
  2315.  
  2316.             INI_WriteInt(File, "IntVW", 0);
  2317.             hInfo[hCount][IntVirtualW] = random(250);
  2318.  
  2319.             INI_WriteInt(File, "VW", GetPlayerVirtualWorld(playerid));
  2320.             hInfo[hCount][World] = GetPlayerVirtualWorld(playerid);
  2321.  
  2322.             INI_WriteInt(File, "World", GetPlayerInterior(playerid));
  2323.             hInfo[hCount][Interior] = GetPlayerInterior(playerid);
  2324.  
  2325.             INI_WriteInt(File, "Locked", 0);
  2326.             hInfo[hCount][Locked] = 0;
  2327.  
  2328.             INI_WriteInt(File, "Initialised", 0);
  2329.             hInfo[hCount][Initialised] = 0;
  2330.  
  2331.             INI_Close(File);
  2332.  
  2333.             format(string, sizeof(string), "{8EB2D6}[HOUSE]{FFFFFF}\nOwner: %s\nPrice: %d", hInfo[hCount][Owner], hInfo[hCount][Price]);
  2334.             hInfo[hCount][Label] = Create3DTextLabel(string, 0xFFFFFFFF, pos[0], pos[1], pos[2], 10.0, GetPlayerVirtualWorld(playerid), 1);
  2335.             hCount ++;
  2336.  
  2337.             SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have created a house at your position! Use /hsetint to set it's interior!");
  2338.  
  2339.             return true;
  2340.     }
  2341.  
  2342.     CMD:hdelete(playerid, params[])
  2343.     {
  2344.             new hid, loc[30], string[80];
  2345.  
  2346.             if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
  2347.             if(sscanf(params, "i", hid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /hdelete [hid]");
  2348.  
  2349.             format(loc, 30, "Houses/%d.ini", hid);
  2350.  
  2351.             if(!fexist(loc)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The house ID you entered doesn't exist.");
  2352.  
  2353.             else if(fexist(loc))
  2354.             {
  2355.                     format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have deleted house ID: %d", hid);
  2356.                     SendClientMessage(playerid, -1, string);
  2357.  
  2358.                     Delete3DTextLabel(hInfo[hid][Label]);
  2359.                     fremove(loc);
  2360.             }
  2361.  
  2362.             return true;
  2363.     }
  2364.  
  2365.     CMD:hsetint(playerid, params[])
  2366.     {
  2367.             new interior, hid, string[80];
  2368.  
  2369.             if(sscanf(params, "ii", hid, interior)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /hsetint [house] [interior]");
  2370.             if(interior < 1 && interior > 25) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: No more than 25 and no less than 1!");
  2371.  
  2372.             if(interior == 1)
  2373.             {
  2374.                     hInfo[hid][IntX] = 2269.7295;
  2375.                     hInfo[hid][IntY] = -1210.5497;
  2376.                     hInfo[hid][IntZ] = 1047.5625;
  2377.  
  2378.                     hInfo[hid][IntInterior] = 10;
  2379.             }
  2380.  
  2381.             if(interior == 2)
  2382.             {
  2383.                     hInfo[hid][IntX] = 225.756989;
  2384.                     hInfo[hid][IntY] = 1240.00;
  2385.                     hInfo[hid][IntZ] = 1082.149902;
  2386.  
  2387.                     hInfo[hid][IntInterior] = 2;
  2388.             }
  2389.  
  2390.             if(interior == 3)
  2391.             {
  2392.                     hInfo[hid][IntX] = 223.1570;
  2393.                     hInfo[hid][IntY] = 1287.4241;
  2394.                     hInfo[hid][IntZ] = 1082.1406;
  2395.  
  2396.                     hInfo[hid][IntInterior] = 1;
  2397.             }
  2398.  
  2399.             if(interior == 4)
  2400.             {
  2401.                     hInfo[hid][IntX] = 225.630997;
  2402.                     hInfo[hid][IntY] = 1022.479980;
  2403.                     hInfo[hid][IntZ] = 1084.069946;
  2404.  
  2405.                     hInfo[hid][IntInterior] = 7;
  2406.             }
  2407.  
  2408.             if(interior == 5)
  2409.             {
  2410.                     hInfo[hid][IntX] = 295.1188;
  2411.                     hInfo[hid][IntY] = 1472.8026;
  2412.                     hInfo[hid][IntZ] = 1080.2578;
  2413.  
  2414.                     hInfo[hid][IntInterior] = 15;
  2415.             }
  2416.  
  2417.             if(interior == 6)
  2418.             {
  2419.                     hInfo[hid][IntX] = 327.9907;
  2420.                     hInfo[hid][IntY] = 1477.7258;
  2421.                     hInfo[hid][IntZ] = 1084.4375;
  2422.  
  2423.                     hInfo[hid][IntInterior] = 15;
  2424.             }
  2425.  
  2426.             if(interior == 7)
  2427.             {
  2428.                     hInfo[hid][IntX] = 386.9067;
  2429.                     hInfo[hid][IntY] = 1471.7839;
  2430.                     hInfo[hid][IntZ] = 1080.1875;
  2431.  
  2432.                     hInfo[hid][IntInterior] = 15;
  2433.             }
  2434.  
  2435.             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: Set house ID %d's interior to ID %d.", hid, interior);
  2436.             SendClientMessage(playerid, -1, string);
  2437.  
  2438.             hInfo[hid][Initialised] = 1;
  2439.             SaveHouses();
  2440.  
  2441.             return true;
  2442.     }
  2443.  
  2444.     CMD:hgoto(playerid, params[])
  2445.     {
  2446.             new hid, string[50];
  2447.  
  2448.             if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "You need to be an admin in order to do this command!");
  2449.             if(sscanf(params, "i", hid)) return SendClientMessage(playerid, -1, "/hgoto [hid]");
  2450.  
  2451.             format(string, sizeof(string), "You teleported to house ID %d", hid);
  2452.             SendClientMessage(playerid, -1, string);
  2453.  
  2454.             SetPlayerPos(playerid, hInfo[hid][ExtX], hInfo[hid][ExtY], hInfo[hid][ExtZ]);
  2455.  
  2456.             return true;
  2457.     }
  2458.  
  2459.     CMD:hmove(playerid, params[])
  2460.     {
  2461.             new hid, string[50], Float: pos[3], hlabel[100];
  2462.             GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  2463.  
  2464.             if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "You need to be an admin in order to do this command!");
  2465.             if(sscanf(params, "i", hid)) return SendClientMessage(playerid, -1, "/hmove [hid]");
  2466.  
  2467.             format(string, sizeof(string), "You teleported to house ID %d", hid);
  2468.             SendClientMessage(playerid, -1, string);
  2469.  
  2470.             hInfo[hid][ExtX] = pos[0];
  2471.             hInfo[hid][ExtY] = pos[1];
  2472.             hInfo[hid][ExtZ] = pos[2];
  2473.  
  2474.             if(hInfo[hid][Bought] == 0) format(hlabel, sizeof(hlabel), "{8EB2D6}[HOUSE]{FFFFFF}\nOwner: %s\nPrice: %d", hInfo[hid][Owner], hInfo[hid][Price]);
  2475.             else if(hInfo[hid][Bought] == 1) format(hlabel, sizeof(hlabel), "{8EB2D6}[HOUSE]{FFFFFF}\nOwner: %s", hInfo[hid][Owner]);
  2476.  
  2477.             Delete3DTextLabel(hInfo[hid][Label]);
  2478.             hInfo[hid][Label] = Create3DTextLabel(hlabel, 0xFFFFFF, pos[0], pos[1], pos[2], 15.0, hInfo[hid][World], 1);
  2479.  
  2480.             SaveHouses();
  2481.  
  2482.             return true;
  2483.     }
  2484.  
  2485.     CMD:hnear(playerid, params[])
  2486.     {
  2487.             new string[30];
  2488.  
  2489.             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a house entrance!");
  2490.  
  2491.             for(new i; i < MAX_HOUSES; i ++)
  2492.             {
  2493.                 if(IsPlayerInRangeOfPoint(playerid, 2.0, hInfo[i][ExtX], hInfo[i][ExtY], hInfo[i][ExtZ]))
  2494.             {
  2495.                     format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're near house ID %d", i);
  2496.                 }
  2497.             }
  2498.  
  2499.             SendClientMessage(playerid, -1, string);
  2500.  
  2501.             return true;
  2502.     }
  2503.  
  2504.     CMD:hbuy(playerid, params[])
  2505.     {
  2506.             new string[80], name[MAX_PLAYER_NAME];
  2507.             GetPlayerName(playerid, name, sizeof(name));
  2508.  
  2509.             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a house entrance!");
  2510.  
  2511.             for(new i; i < MAX_HOUSES; i ++)
  2512.             {
  2513.                 if(IsPlayerInRangeOfPoint(playerid, 2.0, hInfo[i][ExtX], hInfo[i][ExtY], hInfo[i][ExtZ]))
  2514.             {
  2515.                             if(hInfo[i][Bought] == 0)
  2516.                             {
  2517.                                 if(GetPlayerMoney(playerid) >= hInfo[i][Price])
  2518.                                 {
  2519.                                             GivePlayerMoney(playerid, - hInfo[i][Price]);
  2520.                                             pInfo[playerid][HouseOwner] = i;
  2521.  
  2522.                                             hInfo[i][Owner] = name;
  2523.                                             hInfo[i][Bought] = 1;
  2524.  
  2525.                                             format(string, sizeof(string), "{8EB2D6}[HOUSE]{FFFFFF}\nOwner: %s", hInfo[i][Owner]);
  2526.                                             Update3DTextLabelText(hInfo[i][Label], 0xFFFFFF, string);
  2527.  
  2528.                                             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have purchased house ID %d for %d!", i, hInfo[i][Price]);
  2529.                                             break;
  2530.                                     }
  2531.  
  2532.                                     else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have enough money!");
  2533.                             }
  2534.  
  2535.                             else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: This house is not for sale!");
  2536.                 }
  2537.             }
  2538.  
  2539.             SendClientMessage(playerid, -1, string);
  2540.  
  2541.             return true;
  2542.     }
  2543.  
  2544.     CMD:hsell(playerid, params[])
  2545.     {
  2546.             new string[80], name[MAX_PLAYER_NAME];
  2547.             GetPlayerName(playerid, name, sizeof(name));
  2548.  
  2549.             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a house entrance!");
  2550.             format(name, sizeof(name), "None");
  2551.  
  2552.             for(new i; i < MAX_HOUSES; i ++)
  2553.             {
  2554.                 if(IsPlayerInRangeOfPoint(playerid, 2.0, hInfo[i][ExtX], hInfo[i][ExtY], hInfo[i][ExtZ]))
  2555.             {
  2556.                             if(pInfo[playerid][HouseOwner] == i)
  2557.                             {
  2558.                                 if(GetPlayerMoney(playerid) >= hInfo[i][Price])
  2559.                                 {
  2560.                                             GivePlayerMoney(playerid, hInfo[i][Price]);
  2561.                                             pInfo[playerid][HouseOwner] = 0;
  2562.  
  2563.                                             hInfo[i][Owner] = name;
  2564.                                             hInfo[i][Bought] = 0;
  2565.  
  2566.                                             format(string, sizeof(string), "{8EB2D6}[HOUSE]{FFFFFF}\nOwner: %s\nPrice: %d", hInfo[i][Owner], hInfo[i][Price]);
  2567.                                             Update3DTextLabelText(hInfo[i][Label], 0xFFFFFF, string);
  2568.  
  2569.                                             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have sold house ID %d for %d!", i, hInfo[i][Price]);
  2570.                                             break;
  2571.                                     }
  2572.  
  2573.                                     else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have enough money!");
  2574.                             }
  2575.  
  2576.                             else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't own this house!");
  2577.                 }
  2578.             }
  2579.  
  2580.             SendClientMessage(playerid, -1, string);
  2581.  
  2582.             return true;
  2583.     }
  2584.  
  2585.     CMD:hlock(playerid, params[])
  2586.     {
  2587.             new string[80];
  2588.  
  2589.             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a house entrance!");
  2590.  
  2591.             for(new i; i < MAX_HOUSES; i ++)
  2592.             {
  2593.                 if(IsPlayerInRangeOfPoint(playerid, 2.0, hInfo[i][ExtX], hInfo[i][ExtY], hInfo[i][ExtZ]))
  2594.             {
  2595.                             if(pInfo[playerid][HouseOwner] == i)
  2596.                             {
  2597.                                     if(hInfo[playerid][Locked] == 1)
  2598.                                     {
  2599.                                             hInfo[playerid][Locked] = 0;
  2600.                                             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have unlocked your house!");
  2601.                                     }
  2602.  
  2603.                                     else if(hInfo[playerid][Locked] == 0)
  2604.                                     {
  2605.                                             hInfo[playerid][Locked] = 1;
  2606.                                             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have locked your house!");
  2607.                                     }
  2608.  
  2609.                                     SaveHouses();
  2610.                                     break;
  2611.                             }
  2612.  
  2613.                             else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't own this house!");
  2614.                 }
  2615.             }
  2616.  
  2617.             SendClientMessage(playerid, -1, string);
  2618.  
  2619.             return true;
  2620.     }
  2621.  
  2622.     CMD:haccess(playerid, params[])
  2623.     {
  2624.             new string[100];
  2625.  
  2626.             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a house entrance or exit!");
  2627.  
  2628.             for(new i; i < MAX_HOUSES; i ++)
  2629.             {
  2630.                     if(hInfo[i][Locked] == 0)
  2631.                     {
  2632.                 if(hInfo[i][Initialised] == 1)
  2633.                     {
  2634.                                 if(IsPlayerInRangeOfPoint(playerid, 2.0, hInfo[i][ExtX], hInfo[i][ExtY], hInfo[i][ExtZ]))
  2635.                             {
  2636.                                             SetPlayerPos(playerid, hInfo[i][IntX], hInfo[i][IntY], hInfo[i][IntZ]);
  2637.                                             SetPlayerInterior(playerid, hInfo[i][IntInterior]);
  2638.                                             SetPlayerVirtualWorld(playerid, hInfo[i][IntVirtualW]);
  2639.  
  2640.                                             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You entered house ID %d.", i);
  2641.                                             break;
  2642.                                 }
  2643.  
  2644.                                 else if(IsPlayerInRangeOfPoint(playerid, 2.0, hInfo[i][IntX], hInfo[i][IntY], hInfo[i][IntZ]) && GetPlayerVirtualWorld(playerid) == hInfo[i][IntVirtualW])
  2645.                                 {
  2646.                                             SetPlayerPos(playerid, hInfo[i][ExtX], hInfo[i][ExtY], hInfo[i][ExtZ]);
  2647.                                             SetPlayerInterior(playerid, hInfo[i][Interior]);
  2648.                                             SetPlayerVirtualWorld(playerid, hInfo[i][World]);
  2649.  
  2650.                                             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You left house ID %d.", i);
  2651.                                             break;
  2652.                                     }
  2653.                             }
  2654.                     }
  2655.  
  2656.                     else format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: The house you're trying to enter is locked!");
  2657.             }
  2658.  
  2659.             SendClientMessage(playerid, -1, string);
  2660.  
  2661.             return true;
  2662.     }
  2663.  
  2664.     // Label Commands
  2665.  
  2666.     CMD:labelcreate(playerid, params[])
  2667.     {
  2668.             new Float: pos[3], string[110], type, text[40], Float: rad;
  2669.             GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  2670.  
  2671.             if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
  2672.             if(sscanf(params, "is[40]f", type, text, rad)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /labelcreate [type] [text] [radius]");
  2673.             if(strlen(text) > 40 || strlen(text) < 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Your text can't have more than 40, or less than 1 character(s)!");
  2674.  
  2675.             new INI:File = INI_Open(LabelPath(lCount));
  2676.  
  2677.             INI_SetTag(File, "Label Data");
  2678.  
  2679.             INI_WriteString(File, "Text", text);
  2680.             lInfo[lCount][Text] = text;
  2681.  
  2682.             INI_WriteInt(File, "Type", type);
  2683.             lInfo[lCount][Type] = type;
  2684.  
  2685.             INI_WriteFloat(File, "xPos", pos[0]);
  2686.             lInfo[lCount][xPos] = pos[0];
  2687.  
  2688.             INI_WriteFloat(File, "yPos", pos[1]);
  2689.             lInfo[lCount][yPos] = pos[1];
  2690.  
  2691.             INI_WriteFloat(File, "zPos", pos[2]);
  2692.             lInfo[lCount][zPos] = pos[2];
  2693.  
  2694.             INI_WriteFloat(File, "Radius", rad);
  2695.             lInfo[lCount][Radius] = rad;
  2696.  
  2697.             INI_WriteInt(File, "VirtualWorld", GetPlayerVirtualWorld(playerid));
  2698.             lInfo[lCount][VirtualWorld] = GetPlayerVirtualWorld(playerid);
  2699.  
  2700.             INI_Close(File);
  2701.  
  2702.             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You added label %d with the following text: %s", lCount, text);
  2703.             SendClientMessage(playerid, -1, string);
  2704.  
  2705.             Holder[lCount] = Create3DTextLabel(text, 0xFFFFFFFF, pos[0], pos[1], pos[2], rad, GetPlayerVirtualWorld(playerid), 0);
  2706.  
  2707.             lCount ++;
  2708.  
  2709.             return true;
  2710.     }
  2711.  
  2712.     CMD:labelrename(playerid, params[])
  2713.     {
  2714.             new text[40], string[110], labelid;
  2715.  
  2716.             if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
  2717.             if(sscanf(params, "is[40]", labelid, text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /labelrename [labelid] [text]");
  2718.             if(strlen(text) > 40 || strlen(text) < 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Your text can't have more than 40, or less than 1 character(s)!");
  2719.  
  2720.             lInfo[labelid][Text] = text;
  2721.             Update3DTextLabelText(Holder[labelid], 0xFFFFFFFF, text);
  2722.  
  2723.             format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You added changed a label ID %d's text to: %s", labelid, text);
  2724.             SendClientMessage(playerid, -1, string);
  2725.  
  2726.             SaveLabels();
  2727.  
  2728.             return true;
  2729.     }
  2730.  
  2731.     CMD:labelmove(playerid, params[])
  2732.     {
  2733.             new labelid, Float: pos[3];
  2734.             GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  2735.  
  2736.             if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
  2737.             if(sscanf(params, "i", labelid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /labelmove [labelid]");
  2738.  
  2739.             Delete3DTextLabel(Holder[labelid]);
  2740.             Holder[labelid] = Create3DTextLabel(lInfo[labelid][Text], 0xFFFFFFFF, pos[0], pos[1], pos[2], lInfo[labelid][Radius], lInfo[labelid][VirtualWorld], 0);
  2741.  
  2742.             lInfo[labelid][xPos] = pos[0];
  2743.             lInfo[labelid][yPos] = pos[1];
  2744.             lInfo[labelid][zPos] = pos[2];
  2745.  
  2746.             SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have just moved a label to your position..");
  2747.  
  2748.             SaveLabels();
  2749.  
  2750.             return true;
  2751.     }
  2752.  
  2753.     CMD:labeldelete(playerid, params[])
  2754.     {
  2755.             new id, loc[30], string[80];
  2756.  
  2757.             if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
  2758.             if(sscanf(params, "i", id)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /labeldelete [id]");
  2759.  
  2760.             format(loc, 30, "Labels/%d.ini", id);
  2761.  
  2762.             if(!fexist(loc)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The label ID you entered doesn't exist.");
  2763.  
  2764.             else if(fexist(loc))
  2765.             {
  2766.                     format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have deleted label ID: %d", id);
  2767.                     SendClientMessage(playerid, -1, string);
  2768.  
  2769.                     Delete3DTextLabel(Holder[id]);
  2770.                     fremove(loc);
  2771.             }
  2772.  
  2773.             lCount --;
  2774.  
  2775.             return true;
  2776.     }
  2777.  
  2778.     stock LoadVehicleSpeedoTextdraws(playerid)
  2779.     {
  2780.             vSpeedTD[playerid] = CreatePlayerTextDraw(playerid, 548.999694, 417.303710, "100");
  2781.             PlayerTextDrawLetterSize(playerid, vSpeedTD[playerid], 0.449999, 1.600000);
  2782.             PlayerTextDrawColor(playerid, vSpeedTD[playerid], -1);
  2783.             PlayerTextDrawFont(playerid, vSpeedTD[playerid], 2);
  2784.             PlayerTextDrawSetShadow(playerid, vSpeedTD[playerid], 0);
  2785.             PlayerTextDrawSetOutline(playerid, vSpeedTD[playerid], 0);
  2786.  
  2787.             vSpeedTDText[playerid] = CreatePlayerTextDraw(playerid, 582.000061, 420.622009, "KM/H");
  2788.             PlayerTextDrawLetterSize(playerid, vSpeedTDText[playerid], 0.269333, 1.040000);
  2789.             PlayerTextDrawColor(playerid, vSpeedTDText[playerid], -1);
  2790.             PlayerTextDrawFont(playerid, vSpeedTDText[playerid], 1);
  2791.             PlayerTextDrawSetShadow(playerid, vSpeedTDText[playerid], 0);
  2792.             PlayerTextDrawSetOutline(playerid, vSpeedTDText[playerid], 0);
  2793.  
  2794.             vFuelTD[playerid] = CreatePlayerTextDraw(playerid, 548.333251, 405.688964, "100");
  2795.             PlayerTextDrawLetterSize(playerid, vFuelTD[playerid], 0.449999, 1.600000);
  2796.             PlayerTextDrawColor(playerid, vFuelTD[playerid], -1);
  2797.             PlayerTextDrawFont(playerid, vFuelTD[playerid], 2);
  2798.             PlayerTextDrawSetShadow(playerid, vFuelTD[playerid], 0);
  2799.             PlayerTextDrawSetOutline(playerid, vFuelTD[playerid], 0);
  2800.  
  2801.             vFuelTDText[playerid] = CreatePlayerTextDraw(playerid, 580.333190, 407.763122, "FUEL");
  2802.             PlayerTextDrawLetterSize(playerid, vFuelTDText[playerid], 0.333666, 1.197629);
  2803.             PlayerTextDrawColor(playerid, vFuelTDText[playerid], -1);
  2804.             PlayerTextDrawFont(playerid, vFuelTDText[playerid], 1);
  2805.             PlayerTextDrawSetShadow(playerid, vFuelTDText[playerid], 0);
  2806.             PlayerTextDrawSetOutline(playerid, vFuelTDText[playerid], 0);
  2807.  
  2808.             return true;
  2809.     }
  2810.  
  2811.     forward LoadLabelData(l, name[], value[]);
  2812.     public LoadLabelData(l, name[], value[])
  2813.     {
  2814.             INI_String("Text", lInfo[l][Text], MAX_PLAYER_NAME);
  2815.             INI_Int("Type", lInfo[l][Type]);
  2816.  
  2817.             INI_Float("xPos", lInfo[l][xPos]);
  2818.             INI_Float("yPos", lInfo[l][yPos]);
  2819.             INI_Float("zPos", lInfo[l][zPos]);
  2820.  
  2821.             INI_Float("Radius", lInfo[l][Radius]);
  2822.             INI_Int("VirtualWorld", lInfo[l][VirtualWorld]);
  2823.  
  2824.             return true;
  2825.     }
  2826.  
  2827.     stock LabelPath(labelid)
  2828.     {
  2829.             new label[64];
  2830.  
  2831.             format(label, 30, "Labels/%d.ini", labelid);
  2832.             lInfo[labelid][ID] ++; // multiplying
  2833.  
  2834.             return label;
  2835.     }
  2836.  
  2837.     stock SaveLabels()
  2838.     {
  2839.             new file[64];
  2840.  
  2841.             for(new l; l < MAX_LABELS; l ++)
  2842.             {
  2843.                     format(file, sizeof(file), "Labels/%d.ini", l);
  2844.  
  2845.                     if(fexist(file))
  2846.                 {
  2847.                             new INI:File = INI_Open(file);
  2848.  
  2849.                             INI_SetTag(File, "Label Data");
  2850.  
  2851.                             INI_WriteString(File, "Text", lInfo[l][Text]);
  2852.                             INI_WriteInt(File, "Type", lInfo[l][Type]);
  2853.  
  2854.                             INI_WriteFloat(File, "xPos", lInfo[l][xPos]);
  2855.                             INI_WriteFloat(File, "yPos", lInfo[l][yPos]);
  2856.                             INI_WriteFloat(File, "zPos", lInfo[l][zPos]);
  2857.  
  2858.                             INI_WriteFloat(File, "Radius", lInfo[l][Radius]);
  2859.                             INI_WriteInt(File, "VirtualWorld", lInfo[l][VirtualWorld]);
  2860.  
  2861.                             INI_Close(File);
  2862.                     }
  2863.             }
  2864.  
  2865.             return true;
  2866.     }
  2867.  
  2868.     stock LoadLabels()
  2869.     {
  2870.             new string[80], file[64];
  2871.  
  2872.             print("=-=-=-=-=-=-=-=-=-=-=-=-=");
  2873.             print("  Loading 3D Text Labels: \n");
  2874.  
  2875.             for(new l; l < MAX_LABELS; l ++)
  2876.             {
  2877.                     format(file, sizeof(file), "Labels/%d.ini", l);
  2878.  
  2879.                     if(fexist(file))
  2880.                 {
  2881.                             INI_ParseFile(LabelPath(l), "LoadLabelData", false, true, l, true, false);
  2882.  
  2883.                             format(string, sizeof(string), "[ID: %d] %s", l, lInfo[l][Text]);
  2884.  
  2885.                             Holder[lCount] = Create3DTextLabel(string, 0xFFFFFFFF, lInfo[l][xPos], lInfo[l][yPos], lInfo[l][zPos], lInfo[l][Radius], lInfo[l][VirtualWorld], 0);
  2886.                             format(string, sizeof(string), "  Loaded label ID: %d at %f %f %f", l, lInfo[l][xPos], lInfo[l][yPos], lInfo[l][zPos]);
  2887.  
  2888.                             print(string);
  2889.                             lCount ++;
  2890.                     }
  2891.             }
  2892.  
  2893.             printf("\n  %d labels loaded!", lCount);
  2894.             print("=-=-=-=-=-=-=-=-=-=-=-=-=");
  2895.  
  2896.             return true;
  2897.     }
  2898.  
  2899.     stock HousePath(houseid)
  2900.     {
  2901.             new house[64];
  2902.  
  2903.             format(house, 30, "Houses/%d.ini", houseid);
  2904.             hInfo[houseid][ID] ++; // multiplying
  2905.  
  2906.             return house;
  2907.     }
  2908.  
  2909.             forward LoadHouseData(h, name[], value[]);
  2910.             public LoadHouseData(h, name[], value[])
  2911.     {
  2912.             INI_String("Owner", hInfo[h][Owner], MAX_PLAYER_NAME);
  2913.             INI_Int("Price", hInfo[h][Price]);
  2914.             INI_Int("Bought", hInfo[h][Bought]);
  2915.  
  2916.             INI_Float("ExtX", hInfo[h][ExtX]);
  2917.             INI_Float("ExtY", hInfo[h][ExtY]);
  2918.             INI_Float("ExtZ", hInfo[h][ExtZ]);
  2919.  
  2920.             INI_Float("IntX", hInfo[h][IntX]);
  2921.             INI_Float("IntY", hInfo[h][IntY]);
  2922.             INI_Float("IntZ", hInfo[h][IntZ]);
  2923.  
  2924.             INI_Int("IntWorld", hInfo[h][IntInterior]);
  2925.             INI_Int("IntVW", hInfo[h][IntVirtualW]);
  2926.  
  2927.             INI_Int("VW", hInfo[h][World]);
  2928.             INI_Int("World", hInfo[h][Interior]);
  2929.             INI_Int("Locked", hInfo[h][Locked]);
  2930.             INI_Int("Initialised", hInfo[h][Initialised]);
  2931.  
  2932.             return true;
  2933.     }
  2934.  
  2935.     stock SaveHouses()
  2936.     {
  2937.             new file[64];
  2938.  
  2939.             for(new h; h < MAX_HOUSES; h++)
  2940.             {
  2941.                 format(file, sizeof(file), "Houses/%d.ini", h);
  2942.  
  2943.                 if(fexist(file))
  2944.                 {
  2945.                         new INI:File = INI_Open(file);
  2946.  
  2947.                         INI_SetTag(File, "House Data");
  2948.  
  2949.                         INI_WriteString(File, "Owner", hInfo[h][Owner]);
  2950.                         INI_WriteInt(File, "Price", hInfo[h][Price]);
  2951.                         INI_WriteInt(File, "Bought", hInfo[h][Bought]);
  2952.  
  2953.                         INI_WriteFloat(File, "ExtX", hInfo[h][ExtX]);
  2954.                         INI_WriteFloat(File, "ExtY", hInfo[h][ExtY]);
  2955.                         INI_WriteFloat(File, "ExtZ", hInfo[h][ExtZ]);
  2956.  
  2957.                         INI_WriteFloat(File, "IntX", hInfo[h][IntX]);
  2958.                         INI_WriteFloat(File, "IntY", hInfo[h][IntY]);
  2959.                         INI_WriteFloat(File, "IntZ", hInfo[h][IntZ]);
  2960.  
  2961.                         INI_WriteInt(File, "IntVW", hInfo[h][IntVirtualW]);
  2962.                         INI_WriteInt(File, "IntWorld", hInfo[h][IntInterior]);
  2963.  
  2964.                         INI_WriteInt(File, "VW", hInfo[h][World]);
  2965.                         INI_WriteInt(File, "World", hInfo[h][Interior]);
  2966.                         INI_WriteInt(File, "Locked", hInfo[h][Locked]);
  2967.                         INI_WriteInt(File, "Initialised", hInfo[h][Initialised]);
  2968.  
  2969.                         INI_Close(File);
  2970.                     }
  2971.             }
  2972.  
  2973.             return true;
  2974.     }
  2975.  
  2976.     stock LoadHouses()
  2977.     {
  2978.             new hlabel[128], file[64];
  2979.  
  2980.             print("=-=-=-=-=-=-=-=-=-=-=-=-=");
  2981.             print("\n  Loading Houses: \n");
  2982.  
  2983.             for(new h; h < MAX_HOUSES; h++)
  2984.             {
  2985.                     format(file, sizeof(file), "Houses/%d.ini", h);
  2986.  
  2987.                     if(fexist(file))
  2988.                 {
  2989.                             INI_ParseFile(HousePath(h), "LoadHouseData", false, true, h, true, false);
  2990.  
  2991.                             if(hInfo[h][Bought] == 0) format(hlabel, sizeof(hlabel), "{8EB2D6}[HOUSE]{FFFFFF}\nOwner: %s\nPrice: %d", hInfo[h][Owner], hInfo[h][Price]);
  2992.                             else if(hInfo[h][Bought] == 1) format(hlabel, sizeof(hlabel), "{8EB2D6}[HOUSE]{FFFFFF}\nOwner: %s", hInfo[h][Owner]);
  2993.  
  2994.                             hInfo[h][Label] = Create3DTextLabel(hlabel, 0xFFFFFF, hInfo[h][ExtX], hInfo[h][ExtY], hInfo[h][ExtZ], 15.0, hInfo[h][World], 1);
  2995.                             format(hlabel, sizeof(hlabel), "  Loaded house ID: %d at %f %f %f", h, hInfo[h][ExtX], hInfo[h][ExtY], hInfo[h][ExtZ]);
  2996.  
  2997.                             print(hlabel);
  2998.                             hCount ++;
  2999.                     }
  3000.             }
  3001.  
  3002.             printf("\n  %d houses loaded!", hCount);
  3003.             print("=-=-=-=-=-=-=-=-=-=-=-=-=");
  3004.  
  3005.             return true;
  3006.     }
  3007.  
  3008.     forward LoadFactionData(f, name[], value[]);
  3009.     public LoadFactionData(f, name[], value[])
  3010.     {
  3011.         INI_String("Name", fInfo[f][Name], 40);
  3012.         INI_Int("Type", fInfo[f][Type]);
  3013.  
  3014.         return true;
  3015.     }
  3016.  
  3017.     stock SendFactionMessage(factionid, text[])
  3018.     {
  3019.             for(new i; i < GetMaxPlayers(); i ++)
  3020.             {
  3021.                 if(pInfo[i][FactionID] == factionid)
  3022.                 {
  3023.                     SendClientMessage(i, 0x52BAE3FF, text);
  3024.                 }
  3025.             }
  3026.  
  3027.             return true;
  3028.     }
  3029.  
  3030.     stock SendFactionRadioMessage(factionid, text[])
  3031.     {
  3032.             for(new i; i < GetMaxPlayers(); i ++)
  3033.             {
  3034.                 if(pInfo[i][FactionID] == factionid)
  3035.                 {
  3036.                     SendClientMessage(i, 0xE37B52FF, text);
  3037.                 }
  3038.             }
  3039.  
  3040.             return true;
  3041.     }
  3042.  
  3043.     stock FactionPath(factionid)
  3044.     {
  3045.             new faction[64];
  3046.  
  3047.             format(faction, 30, "Factions/%d.ini", factionid);
  3048.             fInfo[factionid][ID] ++; // multiplying
  3049.  
  3050.             return faction;
  3051.     }
  3052.  
  3053.     stock SaveFactions()
  3054.     {
  3055.             new file[64];
  3056.  
  3057.             for(new f; f < MAX_FACTIONS; f ++)
  3058.             {
  3059.                 format(file, sizeof(file), "Factions/%d.ini", f);
  3060.  
  3061.                 if(fexist(file))
  3062.                 {
  3063.                             new INI:File = INI_Open(file);
  3064.  
  3065.                             INI_SetTag(File, "Faction Data");
  3066.  
  3067.                             INI_WriteString(File, "Name", fInfo[f][Name]);
  3068.                             INI_WriteInt(File, "Type", fInfo[f][Type]);
  3069.  
  3070.                             INI_Close(File);
  3071.                     }
  3072.             }
  3073.  
  3074.             return true;
  3075.     }
  3076.  
  3077.     stock LoadFactions()
  3078.     {
  3079.             new string[80], file[64];
  3080.  
  3081.             print("=-=-=-=-=-=-=-=-=-=-=-=-=");
  3082.             print("\n  Loading Factions: \n");
  3083.  
  3084.             for(new f; f < MAX_FACTIONS; f ++)
  3085.             {
  3086.                     format(file, sizeof(file), "Factions/%d.ini", f);
  3087.  
  3088.                     if(fexist(file))
  3089.                 {
  3090.                     INI_ParseFile(FactionPath(f), "LoadFactionData", false, true, f, true, false);
  3091.  
  3092.                     format(string, sizeof(string), "  Loaded faction: (%d) %s with type: %d", f, fInfo[f][Name], fInfo[f][Type]);
  3093.  
  3094.                     print(string);
  3095.                     fCount ++;
  3096.                     }
  3097.             }
  3098.  
  3099.             printf("\n  %d factions loaded!", fCount);
  3100.             print("=-=-=-=-=-=-=-=-=-=-=-=-=");
  3101.  
  3102.             return true;
  3103.     }
  3104.  
  3105.     forward LoadVehicleData(v, name[], value[]);
  3106.     public LoadVehicleData(v, name[], value[])
  3107.     {
  3108.             INI_String("Owner", vInfo[v][Owner], MAX_PLAYER_NAME);
  3109.             INI_Int("Type", vInfo[v][Type]);
  3110.             INI_Int("Model", vInfo[v][Model]);
  3111.  
  3112.             INI_Float("xPos", vInfo[v][xPos]);
  3113.             INI_Float("yPos", vInfo[v][yPos]);
  3114.             INI_Float("zPos", vInfo[v][zPos]);
  3115.             INI_Float("aPos", vInfo[v][aPos]);
  3116.  
  3117.             INI_Int("Faction", vInfo[v][Faction]);
  3118.             INI_Int("Price", vInfo[v][Price]);
  3119.             INI_Int("Plate", vInfo[v][Plate]);
  3120.             INI_Int("Fuel", vInfo[v][Fuel]);
  3121.  
  3122.             INI_Int("StoredSlot1", vInfo[v][StoredSlot1]);
  3123.             INI_Int("StoredSlot1Ammo", vInfo[v][StoredSlot1Ammo]);
  3124.             INI_Int("StoredSlot2", vInfo[v][StoredSlot2]);
  3125.             INI_Int("StoredSlot2Ammo", vInfo[v][StoredSlot2Ammo]);
  3126.  
  3127.             return true;
  3128.     }
  3129.  
  3130.     stock AddPlayerVehicle(playerid, modelid, price)
  3131.     {
  3132.             new name[MAX_PLAYER_NAME], plate = random(1000 + 2500), string[30], engine, lights, alarm, doors, bonnet, boot, objective;
  3133.             GetVehicleParamsEx(pBuyingCar[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
  3134.             GetPlayerName(playerid, name, sizeof(name));
  3135.  
  3136.             new INI:File = INI_Open(VehiclePath(vCount));
  3137.  
  3138.             INI_SetTag(File, "Vehicle Data");
  3139.  
  3140.             INI_WriteString(File, "Owner", name);
  3141.             vInfo[vCount][Owner] = name;
  3142.  
  3143.             INI_WriteInt(File, "Model", modelid);
  3144.             vInfo[vCount][Model] = modelid;
  3145.  
  3146.             INI_WriteInt(File, "Type", 0);
  3147.             vInfo[vCount][Type] = 0;
  3148.  
  3149.             INI_WriteFloat(File, "xPos", 1645.6632);
  3150.             vInfo[vCount][xPos] = 1645.6632;
  3151.  
  3152.             INI_WriteFloat(File, "yPos", -1834.9017);
  3153.             vInfo[vCount][yPos] = -1834.9017;
  3154.  
  3155.             INI_WriteFloat(File, "zPos", 13.5477);
  3156.             vInfo[vCount][zPos] = 13.5477;
  3157.  
  3158.             INI_WriteFloat(File, "aPos", 77.1374);
  3159.             vInfo[vCount][aPos] = 77.1374;
  3160.  
  3161.             INI_WriteInt(File, "Price", price);
  3162.             vInfo[vCount][Price] = price;
  3163.  
  3164.             INI_WriteInt(File, "Faction", 0);
  3165.             vInfo[vCount][Faction] = 0;
  3166.  
  3167.             INI_WriteInt(File, "Plate", plate);
  3168.             vInfo[vCount][Plate] = plate;
  3169.  
  3170.             INI_WriteInt(File, "Fuel", 100);
  3171.             vInfo[vCount][Fuel] = 100;
  3172.  
  3173.             INI_WriteInt(File, "StoredSlot1", 0);
  3174.             vInfo[vCount][StoredSlot1] = 0;
  3175.  
  3176.             INI_WriteInt(File, "StoredSlot1Ammo", 0);
  3177.             vInfo[vCount][StoredSlot1] = 0;
  3178.  
  3179.             INI_WriteInt(File, "StoredSlot2", 0);
  3180.             vInfo[vCount][StoredSlot2] = 0;
  3181.  
  3182.             INI_WriteInt(File, "StoredSlot2Ammo", 0);
  3183.             vInfo[vCount][StoredSlot2] = 0;
  3184.  
  3185.             INI_Close(File);
  3186.  
  3187.             format(string, sizeof(string), "SA %d", vInfo[vCount][Plate]);
  3188.             SetVehicleNumberPlate(pBuyingCar[playerid], string);
  3189.  
  3190.             SetVehicleToRespawn(pBuyingCar[playerid]);
  3191.  
  3192.             SetVehiclePos(pBuyingCar[playerid], 1645.6632, -1834.9017, 13.5477);
  3193.             SetVehicleZAngle(pBuyingCar[playerid], 77.1374);
  3194.  
  3195.             pInfo[playerid][CarOwner] = vCount;
  3196.             vEngine[vCount] = false;
  3197.             SetVehicleParamsEx(vCount, 0, lights, alarm, 1, bonnet, boot, objective);
  3198.  
  3199.             vCount ++;
  3200.  
  3201.             return true;
  3202.     }
  3203.  
  3204.     stock VehiclePath(vehicleid)
  3205.     {
  3206.             new vehicle[64];
  3207.  
  3208.             format(vehicle, 30, "Vehicles/%d.ini", vehicleid);
  3209.             vInfo[vehicleid][ID] ++; // multiplying
  3210.  
  3211.             return vehicle;
  3212.     }
  3213.  
  3214.     stock SaveVehicles()
  3215.     {
  3216.             new file[64];
  3217.  
  3218.             for(new v; v < MAX_VEHICLES; v ++)
  3219.             {
  3220.                     format(file, sizeof(file), "Vehicles/%d.ini", v);
  3221.  
  3222.                     if(fexist(file))
  3223.                 {
  3224.                             new INI:File = INI_Open(file);
  3225.  
  3226.                             INI_SetTag(File, "Vehicle Data");
  3227.  
  3228.                             INI_WriteString(File, "Owner", vInfo[v][Owner]);
  3229.                             INI_WriteInt(File, "Type", vInfo[v][Type]);
  3230.                             INI_WriteInt(File, "Model", vInfo[v][Model]);
  3231.  
  3232.                             INI_WriteFloat(File, "xPos", vInfo[v][xPos]);
  3233.                             INI_WriteFloat(File, "yPos", vInfo[v][yPos]);
  3234.                             INI_WriteFloat(File, "zPos", vInfo[v][zPos]);
  3235.                             INI_WriteFloat(File, "aPos", vInfo[v][aPos]);
  3236.  
  3237.                             INI_WriteInt(File, "Faction", vInfo[v][Faction]);
  3238.                             INI_WriteInt(File, "Price", vInfo[v][Price]);
  3239.                             INI_WriteInt(File, "Plate", vInfo[v][Plate]);
  3240.                             INI_WriteInt(File, "Fuel", vInfo[v][Fuel]);
  3241.  
  3242.                             INI_WriteInt(File, "StoredSlot1", vInfo[v][StoredSlot1]);
  3243.                             INI_WriteInt(File, "StoredSlot1Ammo", vInfo[v][StoredSlot1Ammo]);
  3244.                             INI_WriteInt(File, "StoredSlot2", vInfo[v][StoredSlot2]);
  3245.                             INI_WriteInt(File, "StoredSlot2Ammo", vInfo[v][StoredSlot2Ammo]);
  3246.  
  3247.                             INI_Close(File);
  3248.                     }
  3249.             }
  3250.  
  3251.             return true;
  3252.     }
  3253.  
  3254.     stock LoadVehicles()
  3255.     {
  3256.             new string[80], file[64], engine, lights, alarm, doors, bonnet, boot, objective, corrCount;
  3257.  
  3258.             print("=-=-=-=-=-=-=-=-=-=-=-=-=");
  3259.             print("\n  Loading Vehicles: \n");
  3260.  
  3261.             for(new v; v < MAX_VEHICLES; v ++)
  3262.             {
  3263.                     GetVehicleParamsEx(v, engine, lights, alarm, doors, bonnet, boot, objective);
  3264.  
  3265.                     format(file, sizeof(file), "Vehicles/%d.ini", v);
  3266.  
  3267.                     if(fexist(file))
  3268.                 {
  3269.                             INI_ParseFile(VehiclePath(v), "LoadVehicleData", false, true, v, true, false);
  3270.  
  3271.                             format(string, sizeof(string), "SA %d", vInfo[v][Plate]);
  3272.                             SetVehicleNumberPlate(v, string);
  3273.  
  3274.                             SetVehicleToRespawn(v); // respawning so the license plate shows
  3275.                             SetVehicleParamsEx(v, 0, lights, alarm, 1, bonnet, boot, objective);
  3276.  
  3277.                             vEngine[v] = false;
  3278.                             vLocked[v] = true;
  3279.  
  3280.                             format(string, sizeof(string), "  Loaded vehicle ID: %d at %f %f %f", v, vInfo[v][xPos], vInfo[v][yPos], vInfo[v][zPos]);
  3281.                             CreateVehicle(vInfo[v][Model], vInfo[v][xPos], vInfo[v][yPos], vInfo[v][zPos], vInfo[v][aPos], vInfo[v][ColorA], vInfo[v][ColorB], -1);
  3282.  
  3283.                             print(string);
  3284.                             vCount ++;
  3285.                     }
  3286.             }
  3287.  
  3288.             // Since vCount requires ID 1 to function properly, we don't actually load "1" vehicle.
  3289.             corrCount = vCount - 1; // This fixes the +1 bug and shouldn't be removed.
  3290.  
  3291.             printf("\n  %d vehicles loaded!", corrCount);
  3292.             print("=-=-=-=-=-=-=-=-=-=-=-=-=");
  3293.  
  3294.             return true;
  3295.     }
  3296.  
  3297.     stock ShowDealershipDialog(playerid, modelid)
  3298.     {
  3299.             new string[200];
  3300.  
  3301.             for (new i; i != sizeof (PriceArray); ++ i)
  3302.             {
  3303.                 if (PriceArray[i][0] == modelid)
  3304.                 {
  3305.                             format(string, sizeof(string),
  3306.                             "{FFFFFF}Note, you are purchasing the following:\n\n{8EB2D6}Model{FFFFFF}: %s (%d)\n{8EB2D6}Price{FFFFFF}: $%d\n\nPress ''buy'' to buy the vehicle, or ''cancel'' to go back.",
  3307.                             GetVehicleName(pBuyingCar[playerid]), modelid, PriceArray[i][1]);
  3308.  
  3309.                             TogglePlayerControllable(playerid, false);
  3310.                             ShowPlayerDialog(playerid, dialog_DealershipConfirm, DIALOG_STYLE_MSGBOX, "Notice", string, "Buy", "Cancel");
  3311.  
  3312.                             break;
  3313.                 }
  3314.             }
  3315.  
  3316.             return true;
  3317.     }
  3318.  
  3319.     stock GetVehicleName(vehicleid)
  3320.     { // Credits to Tee
  3321.             new string[20];
  3322.  
  3323.             format(string, sizeof(string), "%s", VehicleNames[GetVehicleModel(vehicleid) - 400]);
  3324.  
  3325.             return string;
  3326.     }
  3327.  
  3328.     stock RemovePlayerWeapon(playerid, weaponid)
  3329.     {
  3330.             new plyWeapons[12], plyAmmo[12], wep, ammo;
  3331.  
  3332.             for(new slot = 0; slot != 12; slot++)
  3333.             {
  3334.                     GetPlayerWeaponData(playerid, slot, wep, ammo);
  3335.  
  3336.                     if(wep != weaponid)
  3337.                     {
  3338.                     GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]);
  3339.                     }
  3340.             }
  3341.  
  3342.             ResetPlayerWeapons(playerid);
  3343.  
  3344.             for(new slot = 0; slot != 12; slot++)
  3345.             {
  3346.                     GivePlayerWeapon(playerid, plyWeapons[slot], plyAmmo[slot]);
  3347.             }
  3348.  
  3349.             return true;
  3350.     }
  3351.  
  3352.     forward FixDuplicationBug(playerid, vehicleid);
  3353.     public FixDuplicationBug(playerid, vehicleid) return PutPlayerInVehicle(playerid, vehicleid, 0);
  3354.  
  3355.     forward FuelTimerTick(vehicleid);
  3356.     public FuelTimerTick(vehicleid)
  3357.     {
  3358.             new engine, lights, alarm, doors, bonnet, boot, objective;
  3359.             GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  3360.  
  3361.             if(vInfo[vehicleid][Fuel] > 1)
  3362.             {
  3363.                 vInfo[vehicleid][Fuel] --;
  3364.             }
  3365.  
  3366.             else if(vInfo[vehicleid][Fuel] <= 1)
  3367.             {
  3368.                     SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
  3369.  
  3370.                     for(new i; i < MAX_PLAYERS; i ++)
  3371.             {
  3372.                     if(IsPlayerInVehicle(i, vehicleid) && GetPlayerVehicleSeat(i) == 0)
  3373.                     {
  3374.                                     SendClientMessage(i, -1, "{8EB2D6}[INFO]{FFFFFF}: Your car has just ran out of fuel.");
  3375.                                     break;
  3376.                             }
  3377.                     }
  3378.  
  3379.                     KillTimer(FuelTimer[vehicleid]);
  3380.                     vEngine[vehicleid] = false;
  3381.             }
  3382.  
  3383.             return true;
  3384.     }
  3385.  
  3386.     forward FillingTimerEx(playerid, vehicleid);
  3387.     public FillingTimerEx(playerid, vehicleid)
  3388.     {
  3389.             new string[35];
  3390.  
  3391.             if(vInfo[vehicleid][Fuel] < 99)
  3392.             {
  3393.                     format(string, sizeof(string), "~w~Refilling: ~r~ %d~w~/~g~100", vInfo[vehicleid][Fuel]);
  3394.                     vInfo[vehicleid][Fuel] ++;
  3395.             }
  3396.  
  3397.             else if(vInfo[vehicleid][Fuel] == 100)
  3398.             {
  3399.                     SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have refilled your vehicle for $100!");
  3400.                     GivePlayerMoney(playerid, -100);
  3401.  
  3402.                     format(string, sizeof(string), "~w~Refilling: ~g~ %d~w~/~g~100", vInfo[vehicleid][Fuel]);
  3403.                     TogglePlayerControllable(playerid, true);
  3404.  
  3405.                     KillTimer(FillingTimer[playerid]);
  3406.             }
  3407.  
  3408.             GameTextForPlayer(playerid, string, 1000, 4);
  3409.  
  3410.             return true;
  3411.     }
  3412.  
  3413.     forward Float: GetVehicleSpeed(vehicleid);
  3414.     public Float: GetVehicleSpeed(vehicleid)
  3415.     {
  3416.         new Float:Vel[3];
  3417.  
  3418.         GetVehicleVelocity(vehicleid, Vel[0], Vel[1], Vel[2]);
  3419.  
  3420.         Vel[0] *= 175;
  3421.         Vel[1] *= 175;
  3422.         Vel[2] *= 175;
  3423.  
  3424.         return Float: VectorSize(Vel[0], Vel[1], Vel[2]);
  3425.     }
  3426.  
  3427.     stock SplitMessage(playerid, colorA, colorB, colorC, colorD, text[])
  3428.     {
  3429.         if(strlen(text) <= 118) return SendClientMessage(playerid, colorA, text);
  3430.  
  3431.         if(strlen(text) >= 100 && strlen(text) <= 125)
  3432.             {
  3433.             new texts[61]; // second part of text
  3434.             strmid(texts, text, 119, 132), strins(text, " ..", 118, 3), strdel(text, 121, 129);
  3435.  
  3436.             SendNearbyMessage(playerid, colorA, colorB, colorC, colorD, text);
  3437.             SendNearbyMessage(playerid, colorA, colorB, colorC, colorD, texts);
  3438.         }
  3439.  
  3440.             else if(strlen(text) >= 125) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Your message is too long! (1-125)");
  3441.  
  3442.         return true;
  3443.     }
  3444.  
  3445.             stock SendNearbyMessage(playerid, colorA, colorB, colorC, colorD, text[])
  3446.     {
  3447.             new Float: tsPos[3];
  3448.             GetPlayerPos(playerid, tsPos[0], tsPos[1], tsPos[2]);
  3449.  
  3450.             for(new i; i < MAX_PLAYERS; i ++)
  3451.             {
  3452.                 if(IsPlayerInRangeOfPoint(i, 1.0, tsPos[0], tsPos[1], tsPos[2])) SendClientMessage(i, colorA, text);
  3453.  
  3454.                 else if(IsPlayerInRangeOfPoint(i, 2.0, tsPos[0], tsPos[1], tsPos[2])) SendClientMessage(i, colorB, text);
  3455.  
  3456.                 else if(IsPlayerInRangeOfPoint(i, 4.0, tsPos[0], tsPos[1], tsPos[2])) SendClientMessage(i, colorC, text);
  3457.  
  3458.                 else if(IsPlayerInRangeOfPoint(i, 6.0, tsPos[0], tsPos[1], tsPos[2])) SendClientMessage(i, colorD, text);
  3459.             }
  3460.  
  3461.             return true;
  3462.     }
  3463.  
  3464.  
  3465.     stock Path(playerid)
  3466.     {
  3467.         new str[35], name[MAX_PLAYER_NAME];
  3468.  
  3469.         GetPlayerName(playerid, name, sizeof(name));
  3470.         format(str, sizeof(str), "Users/%s.ini", name);
  3471.  
  3472.         return str;
  3473.     }
  3474.  
  3475.     stock SavePlayer(playerid)
  3476.     {
  3477.         new INI:file = INI_Open(Path(playerid));
  3478.  
  3479.         INI_SetTag(file, "Account Data");
  3480.  
  3481.         INI_WriteString(file, "Password", pInfo[playerid][Pass]);
  3482.  
  3483.         INI_WriteInt(file, "Admin", pInfo[playerid][Admin]);
  3484.         INI_WriteInt(file, "Helper", pInfo[playerid][Helper]);
  3485.         INI_WriteInt(file, "Level", pInfo[playerid][Level]);
  3486.         INI_WriteInt(file, "Exp", pInfo[playerid][Exp]);
  3487.         INI_WriteInt(file, "ExpLeft", pInfo[playerid][ExpLeft]);
  3488.  
  3489.         INI_WriteInt(file, "FactionID", pInfo[playerid][FactionID]);
  3490.         INI_WriteInt(file, "FactionTier", pInfo[playerid][FactionTier]);
  3491.         INI_WriteString(file, "FactionRank", pInfo[playerid][FactionRank]);
  3492.  
  3493.         INI_WriteInt(file, "HouseOwner", pInfo[playerid][HouseOwner]);
  3494.         INI_WriteInt(file, "CarOwner", pInfo[playerid][CarOwner]);
  3495.         INI_WriteInt(file, "BizOwner", pInfo[playerid][BizOwner]);
  3496.  
  3497.         INI_WriteInt(file, "Weapon1", pInfo[playerid][Weapon1]);
  3498.         INI_WriteInt(file, "Weapon1Ammo", pInfo[playerid][Weapon1Ammo]);
  3499.         INI_WriteInt(file, "Weapon2", pInfo[playerid][Weapon2]);
  3500.         INI_WriteInt(file, "Weapon2Ammo", pInfo[playerid][Weapon2Ammo]);
  3501.         INI_WriteInt(file, "Weapon3", pInfo[playerid][Weapon3]);
  3502.         INI_WriteInt(file, "Weapon3Ammo", pInfo[playerid][Weapon3Ammo]);
  3503.  
  3504.         INI_WriteInt(file, "HandMoney", GetPlayerMoney(playerid));
  3505.         INI_WriteInt(file, "BankMoney", pInfo[playerid][BankMoney]);
  3506.  
  3507.         INI_WriteInt(file, "Phone", pInfo[playerid][Phone]);
  3508.         INI_WriteInt(file, "PhoneNumber", pInfo[playerid][Phone]);
  3509.         INI_WriteInt(file, "Mask", pInfo[playerid][Mask]);
  3510.         INI_WriteInt(file, "MaskNumber", pInfo[playerid][Mask]);
  3511.         INI_WriteInt(file, "SkinID", GetPlayerSkin(playerid));
  3512.  
  3513.         INI_Close(file);
  3514.  
  3515.         return true;
  3516.     }
  3517.  
  3518.     forward loadaccount_user(playerid, name[], value[]);
  3519.     public loadaccount_user(playerid, name[], value[])
  3520.     {
  3521.         INI_String("Password", pInfo[playerid][Pass], 129);
  3522.         INI_Int("Admin", pInfo[playerid][Admin]);
  3523.         INI_Int("Helper", pInfo[playerid][Helper]);
  3524.         INI_Int("Level", pInfo[playerid][Level]);
  3525.         INI_Int("Exp", pInfo[playerid][Exp]);
  3526.         INI_Int("ExpLeft", pInfo[playerid][ExpLeft]);
  3527.  
  3528.         INI_Int("FactionID", pInfo[playerid][FactionID]);
  3529.         INI_Int("FactionTier", pInfo[playerid][FactionTier]);
  3530.         INI_String("FactionRank", pInfo[playerid][FactionRank], 24);
  3531.  
  3532.         INI_Int("HouseOwner", pInfo[playerid][HouseOwner]);
  3533.         INI_Int("CarOwner", pInfo[playerid][CarOwner]);
  3534.         INI_Int("BizOwner", pInfo[playerid][BizOwner]);
  3535.  
  3536.         INI_Int("Weapon1", pInfo[playerid][Weapon1]);
  3537.         INI_Int("Weapon1Ammo", pInfo[playerid][Weapon1Ammo]);
  3538.         INI_Int("Weapon2", pInfo[playerid][Weapon2]);
  3539.         INI_Int("Weapon2Ammo", pInfo[playerid][Weapon2Ammo]);
  3540.         INI_Int("Weapon3", pInfo[playerid][Weapon3]);
  3541.         INI_Int("Weapon3Ammo", pInfo[playerid][Weapon3Ammo]);
  3542.  
  3543.         INI_Int("HandMoney", pInfo[playerid][HandMoney]);
  3544.         INI_Int("BankMoney", pInfo[playerid][BankMoney]);
  3545.  
  3546.         INI_Int("Phone", pInfo[playerid][Phone]);
  3547.         INI_Int("PhoneNumber", pInfo[playerid][Phone]);
  3548.         INI_Int("Mask", pInfo[playerid][Mask]);
  3549.         INI_Int("MaskNumber", pInfo[playerid][Mask]);
  3550.         INI_Int("SkinID", pInfo[playerid][SkinID]);
  3551.  
  3552.         return true;
  3553.     }
  3554.  
  3555.     stock GetPlayerFirstName(playerid)
  3556.     {
  3557.         new szName[MAX_PLAYER_NAME], iPos;
  3558.         GetPlayerName(playerid, szName, sizeof(szName));
  3559.  
  3560.         iPos = strfind(szName, "_"); // underline is found
  3561.         if(iPos != -1) szName[iPos] = EOS; // EOS defines END OF STRING
  3562.  
  3563.         return szName; // returns new name
  3564.     }
  3565.  
  3566.     stock IsRPName(const name[], max_underscores = 1)
  3567.     {
  3568.         new underscores = 0;
  3569.  
  3570.         if (name[0] < 'A' || name[0] > 'Z') return false; // first letter != capital
  3571.  
  3572.         for(new i = 1; i < strlen(name); i++)
  3573.         {
  3574.             if(name[i] != '_' && (name[i] < 'A' || name[i] > 'Z') && (name[i] < 'a' || name[i] > 'z')) return false; // a-zA-Z_
  3575.             if( (name[i] >= 'A' && name[i] <= 'Z') && (name[i - 1] != '_') ) return false; // unneeded capital letter
  3576.  
  3577.             if(name[i] == '_')
  3578.             {
  3579.                 underscores++;
  3580.                 if(underscores > max_underscores || i == strlen(name)) return false; // more than defined underline
  3581.                 if(name[i + 1] < 'A' || name[i + 1] > 'Z') return false; // no capital letter after underline
  3582.             }
  3583.         }
  3584.  
  3585.         if (underscores == 0) return false; // no underline
  3586.  
  3587.         return true;
  3588.     }
  3589.  
  3590.     stock DelayedKick(playerid) SetTimerEx("DelayedKicker", 250, false, "i", playerid);
  3591.     forward DelayedKicker(playerid);
  3592.     public DelayedKicker(playerid)
  3593.     {
  3594.         new name[MAX_PLAYER_NAME];
  3595.         GetPlayerName(playerid, name, sizeof(name));
  3596.  
  3597.         printf("[kick] %s (%d) has been (automated) kick(ed) by the system.", name, playerid);
  3598.         Kick(playerid);
  3599.  
  3600.         return true;
  3601.     }
  3602.  
  3603.     forward TimeHandler();
  3604.     public TimeHandler()
  3605.     {
  3606.             if(WorldTime < 23) WorldTime ++;
  3607.             else if(WorldTime >= 24) WorldTime = 0;
  3608.  
  3609.             SetWorldTime(WorldTime);
  3610.  
  3611.             return true;
  3612.     }
  3613.  
  3614.     forward LevelTimer(playerid);
  3615.     public LevelTimer(playerid)
  3616.     {
  3617.             new string[144], oldmoney = pInfo[playerid][BankMoney];
  3618.  
  3619.             if(pInfo[playerid][Exp] != pInfo[playerid][ExpLeft])
  3620.             {
  3621.                     pInfo[playerid][Exp] += 1;
  3622.                     pInfo[playerid][BankMoney] += 450;
  3623.  
  3624.                     SendClientMessage(playerid, -1, "Bank Balance Receipt: $450 added to bank account!");
  3625.  
  3626.                     format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: [Old Amount: %d] [New Amount: %d]", oldmoney, pInfo[playerid][BankMoney]);
  3627.                     SendClientMessage(playerid, -1, string);
  3628.  
  3629.                     format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: Level progression: %d/%d. Next payday in 30 minutes.", pInfo[playerid][Exp], pInfo[playerid][ExpLeft]);
  3630.                     SendClientMessage(playerid, -1, string);
  3631.             }
  3632.  
  3633.             else if(pInfo[playerid][Exp] == pInfo[playerid][ExpLeft])
  3634.             {
  3635.                 pInfo[playerid][Exp] = 0;
  3636.                 pInfo[playerid][ExpLeft] += 8;
  3637.  
  3638.                 pInfo[playerid][Level] += 1;
  3639.  
  3640.                 format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have leveled up! New level: %d!", pInfo[playerid][Level]);
  3641.                 SendClientMessage(playerid, -1, string);
  3642.  
  3643.                 format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: Experience necessities upgraded: %d/%d.", pInfo[playerid][Exp], pInfo[playerid][ExpLeft]);
  3644.                 SendClientMessage(playerid, -1, string);
  3645.             }
  3646.  
  3647.             return true;
  3648.     }
  3649.  
  3650.     stock BusinessPath(Businessid)
  3651.     {
  3652.             new Business[64];
  3653.  
  3654.             format(Business, 30, "Businesses/%d.ini", Businessid);
  3655.             bInfo[Businessid][ID] ++; // multiplying
  3656.  
  3657.             return Business;
  3658.     }
  3659.  
  3660.     forward LoadBusinessData(b, name[], value[]);
  3661.     public LoadBusinessData(b, name[], value[])
  3662.     {
  3663.         INI_String("Owner", bInfo[b][Owner], MAX_PLAYER_NAME);
  3664.         INI_String("Name", bInfo[b][Name], 40);
  3665.         INI_Int("Price", bInfo[b][Price]);
  3666.         INI_Int("Bought", bInfo[b][Bought]);
  3667.  
  3668.         INI_Float("ExtX", bInfo[b][ExtX]);
  3669.         INI_Float("ExtY", bInfo[b][ExtY]);
  3670.         INI_Float("ExtZ", bInfo[b][ExtZ]);
  3671.  
  3672.         INI_Float("IntX", bInfo[b][IntX]);
  3673.         INI_Float("IntY", bInfo[b][IntY]);
  3674.         INI_Float("IntZ", bInfo[b][IntZ]);
  3675.  
  3676.         INI_Int("IntWorld", bInfo[b][IntInterior]);
  3677.         INI_Int("IntVW", bInfo[b][IntVirtualW]);
  3678.  
  3679.         INI_Int("VW", bInfo[b][World]);
  3680.         INI_Int("World", bInfo[b][Interior]);
  3681.         INI_Int("Locked", bInfo[b][Locked]);
  3682.         INI_Int("Initialised", bInfo[b][Initialised]);
  3683.  
  3684.         return true;
  3685.     }
  3686.  
  3687.     stock SaveBizzes()
  3688.     {
  3689.             new file[64];
  3690.  
  3691.             for(new b; b < MAX_BIZZES; b ++)
  3692.             {
  3693.                     format(file, sizeof(file), "Businesses/%d.ini", b);
  3694.  
  3695.                     if(fexist(file))
  3696.                 {
  3697.                         new INI:File = INI_Open(file);
  3698.  
  3699.                         INI_SetTag(File, "Business Data");
  3700.  
  3701.                         INI_WriteString(File, "Owner", bInfo[b][Owner]);
  3702.                         INI_WriteString(File, "Name", bInfo[b][Name]);
  3703.                         INI_WriteInt(File, "Price", bInfo[b][Price]);
  3704.                         INI_WriteInt(File, "Bought", bInfo[b][Bought]);
  3705.  
  3706.                         INI_WriteFloat(File, "ExtX", bInfo[b][ExtX]);
  3707.                         INI_WriteFloat(File, "ExtY", bInfo[b][ExtY]);
  3708.                         INI_WriteFloat(File, "ExtZ", bInfo[b][ExtZ]);
  3709.  
  3710.                         INI_WriteFloat(File, "IntX", bInfo[b][IntX]);
  3711.                         INI_WriteFloat(File, "IntY", bInfo[b][IntY]);
  3712.                         INI_WriteFloat(File, "IntZ", bInfo[b][IntZ]);
  3713.  
  3714.                         INI_WriteInt(File, "IntVW", bInfo[b][IntVirtualW]);
  3715.                         INI_WriteInt(File, "IntWorld", bInfo[b][IntInterior]);
  3716.  
  3717.                         INI_WriteInt(File, "VW", bInfo[b][World]);
  3718.                         INI_WriteInt(File, "World", bInfo[b][Interior]);
  3719.                         INI_WriteInt(File, "Locked", bInfo[b][Locked]);
  3720.                         INI_WriteInt(File, "Initialised", bInfo[b][Initialised]);
  3721.  
  3722.                         INI_Close(File);
  3723.                     }
  3724.             }
  3725.  
  3726.             return true;
  3727.     }
  3728.  
  3729.     stock LoadBizzes()
  3730.     {
  3731.             new hlabel[128], file[64];
  3732.  
  3733.             print("\n  Loading Businesses: \n");
  3734.  
  3735.             for(new b; b < MAX_BIZZES; b ++)
  3736.             {
  3737.                     format(file, sizeof(file), "Businesses/%d.ini", b);
  3738.  
  3739.                     if(fexist(file))
  3740.                 {
  3741.                             INI_ParseFile(BusinessPath(b), "LoadBusinessData", false, true, b, true, false);
  3742.  
  3743.                             if(bInfo[b][Bought] == 0) format(hlabel, sizeof(hlabel), "{8EB2D6}[Business]{FFFFFF}\nName: %s\nOwner: %s\nPrice: %d", bInfo[b][Name], bInfo[b][Owner], bInfo[b][Price]);
  3744.                             else if(bInfo[b][Bought] == 1) format(hlabel, sizeof(hlabel), "{8EB2D6}[Business]{FFFFFF}\nName: %s\nOwner: %s", bInfo[b][Name], bInfo[b][Owner]);
  3745.  
  3746.                             bInfo[b][Label] = Create3DTextLabel(hlabel, 0xFFFFFF, bInfo[b][ExtX], bInfo[b][ExtY], bInfo[b][ExtZ], 15.0, bInfo[b][World], 1);
  3747.                             format(hlabel, sizeof(hlabel), "  Loaded business ID: %d at %f %f %f", b, bInfo[b][ExtX], bInfo[b][ExtY], bInfo[b][ExtZ]);
  3748.  
  3749.                             print(hlabel);
  3750.                             bCount ++;
  3751.                     }
  3752.             }
  3753.  
  3754.             printf("\n  %d Businesses loaded!", bCount);
  3755.  
  3756.             return true;
  3757.     }
  3758.  
  3759.     stock SendAdminMsg(text[])
  3760.     {
  3761.             for(new i; i < MAX_PLAYERS; i ++)
  3762.             {
  3763.                     if(pInfo[i][Admin] != 0)
  3764.                     {
  3765.                         SendClientMessage(i, 0x96CC76FF, text);
  3766.                     }
  3767.             }
  3768.  
  3769.             return true;
  3770.     }
  3771.  
  3772.     forward DeathTimer(playerid);
  3773.     public DeathTimer(playerid)
  3774.     {
  3775.             new string[50];
  3776.  
  3777.             if(pDeathTimerTick[playerid] > 0)
  3778.             {
  3779.                 pDeathTimerTick[playerid] --;
  3780.  
  3781.                 format(string, sizeof(string), "~w~Time left: ~r~%d", pDeathTimerTick[playerid]);
  3782.                 GameTextForPlayer(playerid, string, 1000, 4);
  3783.             }
  3784.  
  3785.             else if(pDeathTimerTick[playerid] <= 0)
  3786.             {
  3787.                 TogglePlayerControllable(playerid, true);
  3788.                 TogglePlayerSpectating(playerid, false);
  3789.                 SetCameraBehindPlayer(playerid);
  3790.  
  3791.                 SetPlayerVirtualWorld(playerid, 0);
  3792.                 SetPlayerPos(playerid, 2028.5094, -1415.9738, 16.6084);
  3793.                 pDeath[playerid] = false;
  3794.  
  3795.                 KillTimer(pDeathTimer[playerid]);
  3796.                 SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have respawned!");
  3797.             }
  3798.  
  3799.             return true;
  3800.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement