OnPlayerFinishedDownloading
#1

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:
Reply
#2

https://sampwiki.blast.hk/wiki/OnPlayerFinishedDownloading

Have you read the documentation for this function? It should be so!
Reply
#3

Read about OnPlayerFinishedDownloading
Reply
#4

Quote:
Originally Posted by Debjit
View Post
Ahaaaa ok thank you.
Reply
#5

This is a bad name for an event where it gets invoked at virtual world change.
Reply
#6

Quote:
Originally Posted by BigETI
View Post
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.
Reply
#7

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.
Reply
#8

Quote:
Originally Posted by sprtik
View Post
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
Reply
#9

I added that warning, because that's what I found counterintuitive when testing that callback.
Reply
#10

Well, Shouldn't it just be once and it goes for all virtual worlds?

That would be so much better.
Reply
#11

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.
Reply
#12

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.
Reply
#13

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.
Reply
#14

Quote:
Originally Posted by Kyle
View Post
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
	}
}
Reply
#15

Well, I think we can settle on that this callback should really be called OnPlayerWorldLoaded.
Reply
#16

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.
Reply
#17

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.
Reply
#18

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.
Reply
#19

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.
Reply
#20

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)