Share this post

Link to post

Share on other sites

jaky2008
5

jaky2008
5

Thank you! I will try that now, I tried it earlier but it kept crashing. Doesn't ontick mean that it is constantly being drawn to the map each second? I changed the waypoint in the OnTick method first time around and it was constantly changing the waypoint to that no matter if you set a custom one because of the constant loop/update.

Here's hoping it will still work, because the code for pressing "L" and giving the weapon does nothing still.

EDIT: GTA V has stopped responding. Doesn't work

EDITx2: I replaced the texture args with "false" (excluding quotation marks) and the game doesn't crash, but there is still no map marker where it is supposed to be. The other problem however (giving player snowball) is fixed.

Share this post

Link to post

Share on other sites

jaky2008
5

jaky2008
5

Sorry about that. Im using my phone to try and help. "WORLD" should be "World". Also add "using GTA.Math;" and "using System.Drawing;"at the top.

Don't apologize, you're a great help.

Making good progress here, the non capitalized WORLD and MATH fixed those errors, the issue is that Color.Yellow still doesn't work, even with System.Drawing declared because System.Drawing doesn't exist.

Share this post

Link to post

Share on other sites

jaky2008
5

jaky2008
5

Thank you so much everyone, I now have the blip showing in game, I added the System.Drawing reference and then changed the code around a little bit because the arguments were off, it is ordered like this:

Share this post

Link to post

Share on other sites

jaky2008
5

jaky2008
5

Thank you! I will implement it now, I have other issues with the code at the moment but I can at least tidy things up a bit in the meantime! I love how you guys actually help out, some people would sh*t on me for being a noob.

And yeah, i'll also edit the comments to make it not as big of an eyesore.

EDIT:

Here are the code segments in order, with some irrelevant information removed.

Share this post

Link to post

Share on other sites

bilago
25

bilago
25

Looking at the code I see where it would cause a problem, right now if the player is in range of an area its going to delete the currently spawned ped every tick and remake him... Code needs to be modified to something like this:

Share this post

Link to post

Share on other sites

bilago
25

bilago
25

private void OnTick(object sender, EventArgs e) { foreach (var Entry in Locations) { isInRange = Game.Player.Character.IsInRangeOf(Entry.Key, 100f); if (isInRange) { if (CurrentlySpawnedPed != null) //if ped isn't null lets delete it if its not in our target zone { if(CurrentlySpawnedLocation != Entry.Key) //ped is not in the right location CurrentlySpawnedPed.Delete(); //deleting else break; //Ped is already spawned from the right location so lets just continue on } CurrentlySpawnedLocation = Entry.Key; //Updating the Stored spawned location CurrentlySpawnedPed = World.CreatePed(Entry.Value, CurrentlySpawnedLocation); //Spawn new ped in this location Function.Call(Hash.SET_PED_RANDOM_COMPONENT_VARIATION, CurrentlySpawnedPed, true);LoadModels(); break; //no need to keep looping if we are in this location already } } if (!isInRange && CurrentlySpawnedPed != null) //only is false if you are not in any of the defined locations CurrentlySpawnedPed.Delete(); }

Share this post

Link to post

Share on other sites

jaky2008
5

jaky2008
5

Thank you so much bilago, I would've ended up reverting back to my old sloppy code if not for you.

Sorry for not replying sooner, I was playing Fallout 4 way too much like many others.

It works nicely, only thing is the models spawn 3 of the same model in each area stacked on top. I will figure that out myself, you've already done enough!

EDIT:

Figured it out, or something. It was spawning three instances of each object/model but for some reason it isn't now, either it glitched the first time or I changed something and can't remember, anyways; good work and thank you.