Using a 1 second timer or OnPlayerUpdate
#1

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.
Reply
#2

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.
Reply
#3

Yes, you can.
Reply
#4

Are you talking about using CreateDynamicSphere?
Reply
#5

Quote:
Originally Posted by Natric
Посмотреть сообщение
Are you talking about using CreateDynamicSphere?
Depends on the type of the area so it's up to you.
Reply
#6

using IsPlayerInRangeOfPoint might be better right?, If I'm using a variable already
Reply
#7

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.
Reply
#8

for instance,

under the timer:
pawn Код:
if(PlayerSpot[playerid][31])
{
if(IsPlayerInRangeOfPoint(playerid, 30.0, x, y, z))
{

// code here

}
}
Reply
#9

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.
Reply
#10

Make sure that you use SetTimeEx and add some parameters to it.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)