private void OnTick(object sender, EventArgs e)
 {
     if (activated)
     {
         if (Game.Player.Character.Model.ToString() != curModel)
         {
             TryLoadChar("scripts//SimplePowerPunchSettings//ModelBank.txt");
         }
         if (player == null)
         {
             player = Game.Player;
         }
         if ((weaponEntity = GetCurrentMeleeWeapon(player.Character)) == null)
         {
             return;
         }
         if (Game.IsControlPressed(2, GTA.Control.Attack) || Game.Player.Character.IsInMeleeCombat || Game.Player.Character.IsRagdoll)
         {
             shouldCheck = true;
         }
         else if (Game.IsControlPressed(2, GTA.Control.Context) && shouldCheck != true && WhereYouAimIsWhereYouThrow)
         {
             curDirection = GameplayCamera.Direction;
         }
         if (shouldCheck)
         {
             if (!CheckVehicleTouch(true, (dist += 0.1F)) && !checkPedTouch())
             {
                 if (curDirection != Vector3.Zero)
                 {
                     savedCurDirection = curDirection;
                 }
                 shouldCheck = CheckForEntityToThrow();
             }
             else
             {
                 curDirection = Vector3.Zero;
                 shouldCheck  = false;
             }
         }
         else
         {
             if (ThereIsNoStoppingMe && !Function.Call <bool>(Hash.GET_IS_TASK_ACTIVE, Game.Player.Character, 160))
             {
                 CheckVehicleTouch(false, dist);
             }
             if (ThereIsNoStoppingMeAtAll && !Function.Call <bool>(Hash.GET_IS_TASK_ACTIVE, Game.Player.Character, 160))
             {
                 CheckEntityTouch();
             }
         }
         if (EveryOne)
         {
             EveryOneHasPowerPunch();
         }
         Game.Player.Character.CanRagdoll = !NeverRagdoll;
     }
 }
 public DeadPedList(int max,Player p)
 {
     player = p;
     this.max = max;
     str = new string[max];
     Timers = new int[max];
     KilledByPlayer = new bool[max];
     IsMissionChar = new bool[max];
     index = 0;
 }
Exemple #3
0
 public void Godmode(bool switchHandle, Player player)
 {
     switch (switchHandle)
     {
         case true:
             Function.Call(Hash.SET_PLAYER_INVINCIBLE, player, true);
             break;
         case false:
             Function.Call(Hash.SET_PLAYER_INVINCIBLE, player, false);
             break;
     }
 }
Exemple #4
0
        public Main()
        {
            this.Tick += onTick;
            this.KeyUp += onKeyUp;
            this.KeyDown += onKeyDown;
            this.player = Game.Player;
            customPlayer = new CustomPlayer(player);

            /*
             * Config Set-Up
             */
            Config config = new Config();
            this.startAmount = config.StartAmount;
            this.isStartAm = config.EnableStartAmount;
            if (config.EnableStartAmount == true)
            {
                player.Money = config.StartAmount;
            }

            /*
             * Save Data
             */
            SaveData.CreateData();

            customPlayer.sendMessage("Welcome back! Press " + Style.YELLOW + config.LoadKey.ToString() + Style.NORMAL + " to load previous JobsV save. " + "Press " + Style.YELLOW + config.SaveDataKey.ToString() + Style.NORMAL + " to save.");

            Dispose();

            /*
             * Blips
             */
            Blip college = Job.CreateBlip(College.Location, BlipSprite.Business, BlipColor.Yellow);
            Blip lifeinv = Job.CreateBlip(LifeInvader.Location, BlipSprite.Business, BlipColor.Yellow);
            Blip waiter = Job.CreateBlip(Waiter.Location, BlipSprite.Business, BlipColor.Yellow);
            Blip firefighter = Job.CreateBlip(FireFighter.Location, BlipSprite.Business, BlipColor.Yellow);
            Blip airport = Job.CreateBlip(AirportSecurity.Location, BlipSprite.Business, BlipColor.Yellow);
            Blip music = Job.CreateBlip(MusicPerformer.Location, BlipSprite.Business, BlipColor.Yellow);
            Blip driving = Job.CreateBlip(DrivingSchool.Location, BlipSprite.Business, BlipColor.Yellow);
            Blip pilot = Job.CreateBlip(Pilot.Location, BlipSprite.Business, BlipColor.Yellow);
            Blip taxi = Job.CreateBlip(Taxi.Location, BlipSprite.Business, BlipColor.Yellow);
            Blip heli = Job.CreateBlip(Helicopter.Location, BlipSprite.Business, BlipColor.Yellow);
            list.Add(college);
            list.Add(lifeinv);
            list.Add(waiter);
            list.Add(firefighter);
            list.Add(airport);
            list.Add(music);
            list.Add(driving);
            list.Add(pilot);
            list.Add(taxi);
            list.Add(heli);
        }
