SA-MP Forums

Go Back   SA-MP Forums > SA-MP DL Edition > SA-MP 0.3.DL

Reply
 
Thread Tools Display Modes
Old 26/11/2017, 09:19 PM   #1
RIDE2DAY
Huge Clucker
 
RIDE2DAY's Avatar
 
Join Date: Jul 2015
Location: Modena, Italy
Posts: 220
Reputation: 375
Default [Bug Report] NPC/vehicle issues when using virtual worlds

EDIT: this post has been edited in order to explain better what's going on.

Okay, basically there is a streaming fail when using virtual worlds. I could reproduce this bug with two different ways. Before anything, assume all objects have been downloaded and we're relying on the cache.

Method #1 (usually happens when reconnecting to a server)
A real player reconnects, we set his virtual world to 1 in OnPlayerConnect and we set the spectate mode for him in OnPlayerRequestClass (called after OnPlayerFinishedDownloading).

Now, in virtual world 0, we connect a NPC and when it spawns we create a vehicle in order to put the NPC as driver.

Alright, if now we set NPC's and vehicle's virtual world to 1, they don't stream for the real player! Notice how in the next video OnPlayerFinishedDownloading isn't called when the player connects.

Method #1 video here.


Method #2 (happens always)
This method is very similar to the first one, but changing a little bit the order. So we connect the real player, we set the virtual world to 1 and we put him into the spectate mode.

Now we connect the NPC and we set its virtual to 1, it should stream for the player (sometimes if you're just reconnecting without leaving the game it doesn't). We create a vehicle, but surprise: it doesn't stream for the NPC, but just for the real player!

So there is no way to put the NPC in the vehicle.

Method #2 video here.


CONCLUSION
Seems that OnPlayerFinishedDownloading is not being called sometimes when reconnecting, maybe that's what causes these bugs, Kalcor said once: "players won't stream anything until after OnPlayerFinishedDownloading is called". Alright, that might explain the bug, but OnPlayerFinishedDownloading is being called when using the 2nd method to reproduce it.

Last edited by RIDE2DAY; 08/12/2017 at 01:00 AM.
RIDE2DAY is offline   Reply With Quote
Old 26/11/2017, 09:22 PM   #2
DleyDeR
Little Clucker
 
DleyDeR's Avatar
 
Join Date: May 2017
Location: SA-MP
Posts: 35
Reputation: 6
Default Re: [Bug Report] NPC/vehicle issues when using virtual worlds

http://forum.sa-mp.com/showthread.php?t=645254

You must change PutPlayerInVehicle before SetVehicleVirtualWorld.

CreateVehicle
PutPlayerInVehicle
SetVehicleVirtualWorld
SetPlayerVirtualWorld
DleyDeR is offline   Reply With Quote
Old 07/12/2017, 08:25 PM   #3
RIDE2DAY
Huge Clucker
 
RIDE2DAY's Avatar
 
Join Date: Jul 2015
Location: Modena, Italy
Posts: 220
Reputation: 375
Default Re: [Bug Report] NPC/vehicle issues when using virtual worlds

I know there are many bugs out there but allow me to bump this one, basically I reported it because it screwed up most of my NPC scripts.

Let's assume OnPlayerFinishedDownloading is being called even if the player doesn't download nothing, it's okay, but all other functions should be executed IMHO. Like setting vehicle's virtual world, PutPlayerInVehicle for the NPC, etc. They just do nothing! Shouldn't they do what they're supposed to do even if there aren't real players inside that virtual world?
RIDE2DAY is offline   Reply With Quote
Old 07/12/2017, 08:55 PM   #4
BeckzyBoi
Beta Tester
 
Join Date: Dec 2006
Posts: 1,717
Reputation: 127
Default Re: [Bug Report] NPC/vehicle issues when using virtual worlds

You could use OnVehicleStreamIn to put the player in the vehicle. That's what I've done temporarily to fix my driving school script in 0.3.8 in case it isn't fixed internally.
__________________
BeckzyBoi is online now   Reply With Quote
Old 07/12/2017, 10:13 PM   #5
RIDE2DAY
Huge Clucker
 
RIDE2DAY's Avatar
 
Join Date: Jul 2015
Location: Modena, Italy
Posts: 220
Reputation: 375
Default Re: [Bug Report] NPC/vehicle issues when using virtual worlds

Quote:
Originally Posted by BeckzyBoi View Post
You could use OnVehicleStreamIn to put the player in the vehicle. That's what I've done temporarily to fix my driving school script in 0.3.8 in case it isn't fixed internally.
What do you mean exactly? When the vehicle streams in for the player or for the NPC?

