SA-MP Forums Archive
OnPlayerWirtualWorldChange - 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: OnPlayerWirtualWorldChange (/showthread.php?tid=575697)



OnPlayerWirtualWorldChange - NoDi522 - 29.05.2015

Hello.

Is there a similar function as the title?
If there isn't,what should I use instead of that?

Thanks.


Re: OnPlayerWirtualWorldChange - Gammix - 29.05.2015

https://sampforum.blast.hk/showthread.php?pid=3456977#pid3456977
Check playercalls.inc branch.

pawn Код:
public OnPlayerVirtualWorldChange(playerid, newworld, oldworld)
{
    return 1;
}



Re: OnPlayerWirtualWorldChange - Emmet_ - 29.05.2015

Use a variable to contain the player's virtual world.

pawn Код:
new g_VirtualWorld[MAX_PLAYERS];
Then under OnPlayerUpdate, check if the value within the array doesn't match the player's current virtual world.

pawn Код:
public OnPlayerUpdate(playerid)
{
    new worldid = GetPlayerVirtualWorld(playerid);
 
    if (g_VirtualWorld[playerid] != worldid)
    {
        g_VirtualWorld[playerid] = worldid;

        // Player changed virtual worlds.
    }
    return 1;
}
Only way to do this, AFAIK.


AW: OnPlayerWirtualWorldChange - Mellnik - 29.05.2015

Why do you need this? Players can only change VW with SetPlayerVirtualWorld, so you can track yourself what you set.