Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using SampSharp.GameMode;
- using SampSharp.GameMode.Controllers;
- using SampSharp.GameMode.Definitions;
- using SampSharp.GameMode.SAMP;
- using SampSharp.GameMode.World;
- using System;
- using System.IO;
- using SampSharp.GameMode.Events;
- using SampSharp.GameMode.Display;
- namespace GrandLarceny
- {
- public class GameMode : BaseMode
- {
- // DEFINES
- readonly Color COLOR_NORMAL_PLAYER = Color.FromInteger(0xFFBB7777, ColorFormat.RGBA);
- // SPAWNS
- // Police dept spawns LS/SF/LV.
- readonly SpawnPoint[] policeSpawns = new[] {
- new SpawnPoint(1568.2250,-1693.5483,5.8906,177.0983),
- new SpawnPoint(-1604.8442,732.9442,-5.2344,37.6041),
- new SpawnPoint(2343.4553,2455.5994,14.9688,96.5022)
- };
- // Medical dept spawns LS/SF/LV.
- readonly SpawnPoint[] medicalSpawns = new[] {
- new SpawnPoint(1568.2250,-1693.5483,5.8906,177.0983),
- new SpawnPoint(-1604.8442,732.9442,-5.2344,37.6041),
- new SpawnPoint(1609.5922,1820.9641,10.8280,348.1614)
- };
- // Army spawns LS/SF/LV.
- readonly SpawnPoint[] armySpawns = new[] {
- new SpawnPoint(2786.2183,-2436.7859,13.6340,82.3043),
- new SpawnPoint(-1308.4493,504.9661,11.1953,132.5),
- new SpawnPoint(272.6040,1989.7307,17.6406,268.3605)
- };
- readonly SpawnPoint[] lossantosSpawns = new[] {
- new SpawnPoint(1751.1097,-2106.4529,13.5469,183.1979), // El-Corona - Outside random house
- new SpawnPoint(2652.6418,-1989.9175,13.9988,182.7107), // Random house in willowfield - near playa de seville and stadium
- new SpawnPoint(2489.5225,-1957.9258,13.5881,2.3440), // Hotel in willowfield - near cluckin bell
- new SpawnPoint(2689.5203,-1695.9354,10.0517,39.5312), // Outside stadium - lots of cars
- new SpawnPoint(2770.5393,-1628.3069,12.1775,4.9637), // South in east beach - north of stadium - carparks nearby
- new SpawnPoint(2807.9282,-1176.8883,25.3805,173.6018), // North in east beach - near apartments
- new SpawnPoint(2552.5417,-958.0850,82.6345,280.2542), // Random house north of Las Colinas
- new SpawnPoint(2232.1309,-1159.5679,25.8906,103.2939), // Jefferson motel
- new SpawnPoint(2388.1003,-1279.8933,25.1291,94.3321), // House south of pig pen
- new SpawnPoint(2481.1885,-1536.7186,24.1467,273.4944), // East LS - near clucking bell and car wash
- new SpawnPoint(2495.0720,-1687.5278,13.5150,359.6696), // Outside CJ's house - lots of cars nearby
- new SpawnPoint(2306.8252,-1675.4340,13.9221,2.6271), // House in ganton - lots of cars nearby
- new SpawnPoint(2191.8403,-1455.8251,25.5391,267.9925), // House in south jefferson - lots of cars nearby
- new SpawnPoint(1830.1359,-1092.1849,23.8656,94.0113), // Mulholland intersection carpark
- new SpawnPoint(2015.3630,-1717.2535,13.5547,93.3655), // Idlewood house
- new SpawnPoint(1654.7091,-1656.8516,22.5156,177.9729), // Right next to PD
- new SpawnPoint(1219.0851,-1812.8058,16.5938,190.0045), // Conference Center
- new SpawnPoint(1508.6849,-1059.0846,25.0625,1.8058), // Across the street of BANK - lots of cars in intersection carpark
- new SpawnPoint(1421.0819,-885.3383,50.6531,3.6516), // Outside house in vinewood
- new SpawnPoint(1133.8237,-1272.1558,13.5469,192.4113), // Near hospital
- new SpawnPoint(1235.2196,-1608.6111,13.5469,181.2655), // Backalley west of mainstreet
- new SpawnPoint(590.4648,-1252.2269,18.2116,25.0473), // Outside "BAnk of San Andreas"
- new SpawnPoint(842.5260,-1007.7679,28.4185,213.9953), // North of Graveyard
- new SpawnPoint(911.9332,-1232.6490,16.9766,5.2999), // LS Film Studio
- new SpawnPoint(477.6021,-1496.6207,20.4345,266.9252), // Rodeo Place
- new SpawnPoint(255.4621,-1366.3256,53.1094,312.0852), // Outside propery in richman
- new SpawnPoint(281.5446,-1261.4562,73.9319,305.0017), // Another richman property
- new SpawnPoint(790.1918,-839.8533,60.6328,191.9514), // Mulholland house
- new SpawnPoint(1299.1859,-801.4249,84.1406,269.5274), // Maddoggs
- new SpawnPoint(1240.3170,-2036.6886,59.9575,276.4659), // Verdant Bluffs
- new SpawnPoint(2215.5181,-2627.8174,13.5469,273.7786), // Ocean docks 1
- new SpawnPoint(2509.4346,-2637.6543,13.6453,358.3565) // Ocean Docks spawn 2
- };
- readonly SpawnPoint[] sanfierroSpawns = new[] {
- new SpawnPoint(-2723.4639,-314.8138,7.1839,43.5562), // golf course spawn
- new SpawnPoint(-2694.5344,64.5550,4.3359,95.0190), // in front of a house
- new SpawnPoint(-2458.2000,134.5419,35.1719,303.9446), // hotel
- new SpawnPoint(-2796.6589,219.5733,7.1875,88.8288), // house
- new SpawnPoint(-2706.5261,397.7129,4.3672,179.8611), // park
- new SpawnPoint(-2866.7683,691.9363,23.4989,286.3060), // house
- new SpawnPoint(-2764.9543,785.6434,52.7813,357.6817), // donut shop
- new SpawnPoint(-2660.9402,883.2115,79.7738,357.4440), // house
- new SpawnPoint(-2861.0796,1047.7109,33.6068,188.2750), // parking lot
- new SpawnPoint(-2629.2009,1383.1367,7.1833,179.7006), // parking lot at the bridge
- new SpawnPoint(-2079.6802,1430.0189,7.1016,177.6486), // pier
- new SpawnPoint(-1660.2294,1382.6698,9.8047,136.2952), // pier 69
- new SpawnPoint(-1674.1964,430.3246,7.1797,226.1357), // gas station]
- new SpawnPoint(-1954.9982,141.8080,27.1747,277.7342), // train station
- new SpawnPoint(-1956.1447,287.1091,35.4688,90.4465), // car shop
- new SpawnPoint(-1888.1117,615.7245,35.1719,128.4498), // random
- new SpawnPoint(-1922.5566,886.8939,35.3359,272.1293), // random
- new SpawnPoint(-1983.3458,1117.0645,53.1243,271.2390), // church
- new SpawnPoint(-2417.6458,970.1491,45.2969,269.3676), // gas station
- new SpawnPoint(-2108.0171,902.8030,76.5792,5.7139), // house
- new SpawnPoint(-2097.5664,658.0771,52.3672,270.4487), // random
- new SpawnPoint(-2263.6650,393.7423,34.7708,136.4152), // random
- new SpawnPoint(-2287.5027,149.1875,35.3125,266.3989), // baseball parking lot
- new SpawnPoint(-2039.3571,-97.7205,35.1641,7.4744), // driving school
- new SpawnPoint(-1867.5022,-141.9203,11.8984,22.4499), // factory
- new SpawnPoint(-1537.8992,116.0441,17.3226,120.8537), // docks ship
- new SpawnPoint(-1708.4763,7.0187,3.5489,319.3260), // docks hangar
- new SpawnPoint(-1427.0858,-288.9430,14.1484,137.0812), // airport
- new SpawnPoint(-2173.0654,-392.7444,35.3359,237.0159), // stadium
- new SpawnPoint(-2320.5286,-180.3870,35.3135,179.6980), // burger shot
- new SpawnPoint(-2930.0049,487.2518,4.9141,3.8258) // harbor
- };
- readonly SpawnPoint[] lasventurasSpawns = new[] {
- new SpawnPoint(1435.8024,2662.3647,11.3926,1.1650), // Northern train station
- new SpawnPoint(1457.4762,2773.4868,10.8203,272.2754), // Northern golf club
- new SpawnPoint(1739.6390,2803.0569,14.2735,285.3929), // Northern housing estate 1
- new SpawnPoint(1870.3096,2785.2471,14.2734,42.3102), // Northern housing estate 2
- new SpawnPoint(1959.7142,2754.6863,10.8203,181.4731), // Northern house 1
- new SpawnPoint(2314.2556,2759.4504,10.8203,93.2711), // Northern industrial estate 1
- new SpawnPoint(2216.5674,2715.0334,10.8130,267.6540), // Northern industrial estate 2
- new SpawnPoint(2101.4192,2678.7874,10.8130,92.0607), // Northern near railway line
- new SpawnPoint(1951.1090,2660.3877,10.8203,180.8461), // Northern house 2
- new SpawnPoint(1666.6949,2604.9861,10.8203,179.8495), // Northern house 3
- new SpawnPoint(2808.3367,2421.5107,11.0625,136.2060), // Northern shopping centre
- new SpawnPoint(2633.3203,2349.7061,10.6719,178.7175), // V-Rock
- new SpawnPoint(2606.6348,2161.7490,10.8203,88.7508), // South V-Rock
- new SpawnPoint(2616.5286,2100.6226,10.8158,177.7834), // North Ammunation 1
- new SpawnPoint(2491.8816,2397.9370,10.8203,266.6003), // North carpark 1
- new SpawnPoint(2531.7891,2530.3223,21.8750,91.6686), // North carpark 2
- new SpawnPoint(2340.6677,2530.4324,10.8203,177.8630), // North Pizza Stack
- new SpawnPoint(2097.6855,2491.3313,14.8390,181.8117), // Emerald Isle
- new SpawnPoint(1893.1000,2423.2412,11.1782,269.4385), // Souvenir shop
- new SpawnPoint(1698.9330,2241.8320,10.8203,357.8584), // Northern casino
- new SpawnPoint(1479.4559,2249.0769,11.0234,306.3790), // Baseball stadium 1
- new SpawnPoint(1298.1548,2083.4016,10.8127,256.7034), // Baseball stadium 2
- new SpawnPoint(1117.8785,2304.1514,10.8203,81.5490), // North carparks
- new SpawnPoint(1108.9878,1705.8639,10.8203,0.6785), // Dirtring racing 1
- new SpawnPoint(1423.9780,1034.4188,10.8203,90.9590), // Sumo
- new SpawnPoint(1537.4377,752.0641,11.0234,271.6893), // Church
- new SpawnPoint(1917.9590,702.6984,11.1328,359.2682), // Southern housing estate
- new SpawnPoint(2089.4785,658.0414,11.2707,357.3572), // Southern house 1
- new SpawnPoint(2489.8286,928.3251,10.8280,67.2245), // Wedding chapel
- new SpawnPoint(2697.4717,856.4916,9.8360,267.0983), // Southern construction site
- new SpawnPoint(2845.6104,1288.1444,11.3906,3.6506), // Southern train station
- new SpawnPoint(2437.9370,1293.1442,10.8203,86.3830), // Wedding chapel (near Pyramid)
- new SpawnPoint(2299.5430,1451.4177,10.8203,269.1287), // Carpark (near Pyramid)
- new SpawnPoint(2214.3008,2041.9165,10.8203,268.7626), // Central parking lot
- new SpawnPoint(2005.9174,2152.0835,10.8203,270.1372), // Central motel
- new SpawnPoint(2222.1042,1837.4220,10.8203,88.6461), // Clowns Pocket
- new SpawnPoint(2025.6753,1916.4363,12.3382,272.5852), // The Visage
- new SpawnPoint(2087.9902,1516.5336,10.8203,48.9300), // Royal Casino
- new SpawnPoint(2172.1624,1398.7496,11.0625,91.3783), // Auto Bahn
- new SpawnPoint(2139.1841,987.7975,10.8203,0.2315), // Come-a-lot
- new SpawnPoint(1860.9672,1030.2910,10.8203,271.6988), // Behind 4 Dragons
- new SpawnPoint(1673.2345,1316.1067,10.8203,177.7294), // Airport carpark
- new SpawnPoint(1412.6187,2000.0596,14.7396,271.3568) // South baseball stadium houses
- };
- TextDraw lossantosTD = null;
- TextDraw sanfierroTD = null;
- TextDraw lasventurasTD = null;
- TextDraw classSelectionTD = null;
- int LoadStaticVehiclesFromFile(string fileName)
- {
- FileInfo file = new FileInfo(fileName);
- if(file.Exists == false)
- {
- return 0;
- }
- string[] lines = File.ReadAllLines(file.FullName);
- int lineIdx = -1;
- int vehicleCount = 0;
- VehicleModelType model = 0;
- Vector3 position = Vector3.Zero;
- float angle = 0.0f;
- int primaryColour = -1, secondaryColour = -1;
- string description = string.Empty;
- foreach(string line in lines)
- {
- lineIdx++;
- string[] token = line.Split(new[] { ' ', '\t', ',', ';' }, StringSplitOptions.RemoveEmptyEntries);
- if(token.Length < 7) // model, x, y, z, angle, color1, color2 are required.
- {
- Console.WriteLine("FAILED to parse vehicle: not enough arguments (7) or invalid format. ('{0}':{1})", file.Name, lineIdx);
- continue;
- }
- if(int.TryParse(token[0], out int modelId) == false)
- {
- Console.WriteLine("FAILED to parse vehicle: modelId (0) must be integer. ('{0}':{1})", file.Name, lineIdx);
- continue;
- }
- model = (VehicleModelType) modelId;
- if (float.TryParse(token[1], out float x) == false || float.TryParse(token[2], out float y) == false || float.TryParse(token[3], out float z) == false)
- {
- Console.WriteLine("FAILED to parse vehicle: x,y,z (1,2,3) must be float. ('{0}':{1})", file.Name, lineIdx);
- continue;
- }
- position = new Vector3(x, y, z);
- if(float.TryParse(token[4], out angle) == false)
- {
- Console.WriteLine("FAILED to parse vehicle: angle (4) must be float. ('{0}':{1})", file.Name, lineIdx);
- continue;
- }
- if(int.TryParse(token[5], out primaryColour) == false || int.TryParse(token[6], out secondaryColour) == false)
- {
- Console.WriteLine("FAILED to parse vehicle: primaryColour,secondaryColour (5,6) must be float. ('{0}':{1})", file.Name, lineIdx);
- continue;
- }
- if(token.Length > 7)
- {
- description = String.Join(" ", token, 7, (token.Length - 7));
- }
- BaseVehicle vehicle = BaseVehicle.CreateStatic(model, position, angle, primaryColour, secondaryColour, (60 * 30)); // 30 minute respawn.
- if(vehicle == null)
- {
- Console.WriteLine("FAILED to create vehicle: there may be too many on the server. ({0}/{1})", BaseVehicle.PoolSize, BaseVehicle.Max);
- continue;
- }
- vehicle.SetNumberPlate("GRLC{44AA33}" + vehicle.Id);
- vehicleCount++;
- // Console.WriteLine("{0} = AddStaticVehicleEx({1}, {2}, {3}, {4}, {5}, {6}, {7}, (60 * 30)); // {8}", vehicle.Id, model, position.X, position.Y, position.Z, angle, primaryColour, secondaryColour, description);
- }
- return vehicleCount;
- }
- protected override void OnPlayerConnected(BasePlayer sender, EventArgs e)
- {
- Player player = sender as Player;
- player.GameText("~w~Grand Larceny", 3000, 4);
- player.SendClientMessage("Welcome to {88AA88}G{FFFFFF}rand {88AA88}L{FFFFFF}arceny");
- player.Color = COLOR_NORMAL_PLAYER;
- /*
- GlobalObject.Remove(player, 1302, Vector3.Zero, 6000.0f);
- GlobalObject.Remove(player, 1209, Vector3.Zero, 6000.0f);
- GlobalObject.Remove(player, 955, Vector3.Zero, 6000.0f);
- GlobalObject.Remove(player, 1775, Vector3.Zero, 6000.0f);
- GlobalObject.Remove(player, 1776, Vector3.Zero, 6000.0f);
- */
- Console.WriteLine("Player {0} reported client version '{1}'.", player.Id, player.Version);
- base.OnPlayerConnected(player, e);
- }
- protected override void OnPlayerSpawned(BasePlayer sender, SpawnEventArgs e)
- {
- Player player = sender as Player;
- if (player.IsNPC == true)
- {
- base.OnPlayerSpawned(player, e);
- return;
- }
- player.Interior = 0;
- player.ToggleClock(false);
- player.ResetMoney();
- player.Money += 30000;
- SpawnPoint spawn = new SpawnPoint(Vector3.Zero, 0.0f);
- if (player.citySelected == City.LosSantos)
- {
- spawn = lossantosSpawns[new Random().Next(lossantosSpawns.Length)];
- }
- if (player.citySelected == City.SanFierro)
- {
- spawn = sanfierroSpawns[new Random().Next(sanfierroSpawns.Length)];
- }
- if (player.citySelected == City.LasVenturas)
- {
- spawn = lasventurasSpawns[new Random().Next(lasventurasSpawns.Length)];
- }
- player.Position = spawn.position;
- player.Angle = spawn.angle;
- player.Color = COLOR_NORMAL_PLAYER;
- player.SetSkillLevel(WeaponSkill.Pistol, 200);
- player.SetSkillLevel(WeaponSkill.PistolSilenced, 200);
- player.SetSkillLevel(WeaponSkill.DesertEagle, 200);
- player.SetSkillLevel(WeaponSkill.Shotgun, 200);
- player.SetSkillLevel(WeaponSkill.SawnoffShotgun, 200);
- player.SetSkillLevel(WeaponSkill.Spas12Shotgun, 200);
- player.SetSkillLevel(WeaponSkill.MicroUzi, 200);
- player.SetSkillLevel(WeaponSkill.MP5, 200);
- player.SetSkillLevel(WeaponSkill.AK47, 200);
- player.SetSkillLevel(WeaponSkill.M4, 200);
- player.SetSkillLevel(WeaponSkill.SniperRifle, 200);
- player.GiveWeapon(Weapon.Colt45, 100);
- player.GiveWeapon(Weapon.MP5, 100);
- player.ToggleClock(false);
- base.OnPlayerSpawned(player, e);
- }
- protected override void OnPlayerDied(BasePlayer sender, DeathEventArgs e)
- {
- Player player = sender as Player;
- player.hasSelection = false;
- if(e.Killer != null)
- {
- e.Killer.Money += player.Money;
- }
- player.ResetMoney();
- base.OnPlayerDied(player, e);
- }
- void SetupCharacterSelection(Player player)
- {
- if (player.citySelected == City.LosSantos)
- {
- player.Interior = 11;
- player.Position = new Vector3(508.7362, -87.4335, 998.9609);
- player.Angle = 0.0f;
- player.CameraPosition = new Vector3(508.7362, -83.4335, 998.9609);
- player.SetCameraLookAt(new Vector3(508.7362, -87.4335, 998.9609));
- }
- if(player.citySelected == City.SanFierro)
- {
- player.Interior = 3;
- player.Position = new Vector3(-2673.8381, 1399.7424, 918.3516);
- player.Angle = 181.0f;
- player.CameraPosition = new Vector3(-2673.2776, 1394.3859, 918.3516);
- player.SetCameraLookAt(new Vector3(-2673.8381, 1399.7424, 918.3516));
- }
- if(player.citySelected == City.LasVenturas)
- {
- player.Interior = 3;
- player.Position = new Vector3(349.0453, 193.2271, 1014.1797);
- player.Angle = 286.25f;
- player.CameraPosition = new Vector3(352.9164, 194.5702, 1014.1875);
- player.SetCameraLookAt(new Vector3(349.0453, 193.2271, 1014.1797));
- }
- }
- TextDraw InitCityNameText(string name)
- {
- TextDraw textdraw = new TextDraw(new Vector2(10.0, 380.0), name);
- textdraw.UseBox = false;
- textdraw.LetterSize = new Vector2(1.25, 3.0);
- textdraw.Font = TextDrawFont.Diploma;
- textdraw.Shadow = 0;
- textdraw.Outline = 1;
- textdraw.ForeColor = Color.FromInteger(0xEEEEEEFF, ColorFormat.RGBA);
- textdraw.BackColor = Color.FromInteger(0x000000FF, ColorFormat.RGBA);
- return textdraw;
- }
- void InitTextDraws()
- {
- lossantosTD = InitCityNameText("Los Santos");
- sanfierroTD = InitCityNameText("San Fierro");
- lasventurasTD = InitCityNameText("Las Venturas");
- classSelectionTD = new TextDraw(new Vector2(10.0, 415.0),
- " Press ~b~~k~~GO_LEFT~ ~w~or ~b~~k~~GO_RIGHT~ ~w~to switch cities.~n~ Press ~r~~k~~PED_FIREWEAPON~ ~w~to select.");
- classSelectionTD.UseBox = true;
- classSelectionTD.BoxColor = Color.FromInteger(0x222222BB, ColorFormat.RGBA);
- classSelectionTD.LetterSize = new Vector2(0.3, 1.0);
- // classSelectionTD. = new Vector2(400.0, 40.0);
- classSelectionTD.Font = TextDrawFont.Slim;
- classSelectionTD.Shadow = 0;
- classSelectionTD.Outline = 1;
- classSelectionTD.BackColor = Color.FromInteger(0x000000FF, ColorFormat.RGBA);
- classSelectionTD.ForeColor = Color.FromInteger(0xFFFFFFFF, ColorFormat.RGBA);
- }
- void SetupSelectedCity(Player player)
- {
- if (player.citySelected == City.None)
- {
- player.citySelected = City.LosSantos;
- }
- lossantosTD.Hide(player);
- sanfierroTD.Hide(player);
- lasventurasTD.Hide(player);
- if (player.citySelected == City.LosSantos)
- {
- player.Interior = 0;
- player.CameraPosition = new Vector3(1630.6136, -2286.0298, 110.0);
- player.SetCameraLookAt(new Vector3(1887.6034, -1682.1442, 47.6167));
- lossantosTD.Show(player);
- }
- if(player.citySelected == City.SanFierro)
- {
- player.Interior = 0;
- player.CameraPosition = new Vector3(-1300.8754, 68.0546, 129.4823);
- player.SetCameraLookAt(new Vector3(-1817.9412, 769.3878, 132.6589));
- sanfierroTD.Show(player);
- }
- if(player.citySelected == City.LasVenturas)
- {
- player.Interior = 0;
- player.CameraPosition = new Vector3(1310.6155, 1675.9182, 110.7390);
- player.SetCameraLookAt(new Vector3(2285.2944, 1919.3756, 68.2275));
- lasventurasTD.Show(player);
- }
- }
- void SwitchToNextCity(Player player)
- {
- player.citySelected++;
- if(player.citySelected > City.LasVenturas)
- {
- player.citySelected = City.LosSantos;
- }
- player.PlaySound(1052);
- player.lastSelection = DateTime.Now;
- SetupSelectedCity(player);
- }
- void SwitchToPreviousCity(Player player)
- {
- player.citySelected--;
- if (player.citySelected <= City.None)
- {
- player.citySelected = City.LasVenturas;
- }
- player.PlaySound(1053);
- player.lastSelection = DateTime.Now;
- SetupSelectedCity(player);
- }
- void HandleCitySelection(Player player)
- {
- if (player.citySelected == City.None)
- {
- SwitchToNextCity(player);
- return;
- }
- if((DateTime.Now - player.lastSelection) < TimeSpan.FromMilliseconds(500))
- {
- return;
- }
- player.GetKeys(out Keys keys, out int upOrDown, out int leftOrRight);
- if(keys == Keys.Fire)
- {
- player.ToggleSpectating(false);
- lossantosTD.Hide(player);
- sanfierroTD.Hide(player);
- lasventurasTD.Hide(player);
- classSelectionTD.Hide(player);
- player.hasSelection = true;
- return;
- }
- if(leftOrRight > 0)
- {
- SwitchToNextCity(player);
- }
- if(leftOrRight < 0)
- {
- SwitchToPreviousCity(player);
- }
- }
- protected override void OnPlayerRequestClass(BasePlayer sender, RequestClassEventArgs e)
- {
- Player player = sender as Player;
- if(player.IsNPC == true)
- {
- base.OnPlayerRequestClass(player, e);
- return;
- }
- if(player.hasSelection == true)
- {
- SetupCharacterSelection(player);
- }
- else
- {
- if(player.State != PlayerState.Spectating)
- {
- player.citySelected = City.None;
- player.ToggleSpectating(true);
- classSelectionTD.Show(player);
- }
- }
- base.OnPlayerRequestClass(player, e);
- }
- protected override void OnInitialized(EventArgs e)
- {
- Console.WriteLine();
- Console.WriteLine("---------------------------------------");
- Console.WriteLine("Running Grand Larceny - by the SA-MP team");
- Console.WriteLine("---------------------------------------");
- Console.WriteLine();
- SetGameModeText("Grand Larceny");
- ShowPlayerMarkers(PlayerMarkersMode.Global);
- ShowNameTags(true);
- SetNameTagDrawDistance(40.0f);
- EnableStuntBonusForAll(false);
- DisableInteriorEnterExits();
- Server.SetWeather(2);
- Server.SetWorldTime(11);
- InitTextDraws();
- // Player Class
- AddPlayerClass(298, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(299, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(300, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(301, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(302, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(303, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(304, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(305, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(280, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(281, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(282, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(283, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(284, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(285, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(286, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(287, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(288, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(289, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(265, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(266, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(267, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(268, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(269, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(270, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(1, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(2, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(3, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(4, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(5, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(6, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(8, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(42, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(65, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- //AddPlayerClass(74,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(86, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(119, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(149, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(208, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(273, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(289, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(47, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(48, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(49, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(50, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(51, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(52, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(53, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(54, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(55, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(56, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(57, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(58, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(68, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(69, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(70, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(71, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(72, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(73, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(75, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(76, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(78, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(79, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(80, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(81, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(82, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(83, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(84, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(85, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(87, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(88, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(89, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(91, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(92, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(93, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(95, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(96, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(97, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(98, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- AddPlayerClass(99, 1759.0189, -1898.1260, 13.5622, 266.4503, -1, -1, -1, -1, -1, -1);
- int totalVehiclesFromFiles = 0;
- totalVehiclesFromFiles += LoadStaticVehiclesFromFile("scriptfiles/vehicles/trains.txt");
- totalVehiclesFromFiles += LoadStaticVehiclesFromFile("scriptfiles/vehicles/pilots.txt");
- // LAS VENTURAS
- totalVehiclesFromFiles += LoadStaticVehiclesFromFile("scriptfiles/vehicles/lv_law.txt");
- totalVehiclesFromFiles += LoadStaticVehiclesFromFile("scriptfiles/vehicles/lv_airport.txt");
- totalVehiclesFromFiles += LoadStaticVehiclesFromFile("scriptfiles/vehicles/lv_gen.txt");
- // SAN FIERRO
- totalVehiclesFromFiles += LoadStaticVehiclesFromFile("scriptfiles/vehicles/sf_law.txt");
- totalVehiclesFromFiles += LoadStaticVehiclesFromFile("scriptfiles/vehicles/sf_airport.txt");
- totalVehiclesFromFiles += LoadStaticVehiclesFromFile("scriptfiles/vehicles/sf_gen.txt");
- // LOS SANTOS
- totalVehiclesFromFiles += LoadStaticVehiclesFromFile("scriptfiles/vehicles/ls_law.txt");
- totalVehiclesFromFiles += LoadStaticVehiclesFromFile("scriptfiles/vehicles/ls_airport.txt");
- totalVehiclesFromFiles += LoadStaticVehiclesFromFile("scriptfiles/vehicles/ls_gen_inner.txt");
- totalVehiclesFromFiles += LoadStaticVehiclesFromFile("scriptfiles/vehicles/ls_gen_outer.txt");
- // OTHER AREAS
- totalVehiclesFromFiles += LoadStaticVehiclesFromFile("scriptfiles/vehicles/whetstone.txt");
- totalVehiclesFromFiles += LoadStaticVehiclesFromFile("scriptfiles/vehicles/bone.txt");
- totalVehiclesFromFiles += LoadStaticVehiclesFromFile("scriptfiles/vehicles/flint.txt");
- totalVehiclesFromFiles += LoadStaticVehiclesFromFile("scriptfiles/vehicles/tierra.txt");
- totalVehiclesFromFiles += LoadStaticVehiclesFromFile("scriptfiles/vehicles/red_county.txt");
- Console.WriteLine("Total vehicles from files: {0}", totalVehiclesFromFiles);
- base.OnInitialized(e);
- }
- protected override void OnPlayerUpdate(BasePlayer sender, PlayerUpdateEventArgs e)
- {
- Player player = sender as Player;
- if (player.IsConnected == false || player.IsNPC == true)
- {
- base.OnPlayerUpdate(player, e);
- return;
- }
- if(player.hasSelection == false && player.State == PlayerState.Spectating)
- {
- HandleCitySelection(player);
- base.OnPlayerUpdate(player, e);
- return;
- }
- if(player.Weapon == Weapon.Minigun)
- {
- player.Kick();
- e.PreventPropagation = true;
- base.OnPlayerUpdate(player, e);
- return;
- }
- if(player.SpecialAction == SpecialAction.Usejetpack)
- {
- player.Kick();
- e.PreventPropagation = true;
- base.OnPlayerUpdate(player, e);
- return;
- }
- base.OnPlayerUpdate(player, e);
- }
- Vector3 GetXYInFrontOfPoint(Vector3 position, double angle, double distance)
- {
- double x = position.X, y = position.Y;
- angle *= (Math.PI / 180.0f);
- x += (distance * Math.Sin(-angle));
- y += (distance * Math.Cos(-angle));
- return new Vector3(x, y, position.Z);
- }
- protected override void LoadControllers(ControllerCollection controllers)
- {
- base.LoadControllers(controllers);
- controllers.Override(new PlayerController());
- }
- void AddPlayerClass(int modelId, double x, double y, double z, double angle, params object[] useless)
- {
- AddPlayerClass(modelId, new Vector3(x, y, z), (float) angle);
- }
- }
- public class Player : BasePlayer
- {
- public bool hasSelection = false;
- public City citySelected = City.None;
- public DateTime lastSelection = DateTime.MinValue;
- }
- public class PlayerController : BasePlayerController
- {
- public override void RegisterTypes()
- {
- Player.Register<Player>();
- }
- }
- public enum City
- {
- None,
- LosSantos,
- SanFierro,
- LasVenturas
- }
- public class SpawnPoint
- {
- public Vector3 position = Vector3.Zero;
- public float angle = 0.0f;
- public SpawnPoint(Vector3 position, float angle)
- {
- this.position = position;
- this.angle = angle;
- }
- public SpawnPoint(Vector3 position, double angle)
- {
- this.position = position;
- this.angle = (float)angle;
- }
- public SpawnPoint(float x, float y, float z, float angle)
- {
- this.position = new Vector3(x, y, z);
- this.angle = angle;
- }
- public SpawnPoint(double x, double y, double z, double angle)
- {
- this.position = new Vector3(x, y, z);
- this.angle = (float)angle;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment