Add OnPlayerWorldChange
#1

Suggestion to add native OnPlayerWorldChange in 0.3.7-DL and 0.3.7.

OnPlayerWorldChange

Description: Called when a player changes virtual world.

Parameters: (playerid, newvwid, oldvwid)
  • playerid - The playerid who changed virtual world.
  • newvwid - The virtual world the player is now in.
  • oldvwid - The virtual world the player was in before.
Reply
#2

Virtual worlds (IIRC) can not be changed client side and there are no triggers that change them (e.g: the yellow markers if enabled, they only change interior ID).

That said, you can hook SetPlayerVirtualWorld and call this directly with essentially no negative performance impact already.
Reply
#3

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Virtual worlds (IIRC) can not be changed client side and there are no triggers that change them (e.g: the yellow markers if enabled, they only change interior ID).

That said, you can hook SetPlayerVirtualWorld and call this directly with essentially no negative performance impact already.
OnPlayerWorldChange with similar fuction to native OnPlayerInteriorChange in server-side, this is not possible?
Reply
#4

I support this idea. It would help in the issue of some bugs with the virtual world.
Reply
#5

You can make this, and the amount of usage it would have is pretty slim...

It's not like an interior that changes often in the game itself, where the VW is forcibly changed by the script anyway, so as Abagail said, you could easily hook into SetPlayerVirtualWorld, and simply track it in this.

Gammix already even made it... https://sampforum.blast.hk/showthread.php?tid=573961

Quote:
Originally Posted by Gammix
Посмотреть сообщение
Код:
public OnPlayerVirtualWorldChange(playerid, newworld, oldworld);
Reply
#6

Here you are:

Код:
stock _SetPlayerVirtualWorld(playerid, world)
{
	OnPlayerWorldChange(playerid, GetPlayerVirtualWorld(playerid), world);
        SetPlayerVirtualWorld(playerid, world);
}
#define SetPlayerVirtualWorld(%0,%1) _SetPlayerVirtualWorld(%0,%1)
Reply
#7

Quote:
Originally Posted by raydx
Посмотреть сообщение
Here you are:

Код:
stock _SetPlayerVirtualWorld(playerid, world)
{
	OnPlayerWorldChange(playerid, GetPlayerVirtualWorld(playerid), world);
}
#define SetPlayerVirtualWorld(%0,%1) _SetPlayerVirtualWorld(%0,%1)
Nope. This won't change the virtual world, making the Set function fairly useless.
PHP код:
stock S_SetPlayerVirtualWorldplayeridworld )
{
    
OnPlayerWorldChangeplayeridGetPlayerVirtualWorld(playerid), world );
    return 
SetPlayerVirtualWorldplayeridworld );
}
#if defined _ALS_SetPlayerVirtualWorldOnVirtualWorldChange
    #undef SetPlayerVirtualWorld
#else
    #define _ALS_SetPlayerVirtualWorld
#endif
#define SetPlayerVirtualWorld S_SetPlayerVirtualWorld 
Reply
#8

This is what's good ^^
Reply
#9

I think what SetPlayerVirtualWorld should be called before OnPlayerWorldChange.
Reply
#10

Quote:
Originally Posted by iKarim
Посмотреть сообщение
Nope. This won't change the virtual world, making the Set function fairly useless.
PHP код:
stock S_SetPlayerVirtualWorldplayeridworld )
{
    
OnPlayerWorldChangeplayeridGetPlayerVirtualWorld(playerid), world );
    return 
SetPlayerVirtualWorldplayeridworld );
}
#if defined _ALS_SetPlayerVirtualWorldOnVirtualWorldChange
    #undef SetPlayerVirtualWorld
#else
    #define _ALS_SetPlayerVirtualWorld
#endif
#define SetPlayerVirtualWorld S_SetPlayerVirtualWorld 
Just forgot to add SetPlayerVirtualWorld, its fixed now. Anyway, that ALS things are useless in this case.
Reply
#11

Those 'ALS things' are more advanced than what you are capable of, but do not make them useless.
Reply
#12

why would you even want this when it can only be modified through script and not by a client at all except if the player is using modified game files (asi, samods, cleo etc)
Reply
#13

client can't change virtual world, so you can create its callback manually, without any incs/plugins.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)