Add OnPlayerVirtualWorldChange(playerid, virtualword) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Add OnPlayerVirtualWorldChange(playerid, virtualword) (
/showthread.php?tid=605737)
Add OnPlayerVirtualWorldChange(playerid, virtualword) -
jonybc - 24.04.2016
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.
Re: Add OnPlayerVirtualWorldChange(playerid, virtualword) -
Crayder - 24.04.2016
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.
Re: Add OnPlayerVirtualWorldChange(playerid, virtualword) -
mooman - 25.04.2016
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
Re: Add OnPlayerVirtualWorldChange(playerid, virtualword) -
Crayder - 25.04.2016
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);
Re: Add OnPlayerVirtualWorldChange(playerid, virtualword) -
n0minal - 30.04.2016
https://sampforum.blast.hk/showthread.php?tid=576958