Is there a better way ?
#3

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

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;
}
This will (if your code works) check If the player changed world every second.

Reply


Messages In This Thread
Is there a better way ? - by Kyosaur - 15.03.2010, 08:07
Re: Is there a better way ? - by cessil - 15.03.2010, 09:55
Re: Is there a better way ? - by Mike Garber - 15.03.2010, 11:18
Re: Is there a better way ? - by Kyosaur - 15.03.2010, 11:27
Re: Is there a better way ? - by Mike Garber - 15.03.2010, 11:32
Re: Is there a better way ? - by Kyosaur - 15.03.2010, 11:40
Re: Is there a better way ? - by Desert - 15.03.2010, 12:08
Re: Is there a better way ? - by WackoX - 15.03.2010, 12:11
Re: Is there a better way ? - by Finn - 15.03.2010, 12:29
Re: Is there a better way ? - by Kyosaur - 15.03.2010, 12:40

Forum Jump:


Users browsing this thread: 1 Guest(s)