Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetworkHasControlOfEntity Issues #4

Open
Vampurica opened this issue Aug 23, 2019 · 3 comments
Open

NetworkHasControlOfEntity Issues #4

Vampurica opened this issue Aug 23, 2019 · 3 comments

Comments

@Vampurica
Copy link

The pull request that was merged #1 has an issue here where it may never return.
In my testing this can cause beds to not delete if the script gets locked in this loop and the vehicle is then deleted. There should be a timeout or something similar put into it to prevent this.

while not NetworkHasControlOfEntity(newCar) do Wait(0) end

@Mikkelhost
Copy link

After som debugging, i found out that this happens when the raycast returns 0 which means it hasn't found a vehicle on the bed... For some reason the if statement 'if newCar then' does nok work correctly.
I changed it to 'if newCar ~= 0 then'. And then made an else statement for when the raycast returns 0.

This prevents the script from ever going into the infinite loop you are mentioning. There are some addon cars that the raycast just wont find. Therefore i also added so that if the raycast returns 0 it instead uses the last car that i entered, which should be the car i drove onto the bed. This has been working flawlessly ever since.

@Enric42
Copy link

Enric42 commented Dec 1, 2019

@Mikkelhost hello I had found the same problem your changes interests me a lot

just like the LSPD model problem or the fact that a non-mechanic can control the maneuver

if you could share me your work thank you very much, the author does not seem to update the script anymore or correct all this

@EGUltraTM
Copy link

Thats my fix of breaking the function othzerwise
if newCar ~= 0 then local carPos = GetEntityCoords(newCar, false) NetworkRequestControlOfEntity(newCar) while not NetworkHasControlOfEntity(newCar) do Wait(0) end AttachEntityToEntity(newCar, bed, 0, attachmentOffset[1] + vector3(0.0, 0.0, carPos.z - bedPos.z - 0.50), attachmentOffset[2], 0, 0, false, 0, 0, 1) car = newCar DecorSetInt(veh, "flatbed3_car", VehToNet(newCar)) attached = true DecorSetBool(veh, "flatbed3_attached", attached) else attached = false end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants