Log in to reply
 

problems with the script



  • In the error script 0. Nothing happens in the game...
    Blips appear, Peds respawn either with the first or with the second restart of the script. Markers do not appear and ModMenu does not open...
    Here is the link to Yandex.disk file, can anyone see what is wrong(https://yadi.sk/d/hLMDttMV3W6D6L). I just don't understand anymore.



  • @CaTBaT Please give us the code and not a dll. My Antivirus doesn't like it. Also what is the ScriptHookVDotNet2.log showing?



  • @Cyron43
    ScriptHookVDotNet2.log:

    [23:21:11] [DEBUG] Created script domain 'ScriptDomain_7F54E7BD' with v2.10.6.
    [23:21:11] [DEBUG] Loading scripts from 'F:\Games\Grand Theft Auto V\scripts' into script domain 'ScriptDomain_7F54E7BD' ...
    [23:21:11] [INFO] Loading assembly 'ClassLibrary2.dll' ...
    [23:21:11] [DEBUG] Found 1 script(s) in 'ClassLibrary2.dll'.
    [23:21:11] [INFO] Loading assembly 'NativeUI.dll' ...
    [23:21:11] [DEBUG] Found 1 script(s) in 'NativeUI.dll'.
    [23:21:11] [INFO] Loading assembly 'NativeUI.dll' ...
    [23:21:11] [DEBUG] Found 1 script(s) in 'NativeUI.dll'.
    [23:21:11] [DEBUG] Starting 3 script(s) ...
    [23:21:11] [DEBUG] Instantiating script 'RpGaming.BankRobbery' in script domain 'ScriptDomain_7F54E7BD' ...
    [23:21:11] [DEBUG] Started script 'RpGaming.BankRobbery'.
    [23:21:11] [DEBUG] Instantiating script 'NativeUI.BigMessageThread' in script domain 'ScriptDomain_7F54E7BD' ...
    [23:21:11] [DEBUG] Started script 'NativeUI.BigMessageThread'.
    [23:21:11] [DEBUG] Instantiating script 'NativeUI.BigMessageThread' in script domain 'ScriptDomain_7F54E7BD' ...
    [23:21:11] [DEBUG] Started script 'NativeUI.BigMessageThread'.
    [23:21:12] [ERROR] Caught fatal unhandled exception:
    System.NullReferenceException: Ссылка на объект не указывает на экземпляр объекта.
    в RpGaming.BankRobbery.OnTick(Object sender, EventArgs e)
    в GTA.Script.raise_Tick(Object value0, EventArgs value1)
    в GTA.Script.MainLoop()



  • @Cyron43
    And code I cannot send. There are more characters than you are allowed to write in the message)



  • @CaTBaT Well quite obviously your mod throws a NullReferenceException in the tick eventhandler. Look which member could possibly be it and why. Is this your first attempt in developing a script? smh



  • @Cyron43 Not the first, I do for myself scenarios (I study), but here is a problem first encountered



  • @CaTBaT So you should be able to fix it. You know what a NullReferenceException is and what causes it, don't you?



  • @Cyron43 I don't mean to be a fool, but kind of NullReferenceException - throws an exception for null. the only null I have in tick is - if (ModMenuPool != null) { ModMenuPool.ProcessMenus(); }



  • @CaTBaT said in problems with the script:

    @Cyron43 I don't mean to be a fool, but kind of NullReferenceException - throws an exception for null. the only null I have in tick is - if (ModMenuPool != null) { ModMenuPool.ProcessMenus(); }

    You really need to share some code fragment. Sending a link to a dll, or the first line of your OnTick(), isn't going to be helpful. Show us what you're doing. The OnTick() event would be useful, for one.



  • @CaTBaT said in problems with the script:

    @Cyron43 I don't mean to be a fool, but kind of NullReferenceException - throws an exception for null. the only null I have in tick is - if (ModMenuPool != null) { ModMenuPool.ProcessMenus(); }

    No, that's the null you're checking for. :) The one that throws the fatal exception is what you're still looking for. So, share some code.



  • @meimeiriver

    public void OnTick(object sender, EventArgs e)
    {
    Reset_Bank();
    BreakBank();
    if (modMenuPool != null)
    modMenuPool.ProcessMenus();

            if (Game_Start == true)
            {
                Lester_house = World.CreatePed(new Model(-1248528957), new Vector3(1272.353f, -1711.861f, 54.7f), 271.656f);
                Guard_1_FBank_1 = World.CreatePed(new Model(-681004504), new Vector3(1180.396f, 2709.935f, 38f), 180.239f);
                Guard_1_FBank_1.Weapons.Give(WeaponHash.PumpShotgun, 9999, true, true);
                Guard_1_FBank_1.Armor = 100;
                Guard_2_FBank_1 = World.CreatePed(new Model(-681004504), new Vector3(1173.260f, 2704.185f, 38f), 356.066f);
                Guard_2_FBank_1.Weapons.Give(WeaponHash.Pistol, 9999, true, true);
                Guard_2_FBank_1.Armor = 100;
                Guard_3_FBank_1 = World.CreatePed(new Model(-681004504), new Vector3(1177.050f, 2702.860f, 38f), 180.184f);
                Guard_3_FBank_1.Weapons.Give(WeaponHash.PumpShotgun, 9999, true, true);
                Guard_3_FBank_1.Armor = 100;
                Guard_1_FBank_2 = World.CreatePed(new Model(-681004504), new Vector3(149.2173f, -1036.219f, 29.3f), 343.350f);
                Guard_1_FBank_2.Weapons.Give(WeaponHash.PumpShotgun, 9999, true, true);
                Guard_1_FBank_2.Armor = 100;
                Guard_2_FBank_2 = World.CreatePed(new Model(-681004504), new Vector3(152.821f, -1037.478f, 29.3f), 339f);
                Guard_2_FBank_2.Weapons.Give(WeaponHash.Pistol, 9999, true, true);
                Guard_2_FBank_2.Armor = 100;
                Guard_3_FBank_2 = World.CreatePed(new Model(-681004504), new Vector3(145.361f, -1037.043f, 29.3f), 227.598f);
                Guard_3_FBank_2.Weapons.Give(WeaponHash.Pistol, 9999, true, true);
                Guard_3_FBank_2.Armor = 100;
                Guard_4_FBank_2 = World.CreatePed(new Model(-681004504), new Vector3(143.938f, -1042.183f, 29.3f), 337.626f);
                Guard_4_FBank_2.Weapons.Give(WeaponHash.PumpShotgun, 9999, true, true);
                Guard_4_FBank_2.Armor = 100;
                Guard_1_FBank_3 = World.CreatePed(new Model(-681004504), new Vector3(317.262f, -276.123f, 53.5f), 340.891f);
                Guard_1_FBank_3.Weapons.Give(WeaponHash.PumpShotgun, 9999, true, true);
                Guard_1_FBank_3.Armor = 100;
                Guard_2_FBank_3 = World.CreatePed(new Model(-681004504), new Vector3(313.604f, -274.829f, 53.5f), 340.891f);
                Guard_2_FBank_3.Weapons.Give(WeaponHash.Pistol, 9999, true, true);
                Guard_2_FBank_3.Armor = 100;
                Guard_3_FBank_3 = World.CreatePed(new Model(-681004504), new Vector3(316.755f, -277.340f, 53.5f), 161.106f);
                Guard_3_FBank_3.Weapons.Give(WeaponHash.PumpShotgun, 9999, true, true);
                Guard_3_FBank_3.Armor = 100;
                Guard_4_FBank_3 = World.CreatePed(new Model(-681004504), new Vector3(309.629f, -275.522f, 53.6f), 204.583f);
                Guard_4_FBank_3.Weapons.Give(WeaponHash.Pistol, 9999, true, true);
                Guard_4_FBank_3.Armor = 100;
                Guard_5_FBank_3 = World.CreatePed(new Model(-681004504), new Vector3(307.874f, -281.285f, 54.1f), 332.176f);
                Guard_5_FBank_3.Weapons.Give(WeaponHash.PumpShotgun, 9999, true, true);
                Guard_5_FBank_3.Armor = 100;
                Guard_1_FBank_4 = World.CreatePed(new Model(-681004504), new Vector3(-348.434f, -50.491f, 49f), 39.158f);
                Guard_1_FBank_4.Weapons.Give(WeaponHash.Pistol, 9999, true, true);
                Guard_1_FBank_4.Armor = 100;
                Guard_2_FBank_4 = World.CreatePed(new Model(-681004504), new Vector3(-351.541f, -45.554f, 49f), 340.303f);
                Guard_2_FBank_4.Weapons.Give(WeaponHash.Pistol, 9999, true, true);
                Guard_2_FBank_4.Armor = 100;
                Guard_3_FBank_4 = World.CreatePed(new Model(-681004504), new Vector3(-348.157f, -46.790f, 49f), 345.439f);
                Guard_3_FBank_4.Weapons.Give(WeaponHash.PumpShotgun, 9999, true, true);
                Guard_3_FBank_4.Armor = 100;
                Guard_4_FBank_4 = World.CreatePed(new Model(-681004504), new Vector3(-356.821f, -50.845f, 49f), 338.880f);
                Guard_4_FBank_4.Weapons.Give(WeaponHash.Pistol, 9999, true, true);
                Guard_4_FBank_4.Armor = 100;
                Guard_1_FBank_5 = World.CreatePed(new Model(-681004504), new Vector3(-1200.889f, -338.232f, 38f), 296.456f);
                Guard_1_FBank_5.Weapons.Give(WeaponHash.PumpShotgun, 9999, true, true);
                Guard_1_FBank_5.Armor = 100;
                Guard_2_FBank_5 = World.CreatePed(new Model(-681004504), new Vector3(-1213.272f, -324.790f, 37.5f), 26.113f);
                Guard_2_FBank_5.Weapons.Give(WeaponHash.Pistol, 9999, true, true);
                Guard_2_FBank_5.Armor = 100;
                Guard_3_FBank_5 = World.CreatePed(new Model(-681004504), new Vector3(-1217.196f, -326.748f, 37.6f), 28.302f);
                Guard_3_FBank_5.Weapons.Give(WeaponHash.PumpShotgun, 9999, true, true);
                Guard_3_FBank_5.Armor = 100;
                Guard_4_FBank_5 = World.CreatePed(new Model(-681004504), new Vector3(-1210.193f, -329.307f, 37.5f), 60.580f);
                Guard_4_FBank_5.Weapons.Give(WeaponHash.Pistol, 9999, true, true);
                Guard_4_FBank_5.Armor = 100;
                Guard_5_FBank_5 = World.CreatePed(new Model(-681004504), new Vector3(-1218.618f, -331.537f, 37.5f), 258.531f);
                Guard_5_FBank_5.Weapons.Give(WeaponHash.PumpShotgun, 9999, true, true);
                Guard_5_FBank_5.Armor = 100;
                Guard_6_FBank_5 = World.CreatePed(new Model(-681004504), new Vector3(-1215.956f, -335.951f, 37.5f), 26.263f);
                Guard_6_FBank_5.Weapons.Give(WeaponHash.Pistol, 9999, true, true);
                Guard_6_FBank_5.Armor = 100;
                Guard_1_FBank_6 = World.CreatePed(new Model(-681004504), new Vector3(-2959.483f, 477.623f, 15f), 78.392f);
                Guard_1_FBank_6.Weapons.Give(WeaponHash.PumpShotgun, 9999, true, true);
                Guard_1_FBank_6.Armor = 100;
                Guard_2_FBank_6 = World.CreatePed(new Model(-681004504), new Vector3(-2964.647f, 477.548f, 15f), 307.220f);
                Guard_2_FBank_6.Weapons.Give(WeaponHash.Pistol, 9999, true, true);
                Guard_2_FBank_6.Armor = 100;
                Guard_3_FBank_6 = World.CreatePed(new Model(-681004504), new Vector3(-2962.485f, 485.734f, 15f), 141.384f);
                Guard_3_FBank_6.Weapons.Give(WeaponHash.PumpShotgun, 9999, true, true);
                Guard_3_FBank_6.Armor = 100;
                Guard_4_FBank_6 = World.CreatePed(new Model(-681004504), new Vector3(-2964.963f, 484.798f, 15f), 271.7f);
                Guard_4_FBank_6.Weapons.Give(WeaponHash.Pistol, 9999, true, true);
                Guard_4_FBank_6.Armor = 100;
                Guard_5_FBank_6 = World.CreatePed(new Model(-681004504), new Vector3(-2967.635f, 480.277f, 15f), 84.126f);
                Guard_5_FBank_6.Weapons.Give(WeaponHash.PumpShotgun, 9999, true, true);
                Guard_5_FBank_6.Armor = 100;
                PedGroup Group_1 = Guard_1_FBank_1.CurrentPedGroup;
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_2_FBank_1, Group_1);
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_3_FBank_1, Group_1);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_1_FBank_1, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_2_FBank_1, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_3_FBank_1, 100);
                PedGroup Group_2 = Guard_1_FBank_2.CurrentPedGroup;
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_2_FBank_2, Group_2);
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_3_FBank_2, Group_2);
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_4_FBank_2, Group_2);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_1_FBank_2, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_2_FBank_2, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_3_FBank_2, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_4_FBank_2, 100);
                PedGroup Group_3 = Guard_1_FBank_3.CurrentPedGroup;
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_2_FBank_3, Group_3);
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_3_FBank_3, Group_3);
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_4_FBank_3, Group_3);
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_5_FBank_3, Group_3);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_1_FBank_3, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_2_FBank_3, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_3_FBank_3, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_4_FBank_3, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_5_FBank_3, 100);
                PedGroup Group_4 = Guard_1_FBank_4.CurrentPedGroup;
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_2_FBank_4, Group_4);
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_3_FBank_4, Group_4);
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_4_FBank_4, Group_4);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_1_FBank_4, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_2_FBank_4, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_3_FBank_4, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_4_FBank_4, 100);
                PedGroup Group_5 = Guard_1_FBank_5.CurrentPedGroup;
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_2_FBank_5, Group_5);
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_3_FBank_5, Group_5);
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_4_FBank_5, Group_5);
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_5_FBank_5, Group_5);
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_6_FBank_5, Group_5);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_1_FBank_5, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_2_FBank_5, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_3_FBank_5, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_4_FBank_5, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_5_FBank_5, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_6_FBank_5, 100);
                PedGroup Group_6 = Guard_1_FBank_6.CurrentPedGroup;
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_2_FBank_6, Group_6);
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_3_FBank_6, Group_6);
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_4_FBank_6, Group_6);
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Guard_5_FBank_6, Group_6);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_1_FBank_6, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_2_FBank_6, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_3_FBank_6, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_4_FBank_6, 100);
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, Guard_5_FBank_6, 100);
                Game_Start = false;
            }
            if (Robbery == true && Game.Player.WantedLevel < 1 && Game.Player.IsAlive)
            {
                Game.Player.Money += Money_robbery;
                Money_robbery = 0;
                Robbery = false;
            }
            if (Auto_Take == true)
            {
                Take_weed += 1;
                Inventore_Player.MenuItems.Remove(Weed); Weed = new UIMenuItem("Травка " + Take_weed + " Шт"); Inventore_Player.AddItem(Weed);
                Game.Player.Character.Task.PlayAnimation("mp_common", "givetake1_b", 8f, -1, (AnimationFlags)16); Script.Wait(3000);
                UI.Notify("+ ~g~1 ~w~Травка"); UI.Notify("Собрано ~g~" + Take_weed + "~w~ Травки");
            }
            if (Auto_Create == true)
            {
                Take_weed -= 2; Lite_Nark += 1;
                Inventore_Player.MenuItems.Remove(Lite_Narko); Lite_Narko = new UIMenuItem("Упаковка с травкой " + Lite_Nark + " Шт"); Inventore_Player.AddItem(Lite_Narko);
                Inventore_Player.MenuItems.Remove(Weed); Weed = new UIMenuItem("Травка " + Take_weed + " Шт"); Inventore_Player.AddItem(Weed);
                Game.Player.Character.Task.PlayAnimation("mp_common", "givetake1_b", 8f, -1, (AnimationFlags)16);
                UI.Notify("~r~-2 ~w~Травки"); UI.Notify("~g~+ 1 ~w~Упаковка травки");
                Script.Wait(3000);
            }
            if (World.GetDistance(Game.Player.Character.Position, Create_Weed) < 3f && Take_weed < 1) { Auto_Create = false; toolTip("Не хватает травки."); }
            if (Take_weed < 1) { Inventore_Player.MenuItems.Remove(Weed); }
            if (Lite_Nark < 1) { Inventore_Player.MenuItems.Remove(Lite_Narko); }
            if (Game.Player.IsDead && Robbery == true)
            {
                Money_robbery = 0;
                Break = false;
                BreakBank_ = false;
                Robbery = false;
                Haker_Time = 0;
                UI.Notify("Вы не смогли ограбить банк");
            }
            if (Robbery == false)
            {
                if (FBankRobb_1 == false)
                {
                    World.DrawMarker((MarkerType)(1), new Vector3(1176.451f, 2711.695f, 37.1f), Vector3.Zero, Vector3.Zero, new Vector3(1.5f, 1.5f, 0.3f), Color.Green);
                }
                if (FBankRobb_2 == false)
                {
                    World.DrawMarker((MarkerType)(1), new Vector3(146.9535f, -1044.909f, 28.3f), Vector3.Zero, Vector3.Zero, new Vector3(1.5f, 1.5f, 0.3f), Color.Green);
                }
                if (FBankRobb_3 == false)
                {
                    World.DrawMarker((MarkerType)(1), new Vector3(311.004f, -283.291f, 53.2f), Vector3.Zero, Vector3.Zero, new Vector3(1.5f, 1.5f, 0.3f), Color.Green);
                }
                if (FBankRobb_4 == false)
                {
                    World.DrawMarker((MarkerType)(1), new Vector3(-354.004f, -54.089f, 48.1f), Vector3.Zero, Vector3.Zero, new Vector3(1.5f, 1.5f, 0.3f), Color.Green);
                }
                if (FBankRobb_5 == false)
                {
                    World.DrawMarker((MarkerType)(1), new Vector3(-1212.02f, -335.962f, 36.8f), Vector3.Zero, Vector3.Zero, new Vector3(1.5f, 1.5f, 0.3f), Color.Green);
                }
                if (FBankRobb_6 == false)
                {
                    World.DrawMarker((MarkerType)(1), new Vector3(-2957.715f, 481.120f, 14.8f), Vector3.Zero, Vector3.Zero, new Vector3(1.5f, 1.5f, 0.3f), Color.Green);
                }
            }
            if (Robbery == true)
            {
                if (BreakSuskeful == true)
                {
                    World.DrawMarker((MarkerType)(1), new Vector3(1176.451f, 2711.695f, 37.1f), Vector3.Zero, Vector3.Zero, new Vector3(1.5f, 1.5f, 0.3f), Color.Green);
                }
                if (BreakSuskeful == true)
                {
                    World.DrawMarker((MarkerType)(1), new Vector3(146.9535f, -1044.909f, 28.3f), Vector3.Zero, Vector3.Zero, new Vector3(1.5f, 1.5f, 0.3f), Color.Green);
                }
                if (BreakSuskeful == true)
                {
                    World.DrawMarker((MarkerType)(1), new Vector3(311.004f, -283.291f, 53.2f), Vector3.Zero, Vector3.Zero, new Vector3(1.5f, 1.5f, 0.3f), Color.Green);
                }
                if (BreakSuskeful == true)
                {
                    World.DrawMarker((MarkerType)(1), new Vector3(-354.004f, -54.089f, 48.1f), Vector3.Zero, Vector3.Zero, new Vector3(1.5f, 1.5f, 0.3f), Color.Green);
                }
                if (BreakSuskeful == true)
                {
                    World.DrawMarker((MarkerType)(1), new Vector3(-1212.02f, -335.962f, 36.8f), Vector3.Zero, Vector3.Zero, new Vector3(1.5f, 1.5f, 0.3f), Color.Green);
                }
                if (BreakSuskeful == true)
                {
                    World.DrawMarker((MarkerType)(1), new Vector3(-2957.715f, 481.120f, 14.8f), Vector3.Zero, Vector3.Zero, new Vector3(1.5f, 1.5f, 0.3f), Color.Green);
                }
            }
            World.DrawMarker((MarkerType)(1), Weed_Farm, Vector3.Zero, Vector3.Zero, new Vector3(2f, 2f, 0.7f), Color.DarkGreen);
            World.DrawMarker((MarkerType)(1), Create_Weed, Vector3.Zero, Vector3.Zero, new Vector3(2f, 2f, 0.7f), Color.Red);
        }


  • @meimeiriver This is all that is in Tick



  • @CaTBaT said in problems with the script:

    @meimeiriver This is all that is in Tick

    Not sure whether (and how) you declared, for instance, Guard_1_FBank_1; but the usual way is like

    Ped Guard_1_FBank_1 = World.CreatePed(...

    Also, I dont know the rest of your code, of course, but are you absolutely sure Reset_Bank() and BreakBank() must continually run at OnTick()?

    And last, I find it prudent to not let OnTick() do anything, until the game has finished loading; like:

        private void onTick(object sender, EventArgs e)
        {
            if (Function.Call<bool>(Hash.GET_IS_LOADING_SCREEN_ACTIVE)) return;
    
            if (modMenuPool != null)
            {
                modMenuPool.ProcessMenus();
            }
    

    Etc.



  • @meimeiriver
    About Reset / Break, I do not think that much loads mod... There is also worth checking...

    Guard_1_FBank_1; - this is the first guard in the first Bank)

    About the job to load the game - fixed now.



  • @CaTBaT said in problems with the script:

    Guard_1_FBank_1; - this is the first guard in the first Bank)

    I understand that. :) But if you didn't declare it as a Ped elsewhere, you must do so when creating it:

    Ped Guard_1_FBank_1 = World.CreatePed(...
    

    Else things might go wrong, like, I dunno, NullReferenceException?! :P



  • @CaTBaT Oh my, where to begin? First off, you have all that in the Tick eventhandler, really??? With each tick you create peds and whatnot (Lester for example) and I guess you haven't even set the tick interval. So your mod tries to do all this with each rendered frame! At 60 FPS that means your mod is supposed to do all of this repeatedly every 17 milliseconds!
    Only create instances when needed and not repeatedly with each tick for no apparent reason (memory bloating, garbage collection, performance). I didn't dig any deeper into your code because this is insane already!
    Please learn programming basics before even considering to develop script mods!
    I'm done here.



  • @Cyron43 I think he uses the Game_Start variable, as a flag to just perform the ped creation only once. Naturally -- for that reason alone -- that stuff does not belong in OnTick() at all (if for nothing else, because the peds will only be valid within that scope). And I too pointed out to him that Reset_Bank(); and BreakBank(); likely have no place in OnTick(). So, yeah, where even to begin?!



  • Sorry, but I write here to at least be something to learn and understand what mistakes I make. And not listen to " Buy a textbook, do nothing, delete MVS"
    I'm downloading other scripts to see how their people were doing. Yes, I agree-you need to know basic knowledge! But I do not think that I have from basic knowledge to reduce questions about scripting for GTA V.

    The only normal site where at least something can be learned and then sent far away.
    Zabante me here then fuck, what would I no longer had the desire or something to write here hoping to see the answer, not humiliation!

    And I'm not stupid enough not to set the interval.

    (Didn't want to offend anyone, if offended - sorry)



  • @CaTBaT said in problems with the script:

    Yes, I agree-you need to know basic knowledge! But I do not think that I have from basic knowledge to reduce questions about scripting for GTA V.

    I realize our responses may have sounded a bit harsh. But please understand that no one faults you for not having thorough knowledge about GTA V yet. Lord knows, I still ask many questions myself. :) But I think what @Cyron43 meant -- and correct me if I'm wrong -- is that you seem to lack some rather fundamental knowledge of C#. Like how variables are declared, their scope, and in what section of your code things go. So, in that sense, it's really hard to 'know where to begin' explaining all the things that are wrong with your code. Like this:

                if (BreakSuskeful == true)
                {
                    World.DrawMarker((MarkerType)(1), new Vector3(1176.451f, 2711.695f, 37.1f), Vector3.Zero, Vector3.Zero, new Vector3(1.5f, 1.5f, 0.3f), Color.Green);
                }
                if (BreakSuskeful == true)
                {
                    World.DrawMarker((MarkerType)(1), new Vector3(146.9535f, -1044.909f, 28.3f), Vector3.Zero, Vector3.Zero, new Vector3(1.5f, 1.5f, 0.3f), Color.Green);
                }
                if (BreakSuskeful == true) ...
    

    Why on earth would you repeat the same "if (BreakSuskeful == true)" conditional endlessly after each other, instead of just using 1 test, and then draw all markers?! That doesn't make a whole lot of sense.

    Also, if you set up a ScriptHookV environment, with, say, Visual Studio 2017, IntelliSense will immediately show you the most egregious errors and/or fill out fields while you're typing.

    It's usually best to start with a small script, see whether it compiles nicely, test it, and then extend on that, Like have it just spawn 1 ped (without throwing exceptions). And then proceed from there.



  • @CaTBaT Unfortunately 99% of the script mods are written by beginners. So that's not a good learning source. Software development in general is not only knowing what code means. It's way more than this! Most beginners don't even know the purpose of classes and methods, let alone structured programming, OOD, the DRY principle, proper memory management, parallel programming (and it's stumbling blocks) and design patterns, just to name few. The best approach to learn all this is really good books (yes plural) and the MSDN library. In case you get stuck I recommend Stackoverflow. Sorry but if anyone told you that programming is easy, he either lied to you or has no clue. Software development is science and art at the same time.



  • @meimeiriver @Cyron43 I understand you gentlemen)
    I agree that programming is not an easy thing. I used to work for QSP (Maybe you know what it is) until I realized that I have this little and I want more opportunities. I switched to C# and I realized that real programming is not easy. So I will study fundamental knowledge.
    And sorry for the previous message. I snapped a little.(



  • @CaTBaT You're welcome. My comment right above was meant as a motivational speech, not the opposite. :slight_smile:



  • @CaTBaT Np :) And I appreciate your good reply!


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.