OnPlayerFinishedDownloading -
Sanady - 12.11.2017
Good morning scripters

, I found something strange for me, I used grandlarc GM to test few skins for my server which is in developing for a looong time, but let`s forget that and get to the point, so when I change virtual world everytime, callback OnPlayerFinishedDownloading is called, why?
Is it because it has parameter which contains virtualworld or it is bug? Here are few screens to demonstrate:
This is inside interior of the house:
When I left house:
Re: OnPlayerFinishedDownloading -
Romz - 12.11.2017
https://sampwiki.blast.hk/wiki/OnPlayerFinishedDownloading
Have you read the documentation for this function? It should be so!
Re: OnPlayerFinishedDownloading -
Zeth - 12.11.2017
Read about
OnPlayerFinishedDownloading
Re: OnPlayerFinishedDownloading -
Sanady - 12.11.2017
Quote:
Originally Posted by Debjit
|
Ahaaaa ok thank you.
Re: OnPlayerFinishedDownloading -
BigETI - 12.11.2017
This is a bad name for an event where it gets invoked at virtual world change.
Re: OnPlayerFinishedDownloading -
Kyle - 12.11.2017
Quote:
Originally Posted by BigETI
This is a bad name for an event where it gets invoked at virtual world change.
|
This should be altered so it's only actually called when downloads have taken place.
Re: OnPlayerFinishedDownloading -
IllidanS4 - 12.11.2017
Well, if there are no models, it is kinda true that the player has loaded
all of them. There could be some additional parameter, for example the count of those models.
Re: OnPlayerFinishedDownloading -
Romz - 12.11.2017
Quote:
Originally Posted by sprtik
Well, if there are no models, it is kinda true that the player has loaded all of them. There could be some additional parameter, for example the count of those models.
|
The function really needs to be improved. Most likely, she will receive minor changes in RC2
Re: OnPlayerFinishedDownloading -
Freaksken - 12.11.2017
I added that warning, because that's what I found counterintuitive when testing that callback.
Re: OnPlayerFinishedDownloading -
ISmokezU - 12.11.2017
Well, Shouldn't it just be once and it goes for all virtual worlds?
That would be so much better.
Re: OnPlayerFinishedDownloading -
Freaksken - 12.11.2017
The callback has 'downloading' in its name. I first thought it referred to the actual downloading at the beginning of the player connecting to the server, now I don't really get what it's supposed to refer to.
Re: OnPlayerFinishedDownloading -
renatog - 12.11.2017
It's probably a bug since you just download a new model if you're in its virtual world (-1 download it at connection). It's totally fine calling this callback more than one time, see the following scenario:
- You AddSimpleModel speficying a virtual world (suppose 10);
- A player connects and start downloading custom models without VW (-1);
- The player wanna join an event at VW 10 which uses the model you previously added, so the download is started and the callback is called again when it's finished.
Re: OnPlayerFinishedDownloading -
Lucases - 12.11.2017
This can be useful when a server uses a lot of custom objects, if the callback gets called only when theu change virtual world it will decrease downloading time.
Anyway I prefer to download models all in once and play without problems.
Re: OnPlayerFinishedDownloading -
TommyB - 13.11.2017
Quote:
Originally Posted by Kyle
This should be altered so it's only actually called when downloads have taken place.
|
This isn't ideal for servers that set up cinematic cameras while prompting a user to register or login. It should absolutely be called during the initial server connection because that makes it easier to set up proper login/register scripts. During initial testing, I had concerns about the download box appearing over login dialogs during a player's first connection. This callback was added to make transitioning from these stages more fluid. I do agree that a virtual world change shouldn't call it unless a download actually happens, but I'm sure everyone is capable of throwing together code to prevent unwanted execution. For my server I did this:
Code:
public OnPlayerFinishedDownloading(playerid, virtualworld)
{
if(!Logged{playerid})
{
//etc
}
}
Re: OnPlayerFinishedDownloading -
IllidanS4 - 14.11.2017
Well, I think we can settle on that this callback should really be called
OnPlayerWorldLoaded.
Re: OnPlayerFinishedDownloading -
Romz - 14.11.2017
Quote:
Originally Posted by sprtik
Well, I think we can settle on that this callback should really be called OnPlayerWorldLoaded.
|
You can do it yourself, there is no need for it.
Re: OnPlayerFinishedDownloading -
Kalcor - 16.11.2017
When the server has useartwork enabled, the player enters a download state when they first connect to the server, and for every virtualworld change. It doesn't matter if there are no files needing to download, the player will still enter the download state and check for needed files.
Re: OnPlayerFinishedDownloading -
Sn0wk - 16.11.2017
Quote:
Originally Posted by Kalcor
When the server has useartwork enabled, the player enters a download state when they first connect to the server, and for every virtualworld change. It doesn't matter if there are no files needing to download, the player will still enter the download state and check for needed files.
|
Okay but why is it needed at every virtual world change tho? Didn't understand it yet.
Re: OnPlayerFinishedDownloading -
Kalcor - 16.11.2017
Because from the script level you need to know that the player has all the models for the vworld and you can start creating custom objects.
Re: OnPlayerFinishedDownloading -
Sn0wk - 16.11.2017
Quote:
Originally Posted by Kalcor
Because from the script level you need to know that the player has all the models for the vworld and you can start creating custom objects.
|
Oh okay, I'm sorry, I thought the custom models were downloaded and loaded globally only once and used for all vworlds.