Grazie in anticipo!
RIDE2DAY is offline   Reply With Quote
Old 07/12/2017, 10:15 PM   #6
BeckzyBoi
Beta Tester
 
Join Date: Dec 2006
Posts: 1,717
Reputation: 127
Default Re: [Bug Report] NPC/vehicle issues when using virtual worlds

Quote:
Originally Posted by RIDE2DAY View Post
What do you mean exactly? When the vehicle streams in for the player or for the NPC?

Grazie in anticipo!
Whichever one you're trying to put in the vehicle.
__________________
BeckzyBoi is online now   Reply With Quote
Old 07/12/2017, 10:19 PM   #7
RIDE2DAY
Huge Clucker
 
RIDE2DAY's Avatar
 
Join Date: Jul 2015
Location: Modena, Italy
Posts: 220
Reputation: 375
Default Re: [Bug Report] NPC/vehicle issues when using virtual worlds

I'm trying to put the NPC, the funny fact is that both are being created at the same coordinates and everything works alright while the virtual world used is 0. Things start to mess up when going over 0. I'll give a try to what you said.

EDIT: when the player spawns, the NPC and the vehicle doesn't stream in for the player! And all them are using the same virtual world.

Last edited by RIDE2DAY; 08/12/2017 at 12:41 AM.
RIDE2DAY is offline   Reply With Quote
Old 07/12/2017, 10:52 PM   #8
BeckzyBoi
Beta Tester
 
Join Date: Dec 2006
Posts: 1,717
Reputation: 127
Default Re: [Bug Report] NPC/vehicle issues when using virtual worlds

In 0.3.8, when useartwork is enabled, the player always enters a download state when joining or changing virtual worlds (even if there are no files to download). If the virtual world has changed AND they've finished downloading any required files, the server will find them in the virtual world before they finished downloading. So basically - with useartwork enabled you're supposed to deal with all join/vworld transitions through OnPlayerFinishedDownloading.
__________________
BeckzyBoi is online now   Reply With Quote
Old 10/12/2017, 03:04 PM   #9
RIDE2DAY
Huge Clucker
 
RIDE2DAY's Avatar
 
Join Date: Jul 2015
Location: Modena, Italy
Posts: 220
Reputation: 375
Default Re: [Bug Report] NPC/vehicle issues when using virtual worlds

I've noticed something strange related to this bug today, maybe this helps for fixing it. Let me explain:

If you restart the server while player's virtual is set to 1 and you reconnect without closing the game, OnPlayerFinishedDownloading won't be called even if their new virtual world is 0, neither if you use SetPlayerVirtualWorld to 1. I guess, somehow, the game still thinks it's using VW 1 and it doesn't call OnPlayerFinishedDownloading .

Maybe all this doesn't happen if you connect to the server for the first time, but if you're reconnecting, while development it's really annoying.
RIDE2DAY is offline   Reply With Quote
Old 10/12/2017, 03:12 PM   #10
Locky_
High-roller
 
Locky_'s Avatar
 
Join Date: Jul 2012
Posts: 1,605
Reputation: 321
Default Re: [Bug Report] NPC/vehicle issues when using virtual worlds

Quote:
Originally Posted by RIDE2DAY View Post
I've noticed something strange related to this bug today, maybe this helps for fixing it. Let me explain:

If you restart the server while player's virtual is set to 1 and you reconnect without closing the game, OnPlayerFinishedDownloading won't be called even if their new virtual world is 0, neither if you use SetPlayerVirtualWorld to 1. I guess, somehow, the game still thinks it's using VW 1 and it doesn't call OnPlayerFinishedDownloading .

Maybe all this doesn't happen if you connect to the server for the first time, but if you're reconnecting while development it's really annoying.
This occurs even if you do not restart the server. If the player reconnects, the callback is not called. I also think this should be corrected before the official release.
__________________


Locky_ is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with virtual worlds tommzy09 Scripting Help 6 10/08/2014 06:11 PM
max on Virtual Worlds? Antonio [G-RP] Help Archive 1 18/01/2011 03:17 AM
Virtual Worlds ScottCFR Help Archive 4 10/04/2010 09:24 PM
NPC IN VIRTUAL WORLDS Brian_Furios Help Archive 1 26/01/2010 11:24 PM
Virtual worlds use :D luby Help Archive 8 28/07/2009 08:38 AM


All times are GMT. The time now is 07:41 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.