Add OnPlayerVirtualWorldChange(playerid, virtualword)
#1

Now exist OnPlayerInteriorChange(playerid, newinterior, oldinterior), and virtualworlds? Maybe is good idea add this callback.


Sorry for my bad english, but i have this idea and need expose it.
Reply
#2

No.

Virtual worlds can only be changed by your script.

Interiors can be changed by GTA itself, just by entering a building. That's why it was important to have the OnPlayerInteriorChange callback.

For virtual worlds you could just call a custom callback in a SetPlayerVirtualWorld hook.
Reply
#3

I think this should work. Insert it at the start.
Код:
SetPlayerVirtualWorldEx(playerid, worldid);
{
	new oldworld = GetPlayerVirtualWorld(playerid);
	if(oldworld != worldid) {
		SetPlayerVirtualWorld(playerid, worldid);
		CallRemoteFunction("OnPlayerVirtualWorldChange", "iii", playerid, oldworld, worlid);
	}
}
#if defined _ALS_SetPlayerVirtualWorld
	#undef SetPlayerVirtualWorld
#else
	#define _ALS_SetPlayerVirtualWorld
#endif
#define SetPlayerVirtualWorld SetPlayerVirtualWorldEx
Reply
#4

Quote:
Originally Posted by mooman
Посмотреть сообщение
I think this should work. Insert it at the start.
Код:
SetPlayerVirtualWorldEx(playerid, worldid);
{
	new oldworld = GetPlayerVirtualWorld(playerid);
	if(oldworld != worldid) {
		SetPlayerVirtualWorld(playerid, worldid);
		CallRemoteFunction("OnPlayerVirtualWorldChange", "iii", playerid, oldworld, worlid);
	}
}
#if defined _ALS_SetPlayerVirtualWorld
	#undef SetPlayerVirtualWorld
#else
	#define _ALS_SetPlayerVirtualWorld
#endif
#define SetPlayerVirtualWorld SetPlayerVirtualWorldEx
Yup, that'll do the trick. Just make sure you also forward the function:
pawn Код:
forward OnPlayerVirtualWorldChange(playerid, oldworld, newworld);
Reply
#5

https://sampforum.blast.hk/showthread.php?tid=576958
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)