Exemple #5
0
 public Job(Player player, Vector3 jobLocation, int wage, string jobTitle, int jobID, Vector3 returnLocation, bool requiresDegree, bool requireTaxi)
 {
     this.player = player;
     this.location = jobLocation;
     this.wage = wage;
     this.title = jobTitle;
     this.JobId = jobID;
     this.requiredegree = requiresDegree;
     this.returnlocation = returnLocation;
     this.customplayer = Main.customPlayer;
     this.license = requireTaxi;
     this.config = new Config();
     audio = new Audio();
 }
Exemple #6
0
 public override void OnStart()
 {
     #if !GTA_SCO
     Player = (Player)new Player(GlobalVariable.Get(2).Value);
     #if GTA_SA
     Player.Character = (Ped)new Ped(GlobalVariable.Get(3).Value);
     #endif
     #if GTA_III
     Player.Character = (Ped)new Ped(GlobalVariable.Get(11).Value);
     #endif
     #else
     Player = new Player();
     Player.Character = new Ped();
     #endif
 }
Exemple #7
0
 void OnKeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.B)
     {
         if (player == null)
         {
             player = Game.Player;
         }
         if (holdingKey <= 10)
         {
             HideOrShow();
             setToVisible = !setToVisible;
         }
         holdingKey = 0;
     }
 }
Exemple #8
0
 public static void BuyCollege(Player player)
 {
     Main.customPlayer.HasDegree = true;
     GTA.Game.FadeScreenOut(1000);
     Script.Wait(1000);
     Function.Call(Hash.ADD_TO_CLOCK_TIME, 7, 0, 0);
     player.Character.Position = new Vector3(-1628f, 184f, 60f);
     Script.Wait(1000);
     GTA.Game.FadeScreenIn(2000);
     sendMessage(Style.YELLOW + "Congratulations" + Style.NORMAL + ", you have earned your degree!");
     player.Money -= 8000;
     Main.customPlayer.SendClanMessage("Now that you have your degree, apply to college entry jobs!", 9, "Your Degree", "ULSA", "CHAR_DEFAULT");
     Config config = new Config();
     if (config.AutoSave == true)
     {
         SaveData.SaveGame();
         Main.customPlayer.sendMessage(Style.YELLOW + "JobsV Saved!");
         audio.Play_Save();
     }
 }
Exemple #9
0
 void OnKeyDown(object sender, KeyEventArgs e)
 {
     if (Game.IsControlPressed(2, GTA.Control.MeleeAttack1))
     {
         if (player == null)
         {
             player = Game.Player;
         }
         if (player.Character.IsInVehicle() &&
             player.Character.IsSittingInVehicle() &&
             player.Character == player.Character.CurrentVehicle.Driver)
         {
             if (holdingKeyEngine == 2)
             {
                 engineOffMan = player.Character.CurrentVehicle.EngineRunning;
                 Function.Call(Hash.SET_VEHICLE_ENGINE_ON, player.Character.CurrentVehicle, (engineOffMan ? false : true), false, true);
                 holdingKeyEngine += 1;
             }
             else if (holdingKeyEngine < 2)
             {
                 holdingKeyEngine++;
             }
         }
     }
     else if (Game.IsControlPressed(2, GTA.Control.VehicleExit))             // Change Keys.B to Keys.YourKey
     {
         if (player == null)
         {
             player = Game.Player;
         }
         if (holdingKey == 2 && player.Character.IsInVehicle())
         {
             shouldTurnEngineOff = true;
         }
         else if (holdingKey < 2 && player.Character.IsInVehicle())
         {
             holdingKey++;
         }
     }
 }
 public static bool GetPlayerInvincible(Player p)
 {
     return Function.Call<bool>(Hash.GET_PLAYER_INVINCIBLE, p.Handle);
 }
 public static bool SlotHasPlayer(int i)
 {
     var p = new Player(i);
        return p.Name != "**Invalid**";
 }
