Giter Club home page Giter Club logo

Comments (3)

Henry12116 avatar Henry12116 commented on August 22, 2024

Thank you for the heads up. Doesn't work how? Is it throwing an error or just doing nothing?

Also you can copy my work, but you need to include my license in your code:
https://github.com/Henry12116/hackee-dispatch/blob/master/LICENSE#L12-L13
https://github.com/cdgmx/custom_dispatch

from hackee-dispatch.

cdgmx avatar cdgmx commented on August 22, 2024

from hackee-dispatch.

Henry12116 avatar Henry12116 commented on August 22, 2024

Hmm I see. I think I read about TerminateThread here but it seems like this doesn't work for other people either. We can stop a thread by simply calling return or break.

Maybe create a new table that basically maps threadID --> shouldBeTurnedOff. Initialize as false for newly created threads. Then within each dispatch thread, at the start check if it should be turned off. If so break. Something like this maybe:

while true do
   shouldTurnOff = tableStatuses[threadID]
   if shouldTurnOff then
        break
   end

    local plyPed = GetPlayerPed(-1)
    local plyPos = GetEntityCoords(plyPed)
    Citizen.Wait(1)
    if ESX.PlayerData.job ~= nil and table.contains( squad.EnemiesWith, ESX.PlayerData.job.name) and (GetVecDist(plyPos, squad.CentralPos) < squad.TriggerDistance) and IsShockingEventInSphere(squad.Event, squad.CentralPos.x, squad.CentralPos.y, squad.CentralPos.z, squad.TriggerDistance) then
      SpawnEnemyDispatch(squad)
      Citizen.Wait(squad.TimeBeforeUpAgain)
    end
end

Then stopAOEListener will only have to toggle the status for each thread.

I have to play around with this idea some more, but if you get something working before me feel free to submit a PR 🙂

from hackee-dispatch.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.