Using a 1 second timer or OnPlayerUpdate -
Natric - 18.06.2014
Hello there,
I'm wondering, should I use a 1 second timer over OnPlayerUpdate in this following situation:
Well, some guy told me that OnPlayerUpdate is called more than 200 times in a second or something, and I am doing a system that if you're out of a certain range of something a variable will be set, so should I use OnPlayerUpdate or a 1 second timer (a server timer, SetTimer).
Thanks in advance.
Re: Using a 1 second timer or OnPlayerUpdate -
Konstantinos - 18.06.2014
If I had to choose between those two, I'd go with a timer than OnPlayerUpdate (200 times is too much but it's called too frequently). However, using streamer's dynamic area would be much better.
Re: Using a 1 second timer or OnPlayerUpdate -
Rittik - 18.06.2014
Yes, you can.
Re: Using a 1 second timer or OnPlayerUpdate -
Natric - 18.06.2014
Are you talking about using CreateDynamicSphere?
Re: Using a 1 second timer or OnPlayerUpdate -
Konstantinos - 18.06.2014
Quote:
Originally Posted by Natric
Are you talking about using CreateDynamicSphere?
|
Depends on the type of the area so it's up to you.
Re: Using a 1 second timer or OnPlayerUpdate -
Natric - 18.06.2014
using IsPlayerInRangeOfPoint might be better right?, If I'm using a variable already
Re: Using a 1 second timer or OnPlayerUpdate -
Rittik - 18.06.2014
Quote:
Originally Posted by Natric
using IsPlayerInRangeOfPoint might be better right?, If I'm using a variable already
|
In my
opinion, yes. That would be better.
Re: Using a 1 second timer or OnPlayerUpdate -
Natric - 18.06.2014
for instance,
under the timer:
pawn Код:
if(PlayerSpot[playerid][31])
{
if(IsPlayerInRangeOfPoint(playerid, 30.0, x, y, z))
{
// code here
}
}
Re: Using a 1 second timer or OnPlayerUpdate -
Pottus - 18.06.2014
Quote:
Originally Posted by Natric
for instance,
under the timer:
pawn Код:
if(PlayerSpot[playerid][31]) { if(IsPlayerInRangeOfPoint(playerid, 30.0, x, y, z)) {
// code here
} }
|
Just use dynamic areas that will work but certainly is not the best way.
Re: Using a 1 second timer or OnPlayerUpdate -
Rittik - 18.06.2014
Make sure that you use SetTimeEx and add some parameters to it.