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

Menu won't recognize that dog was spawned if there are players around the user. #4

Open
KevinL852 opened this issue Jan 4, 2024 · 4 comments

Comments

@KevinL852
Copy link
Contributor

When other players are around the player trying to use the script it will let them set the dog's name and spawn it, but the menu won't recognize that the dog was spawned. Instead, it will continue to let them spawn more dogs, essentially creating an army of them until it recognises one of them and then gives the player the interaction options. When trying to spawn a dog with no players around, this issue does not occur.

@Mathu-lmn
Copy link
Owner

Hello, have you tried checking the server console and see if it prints the ped handle and its network ID ?
But I believe the issue comes from this part :

    NetworkRequestControlOfNetworkId(dog)
    repeat
        Wait(1)
    until NetworkHasControlOfNetworkId(dog)

Try replacing this by :

    NetworkRequestControlOfNetworkId(dog)
    repeat
        Wait(1)
        NetworkRequestControlOfNetworkId(dog)
    until NetworkHasControlOfNetworkId(dog)

@KevinL852
Copy link
Contributor Author

What I get in the console is the following: Warning: GetNetworkObject: no object by ID 65534

I'll try replacing that bit of code and see if that works. I'll let you know.

@KevinL852
Copy link
Contributor Author

I've replaced the bit of code with what you provided and the issue still occurs but is less frequent. It recognizes the dog either instantly or after spawning 2. It won't spawn an entire army anymore. This seems to only happen once, if it does spawn 2 of them, dismissing the dog and deleting the second dog PED seems to clear it. If I then try it again it works fine.
It's not optimal but better than what it was before.

@KevinL852
Copy link
Contributor Author

I've replaced the bit of code with what you provided and the issue still occurs but is less frequent. It recognizes the dog either instantly or after spawning 2. It won't spawn an entire army anymore. This seems to only happen once, if it does spawn 2 of them, dismissing the dog and deleting the second dog PED seems to clear it. If I then try it again it works fine. It's not optimal but better than what it was before.

Seems like this wasn't correct, replacing the existing code with the new code does not seem to solve anything unfortunately.

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

2 participants