Jump to content

LtFlash

Members
  • Posts

    610
  • Joined

  • Last visited

 Content Type 

Forums

Gallery

Downloads

Tutorials

News Stories

Wiki

Community Guidelines

LSPDFR BOLO Series

GTA5 Native Database

GTA5 Native Parameters

Release Highlights

LSPDFR Mod Showcase

LML User Contributions

Everything posted by LtFlash

  1. You can create a zone, collect coords of vertexes + center (might also be calculated) and get random position within that zone. https://gtagmodding.com/maps/gta5/ https://math.stackexchange.com/questions/190111/how-to-check-if-a-point-is-inside-a-rectangle
  2. @Airb4g It should print "Rush Hour 0.5.0" in the console, also you could be able to call a command "rushhour" via the console, which prints a list of calls. Otherwise it means it is installed improperly or does not work with the last LCPD:FR update in case you got it installed.
  3. Pawel, one of the most troublesome and important aspect of scripting for GTA/LCPD:FR is to create chunks of code that will work in sequence. There were many techniques: switch...case + enum, bool flags, while loops but I managed to create probably the best solution which is to use a list of functions that might be switched on and off. Here are some resources: https://github.com/LtFlash/LtFlash.Common/blob/master/LtFlash.Common/Processes/ProcessHost.cs https://github.com/LtFlash/LtFlash.Common/blob/master/Examples/Processes/ProcessHost.cs In your code it could be used like this: public override void OnCalloutBegin() { proc.ActivateProcess(IsPlayerClose); } public override void Process() { proc.Process() } public void IsPlayerClose() { if(DistanceToPlayer < 200f) { //createblips proc.SwapStages(IsPlayerClose, HasPlayerClearTheArea); proc.ActivateStage(DisplayPlayerTaskOnScreen); } } private void DisplayPlayerTaskOnScreen() { //print msg "Eliminate enemies } private void HasPlayerClearTheArea() { if(AreEnemiesDead()) { //print msg End(); } } private bool AreEnemiesDead() { return (!Enemy1.Valid() || Enemy1.IsDead) && (!Enemy2.Valid() || Enemy2.IsDead); } Here's some information on Action delegate behind that technique: https://www.dotnetperls.com/action Using that, I believe you can solve your problem quickly.
  4. What do you mean by that, Sir?
  5. https://github.com/LtFlash/LtFlash.Common/blob/master/LtFlash.Common/Serialization/Serializer.cs First you would create a class to store data, then you use it to save/load values to/from a file using eg. 'public static void SaveToXML<T>(List<T> list, string filePath)' where T is your class.
  6. I bet the crash is caused by something in your LSPDFRResolveEventHandler method. Put 2 log lines: one above the line where you subscribe that and one after and you'll see what happens.
  7. Try this native: http://www.dev-c.com/nativedb/func/info/53af99baa671ca47
  8. What kind of problem do you have with this code? The style can definitely be better but there's no obvious bug. You could use an array/dictionary to store vectors and LINQ to check the condition so your code would look like this: CalloutLocation = locations.All(l => DistanceToPlayer(l) > distToBackRoad) ? YouToolBackRoad : YouToolLot;
  9. https://gist.github.com/LtFlash/e99e91039ff47f18a9894af733824e58
  10. It is possible and not complicated at all if you familiarize yourself with files hierarchy. Try to analyze StagesData.xml of any case and follow IDs of entites to their config files, eg. SuspectsData.xml, VictimsData.xml, DialogsData.xml and so on. Every piece of information that form a case is located in those files. 20-30 minutes of learning and I'm sure you'll be an expert in creating cases. We are checking the forum regularly so feel free to ask questions. You might also contact us via our Discord server. We'll probably push an update with some cosmetic changes to file formats, so have in mind you'll have to adapt your new case when this happens. Fiskey is working on dedicated tools for creating cases but the release date is unknown due to how busy we are in real life.
  11. The current version has huge unused potential but the coding scene is pretty much dead. I'm still working on The Wasteland and it's refreshed version will be eventually released but that would be it in terms of active development for LCPD:FR. Despite of the available know-how we didn't have back in the days, no one seems to be interested in creating scripting mods nowadays. I just realized IV was released TEN years and nine days ago...
  12. It's sad to see you leaving. Thanks for your great input into the modding scene, Stealth!
  13. That's a huge loss for the community, you were delivering quality content for such a long time it's hard to imagine the FR scene without you. Thanks for your brilliant work, Albo!
  14. You got to use VS 2012, LCPD:FR obfuscation causes all the newer VS editions to crash. I contacted LMS about this long time ago but LCPD:FR is no longer in development and we can't expect any updates that would fix the problem.
  15. You can check here how to create a dialog class to reuse it in different calls: https://github.com/LtFlash/LtFlash.Common/blob/master/LtFlash.Common/EvidenceLibrary/Dialog.cs
  16. You can pick txt as an output format to easily paste your coords to your code.
  17. You can start a new fiber with an infinite loop in the entry method like that: void Main() { var fiber = GameFiber.StartNew(Process); } void Process() { while(true) { //your code GameFiber.Yield(); } } That's only a general idea ofc. You can do whatever you want: a custom callout subsystem, world events, GUI. There are no limitations.
  18. For some reason entity.GetAttachedBlip() returns null ref. You should store your blip in a variable: Blip policeBlip = new Blip(police); and refer in your code to that variable.
  19. Please provide me an excerpt from your log that says what kind of error has occurred.
  20. Even like it's right now available to download. Have few bugs!
  21. No, we slowed down significantly since both of us started regular jobs but expect a surprise in the next couple of days.
  22. Okay, let's try to not to over-complicate it. 1) Extension methods: create a separate static class and put your extension methods inside: public static class MyExtensions { public static bool Valid(this LPed ped) { return ped != null && ped.Exists(); } } then you can use Valid() on all LPeds like this: LPed myPed = new LPed(...); if(myPed.Valid()) { //do something } 2) You need to understand classes to break your plugin into more comprehensible parts. For now I'd say keep it as it is and get some theory on classes. 3) You are not checking if the result of GetClosestVehicle() is a valid entity. It should be like this: private bool GetEnforcerArmoryState() { Vehicle v = World.GetClosestVehicle(lcpdfrPlayer.Ped.Position, 3f); if(v != null && v.Exists()) { LVehicle closestVehicle = LVehicle.FromGTAVehicle(v); return closestVehicle != null && closestVehicle.Exists() && closestVehicle.Model.ModelInfo.Hash == Enforcer; } else return false; }
  23. You use an existence check with an improper condition: "entity != null || entity.Exists()" means that it is enough for an entity to be not null. It should look like this: "entity != null && entity.Exists()". I recommend to add to your project an extension methods for all entities so you can make your life easier. public static bool Valid(this LPed ped) { return ped != null && ped.Exists(); } public static bool Valid(this LVehicle veh) { return veh != null && veh.Exists(); } public static bool Valid(this GTA.@base.Object obj) { return obj != null && obj.Exists(); } If you are not aware of what extension methods are and how to implement them, google will help you. One more thing, you should consider breaking your class into smaller (eg. you could create a dedicated class for a squad). 2k lines is too much to comprehend.
  24. A functional version is already available for our beta testers (https://www.fiskey111mods.com/). In the last month we caught some delay caused by quite serious real life changes but yesterday we decided about a deadline, I won't reveal specifics but I can assure you I'm determined to release the mod ASAP.
×
×
  • Create New...