Exemple #12
0
 internal static Group FromPlayer(Player player)
 {
     return Internal.Function.Call<Group>(0x07AF, player);
 }
Exemple #13
0
 public static void saveModel(Player player)
 {
     model = player.Character.Model;
 }
 public static void SetSPInvinc(Player p, bool b)
 {
     Function.Call(Hash.SET_PLAYER_INVINCIBLE, p.Handle, b);
 }
 private void SpectatorCommand(Player p, bool b)
 {
     GTAFuncs.SetInSpectatorMode(p, b);
 }
 private void UprightCommand(Player p)
 {
     UprightCommand(GTAFuncs.GetPlayerEntity(p));
 }
 private void HealCommand(Player p)
 {
     HealCommand(GTAFuncs.GetPlayerEntity(p));
 }
 public static Entity GetPlayerEntity(Player p)
 {
     if (p.Character.IsInVehicle() || p.Character.IsSittingInVehicle()) return p.Character.CurrentVehicle;
     return p.Character;
 }
        public static Player GetPlayerByName(string player)
        {
            for (var i = 0; i < 32; i++) {
                var p = new Player(i);
                if (p.Name.ToLower() == player.ToLower()) return p;
            }

            return null;
        }
        public static Player GetPedPlayer(Ped ped)
        {
            for (var i = 0; i < 32; i++) {
                var p = new Player(i);
                if (SlotHasPlayer(i) && p.Character.Handle == ped.Handle) return p;
            }

            return null;
        }
 public static int GetNetworkID(Player p)
 {
     RequestEntityControl(p, 1);
     int netId = -1;
     Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_NETWORK_ID, netId);
     return netId;
 }
 private void LaunchCommand(Player p, int vel)
 {
     LaunchCommand(GTAFuncs.GetPlayerEntity(p), vel);
 }
 private void PlayersCommand()
 {
     for (var i = 0; i < 32; i++) {
         var p = new Player(i);
         if (p.Name != "**Invalid**") {
             _developerConsole
                 .PrintLine(
                     p.Name + " -- Player #" + p.Handle + ", Ped #" + p.Character.Handle + ", Position: " +
                     p.Character.Position.X + " " + p.Character.Position.Y + " " + p.Character.Position.Z,
                     GTAFuncs.GetPlayerInvincible(p) ? Color.CadetBlue : ConsoleSettings.DefaultTextColor);
         }
     }
 }
 private void UpCommand(Player p, int dist)
 {
     UpCommand(GTAFuncs.GetPlayerEntity(p), dist);
 }
Exemple #25
0
 public CustomPlayer(Player player)
 {
     this.player = player;
 }
 public static void KickPlayer(Player p)
 {
     Function.Call(Hash.NETWORK_SESSION_KICK_PLAYER, p.Handle);
 }
Exemple #27
0
        public WantedConsoleCommand(Player player, bool isMax)
            : base("v_wantedlevel", "")
        {
            _player = player;
            _isMax = isMax;

            if (_isMax)
            {
                Name = "v_maxwantedlevel";
            }
        }
        private void OnConsoleAttached(DeveloperConsole dc)
        {
            Tick += OnTick;

            _player = Game.Player;

            _developerConsole = dc;
            _commandDispatcher = dc.CommandDispatcher;

            RegisterDefaultCommands();

            dc.PrintDebug("DefaultCommands loaded successfully.");
        }
 public static unsafe Entity RequestEntityControl(Player p, int time = 10000)
 {
     int netId = -1;
     Function.Call(Hash.NETWORK_HANDLE_FROM_PLAYER, p.Handle, &netId, 13);
     DeveloperConsole.Instance.PrintDebug("NET ID FOR " + p.Name + ": " + netId);
     Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_NETWORK_ID, netId);
     int i = time;
     while (!Function.Call<bool>(Hash.NETWORK_HAS_CONTROL_OF_NETWORK_ID, netId) && i > 0) {
         i--;
         Script.Wait(0);
     }
     int localId = -1;
     return RequestEntityControl(p.Character, time);
 }
 private void TpCommand(int playerId)
 {
     var p = new Player(playerId);
     TpCommand(p.Character.Position);
 }
 public static void SetInSpectatorMode(Player p, bool spectating)
 {
     Function.Call(Hash.NETWORK_SET_IN_SPECTATOR_MODE, spectating, p.Character.Handle);
 }