Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

MrGTAmodsgerman

[C#.NET] How to read INI file section in dynamic blocks?

Recommended Posts

LeeC2202

This code works perfectly:

if (!CollectedVehicles[key].Exists() || CollectedVehicles[key].IsDead)
{
    CollectedVehicles.Remove(key);
    if (CarBlips[key].Exists()) CarBlips[key].Remove();
    CarBlips.Remove(key);
    UI.Notify("Removing car because it's dead or doesn't exist");
}

That's the code in that project, with the fixed line I posted last night. If that isn't working in your project, then you've changed something, because it still works fine for me... watch the minimap and the messages. You will see the BF Injection blip disappear when the message is shown and when I open the pause map, there are no blips on it at all.

 

 

Edited by LeeC2202

Share this post


Link to post
Share on other sites
MrGTAmodsgerman
18 minutes ago, LeeC2202 said:

This code works perfectly:

if (!CollectedVehicles[key].Exists() || CollectedVehicles[key].IsDead)
{
    CollectedVehicles.Remove(key);
    if (CarBlips[key].Exists()) CarBlips[key].Remove();
    CarBlips.Remove(key);
    UI.Notify("Removing car because it's dead or doesn't exist");
}

That's the code in that project, with the fixed line I posted last night. If that isn't working in your project, then you've changed something, because it still works fine for me... watch the minimap and the messages. You will see the BF Injection blip disappear when the message is shown and when I open the pause map, there are no blips on it at all.

Ohh, wait. The whole checkvehicleexist function is for removing the blip? So when i set, if Playerisonfoot

checkVehicleExist(); including a remove function for on foot in checkVehicleExist?

 

Edited by MrGTAmodsgerman

Share this post


Link to post
Share on other sites
LeeC2202
12 minutes ago, MrGTAmodsgerman said:

Ohh, wait. The whole checkvehicleexist function is for removing the blip? So when i set, if Playerisonfoot

checkVehicleExist(); including a remove function for on foot in checkVehicleExist?

 

CheckVehiclesExist() should be run all the time, because cars can stop existing while you are doing anything.

Share this post


Link to post
Share on other sites
MrGTAmodsgerman
6 minutes ago, LeeC2202 said:

CheckVehiclesExist() should be run all the time, because cars can stop existing while you are doing anything.

hmmm, well i can put if Spieler.isOnFoot everywhere and remove the Blips then. But that doesn'T work.

Is on foot really outside of vehicles?

Share this post


Link to post
Share on other sites
LeeC2202
7 minutes ago, MrGTAmodsgerman said:

hmmm, well i can put if Spieler.isOnFoot everywhere and remove the Blips then. But that doesn'T work.

Is on foot really outside of vehicles?

Why are you putting IsOnFoot anywhere, when the collecting vehicles is the only thing done inside a vehicle? That project I sent doesn't have any OnFoot checks, because you specifically had this in the code you showed.

if (Spieler.IsSittingInVehicle())
{
}

Everything outside that will be presumed to be on foot.

 

Sorry, my mistake, you had this.

if (Spieler.IsInVehicle())

 

Edited by LeeC2202

Share this post


Link to post
Share on other sites
MrGTAmodsgerman
56 minutes ago, LeeC2202 said:

Why are you putting IsOnFoot anywhere, when the collecting vehicles is the only thing done inside a vehicle? That project I sent doesn't have any OnFoot checks, because you specifically had this in the code you showed.

if (Spieler.IsSittingInVehicle())
{
}

Everything outside that will be presumed to be on foot.

Because i am not able to remove the CarBlips on the onTick event, because he is asking for key which doesn't exist in that context. The video u sent wasn'T for for each statements. And my whole script is now different filtered instead of isSittinginVehicle. I created a global variable for key, which doesn't help.

My plan is to filter the current vehicle type by bool statements from the XML File to make different actions. So i will use more filters in the CollectedVehicles function first. Lateron i will split it into ordered voids.

        private void onTick(object sender, EventArgs e)
        {
            // Exits from the loop if the game is loading
            if (Game.IsLoading) return;

            if (Spieler.IsOnBoat)
            {
                CollectVehicles();
                CheckVehiclesExist();
            }
            else
            {
                CarBlips.Remove(key);
            }

 

EDIT: You showed me 2 links that explains using private, public methods. But my problem is again, i wanna use single decerations in new voids.

 

        void Benachrichtigungsfunktion()
        {
            UI.Notify("The " + veh.DisplayName + " supports a Bicycle rack");
        }

Using veh as global variable would need to declare the whole thing what veh is, outside of the collectedVehicles(); function 🙄

isn't there any other way? When a void put out something like this, i wanna use it in other voids. I tried to make the whole collectedVehicles(); method as public one. But as the guy in the video you post said: I can't access the single things inside from outside, because its like a box that needs to keep it secret.

So how would you do it? I don't really get the logic of that box system much.

Edited by MrGTAmodsgerman

Share this post


Link to post
Share on other sites
LeeC2202
4 minutes ago, MrGTAmodsgerman said:

Because i am not able to remove the CarBlips on the onTick event, because he is asking for key which doesn't exist in that context. The video u sent wasn'T for for each statements. And my whole script is now different filtered instead of isSittinginVehicle. I created a global variable for key, which doesn't help.

My plan is to filter the current vehicle type by bool statements from the XML File to make different actions. So i will use more filters in the CollectedVehicles function first. Lateron i will split it into ordered voids.

        private void onTick(object sender, EventArgs e)
        {
            // Exits from the loop if the game is loading
            if (Game.IsLoading) return;

            if (Spieler.IsOnBoat)
            {
                CollectVehicles();
                CheckVehiclesExist();
            }
            else
            {
                CarBlips.Remove(key);
            }

 

I don't understand and I don't even know what to say... you seem to be adding layer upon layer of complexity and I don't really understand what the end-goal is.

 

You can't have a global key value if it's being created in a loop, because it will always be the last value that the loop gave it. So you'll almost be removing a random blip, that just happens to be the last one in the list.

 

My advice... is plan everything now and don't write any more code until you have a clear plan. If you try to add things as you go along, you're going to get a neverending stream of mod-breaking errors. You need to work out what all the filtered sections are going to be and you need to work out which sections share the same actions. The more logical and ordered you make things now, the easier it will be to deal with, when things go wrong.

 

I don't know what else to say other than that, but don't get tempted to just turn everything into global variables, because just having access to a variable, doesn't mean you're using it at the right time.

Share this post


Link to post
Share on other sites
MrGTAmodsgerman
3 minutes ago, LeeC2202 said:

I don't understand and I don't even know what to say... you seem to be adding layer upon layer of complexity and I don't really understand what the end-goal is.

 

You can't have a global key value if it's being created in a loop, because it will always be the last value that the loop gave it. So you'll almost be removing a random blip, that just happens to be the last one in the list.

 

My advice... is plan everything now and don't write any more code until you have a clear plan. If you try to add things as you go along, you're going to get a neverending stream of mod-breaking errors. You need to work out what all the filtered sections are going to be and you need to work out which sections share the same actions. The more logical and ordered you make things now, the easier it will be to deal with, when things go wrong.

 

I don't know what else to say other than that, but don't get tempted to just turn everything into global variables, because just having access to a variable, doesn't mean you're using it at the right time.

I have a plan, but i am trying to figure your code out. For my knowledge of coding, i should able to say, remove.Blip and it should do it, when i need it :/

I have no idea how you would remove the blip when the player is not in any vehicle situation. Because you said, its anyting else in action when its not isinVehicle. But how the hell can i work with the single catched vehicle, if the methods only allow me to do things with the collected vehicle inside one void. You said, i should order everything, thats what i am trying. So i don't have that kind of experience of scripting that you have, to know that a loop can't be a global key value.

I think i am gonna tell you my whole idea in private message to tell you what i am trying to do, because this is going to be a big off topic thread here 😴

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.