Which is the better method?
#1

Hey

Which is the better method to detect that the player is near to a dumpster. I have about 250 positions and i want to check when the player comes to it.

Method one: Create dynamic areas to all of the dumpsters and use the area callbacks (OnPlayerEnter..., OnPlayerLeave...)

Method two: Use a fast (about 500-700ms) per player timer and check with IsPlayerRangeOfPoint...

I don't want to check if the player is in any vehicle and whenever a player is running too fast.
I think i have to use the second method, becouse whenever a player is in a vehicle i cant use OnPlayerEnterDynamicArea, becouse when the player leaves the vehicle, it's still in the dynamic area.

Sorry for my bad english.
I need your advices,
Thanks
Reply
#2

Method one is better than method two, but if you have 100-200 players you can use method two ( one second timer )
Reply
#3

I would recommend method 1. Create areas around the dumpsters (so they are dynamic)

Arent the dynamic area callbacks called when you're in a car aswell?
If not, do what jlalt said - check under "OnPlayerStateChange" to ensure the area is / isn't what you want.

Alternatively you could check whenever the cars(dumpsters) stream in for the player, and then proceed with the code. No sure what you want to do with the checks btw.

This way you do not need a timer. Personally I don't like having timers for these types of things.
Reply
#4

I solved it using OnPlayerStateChange so it working as i want.

Quote:
Originally Posted by denNorske
Посмотреть сообщение
This way you do not need a timer. Personally I don't like having timers for these types of things.
I don't like using timers for checking theese type of things, but im afraid of using a lot of dynamic area.
For example this kind of system (just the dumpster) use about 250 dynamic area and my other object interact system (food vendors, sprunk machines etc) about 400-600 and it's almost 1000 dynamic areas.
Which is the number of dynamic area's when I shouldn't use more?
Reply
#5

As long as your dynamic areas are not very close to each other it shouldn't be a problem IMO as they are 'dynamic', just like objects.
Reply
#6

Quote:
Originally Posted by m4karow
Посмотреть сообщение
I solved it using OnPlayerStateChange so it working as i want.


I don't like using timers for checking theese type of things, but im afraid of using a lot of dynamic area.
For example this kind of system (just the dumpster) use about 250 dynamic area and my other object interact system (food vendors, sprunk machines etc) about 400-600 and it's almost 1000 dynamic areas.
Which is the number of dynamic area's when I shouldn't use more?
That is nothing really the streamer has no problem dealing with a measly 1000 dynamic areas.
Reply
#7

Quote:
Originally Posted by m4karow
Посмотреть сообщение
Which is the number of dynamic area's when I shouldn't use more?
One of my old scripts uses about 30k areas (of all sizes and forms), and it's working perfectly fine. The way the Streamer Plugin processes them is WAY more efficient than you can achieve with PAWN or even C when using natives only (at a comparable scale).
Reply
#8

Okay thanks guys
I'll use dynamic areas
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)