Regarding OnPlayerUpdate
#8

Quote:
Originally Posted by /^We(stie|z+[e|a
r)$/ ]
Basically it's a tick function. That's how I see it anyway.
Quote:
Originally Posted by cyber_punk
in depth tutorial on HOW TO USE it,
Westie's right and it should be used as a tick function. Do your script updates after "x" amount of updates, so for example:

pawn Код:
new g_PlayerTick[ MAX_PLAYERS ] = { 999, 999, ... }; // Create an array of ticks for each player and set them ALL to 999.

public OnPlayerUpdate( playerid )
{
  g_PlayerTick[ playerid ] --; // Decrease player ticks for the updating player by one on every update.

  if ( !g_PlayerTick[ playerid ] ) // If the players ticks for the updating player are equal to 0 then we can execute what function we wish to...
  {
    BanEx( playerid, "Using my bandwidthz" ); // Banning the updating player for using your bandwidth

    g_PlayerTick[ playerid ] = 999; // Reset the tick counter for the updating player to the original number once the ticks have run out. This allows us to start counting down again
  }
}
This code* will ban a player after 999 updates and then reset the tick counter so it will start again.

Use multiple tick counters for best effect, it will help balance the CPU load. So what I mean is don't try to run lots of code under one tick updater, try to use multiple tick updaters so you don't get a huge load at one time.

*code not tested, but should work. It serves as a logical explanation, not necessarily a working one..

Hope this helps.
Reply


Messages In This Thread
Regarding OnPlayerUpdate - by Woet - 11.08.2009, 11:11
Re: Regarding OnPlayerUpdate - by Andom - 11.08.2009, 11:53
Re: Regarding OnPlayerUpdate - by NeRoSiS - 11.08.2009, 14:57
Re: Regarding OnPlayerUpdate - by MenaceX^ - 11.08.2009, 19:48
Re: Regarding OnPlayerUpdate - by Westie - 11.08.2009, 21:55
Re: Regarding OnPlayerUpdate - by shady91 - 11.08.2009, 22:08
Re: Regarding OnPlayerUpdate - by cyber_punk - 16.08.2009, 19:36
Re: Regarding OnPlayerUpdate - by Simon - 17.08.2009, 01:33
Re: Regarding OnPlayerUpdate - by Googles - 17.08.2009, 02:00
Re: Regarding OnPlayerUpdate - by cyber_punk - 17.08.2009, 03:15

Forum Jump:


Users browsing this thread: 2 Guest(s)