15.03.2010, 11:18
Why would you need It?
If It's for user stats, just save it under OnPlayerDisconnect or use a timer.
https://sampwiki.blast.hk/wiki/SetTimer
This will (if your code works) check If the player changed world every second.
If It's for user stats, just save it under OnPlayerDisconnect or use a timer.
https://sampwiki.blast.hk/wiki/SetTimer
pawn Код:
// TOP OF YOUR SCRIPT
forward CheckPlayerWorldChange(playerid);
// Under OnGameModeInit
SetTimer("CheckPlayerWorldChange",1000,true); // True = Repeat False = Once (One Second Timer)
// Change 1000 to 500 If you want It to check twice / second
// Change 1000 to 250 If you want it to check four times / second
// Change 1000 to 125 If you want it to check 8 times / second
// And so on....
// Anywhere (NOT under any callback)
public CheckPlayerWorldChange(playerid)
{
pData[playerid][WorldCheck] = GetPlayerVirtualWorld(playerid);
if(pData[playerid][WorldCheck] != pData[playerid][NewWorld])
{
pData[playerid][OldWorld] = pData[playerid][NewWorld];
pData[playerid][NewWorld] = pData[playerid][WorldCheck];
OnPlayerWorldChange(playerid, pData[playerid][NewWorld], pData[playerid][OldWorld]);
}
return 1;
}