SA-MP Forums Archive
EnablePlayerCameraTarget - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: EnablePlayerCameraTarget (/showthread.php?tid=573305)



EnablePlayerCameraTarget - iWhite - 06.05.2015

Hey guys.

I've wanted to ask you something about EnablePlayerCameraTarget function. In my server I use player's camera to point things and use them, like here:


I've been using GetPlayerCameraFrontVector and GetPlayerCameraPos to see if player is looking at objects or NPCs. Should I continue using it, or should I EnablePlayerCameraTarget and use GetPlayerCameraTarget?


Re: EnablePlayerCameraTarget - Konstantinos - 06.05.2015

You can use: https://sampwiki.blast.hk/wiki/GetPlayerCameraTargetObject
and I'm not sure if NPCs are targeted as "players": https://sampwiki.blast.hk/wiki/GetPlayerCameraTargetPlayer
If it does, a simply check (IsPlayerNPC) would be a good way to do this.


Re: EnablePlayerCameraTarget - iWhite - 06.05.2015

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You can use: https://sampwiki.blast.hk/wiki/GetPlayerCameraTargetObject
and I'm not sure if NPCs are targeted as "players": https://sampwiki.blast.hk/wiki/GetPlayerCameraTargetPlayer
If it does, a simply check (IsPlayerNPC) would be a good way to do this.
I've replaced NPCs with Actors, so I can use GetPlayerCameraTargetActor, but I want to know if GetPlayerCameraTarget functions will improve performance using instead of GetPlayerCameraPos and Vector, because Wiki says, that EnablePlayerCameraTarget will use a lot of bandwidth.


Re: EnablePlayerCameraTarget - Konstantinos - 06.05.2015

Quote:
Originally Posted by Kalcor
The camera targeting functions added in 0.3.7-RC1 will be disabled by default as it may use bandwidth on servers when it's not needed.
that's a downside but as I'm not aware of the answer you're looking for (never used it), let's wait for another member to reply.


Re: EnablePlayerCameraTarget - MP2 - 06.05.2015

Enabling camera targeting will use more server networking bandwidth, but using PAWN functions will slow your server down. I'd go for bandwidth. Shouldn't matter unless you're on a 56 kb/s host..


Re: EnablePlayerCameraTarget - iWhite - 06.05.2015

Quote:
Originally Posted by MP2
Посмотреть сообщение
Enabling camera targeting will use more server networking bandwidth, but using PAWN functions will slow your server down. I'd go for bandwidth. Shouldn't matter unless you're on a 56 kb/s host..
I'm planning to buy 80-100mbps server, is that ok?


Re: EnablePlayerCameraTarget - MP2 - 06.05.2015

I'm sure the difference would be minimal. However, Kye must have included the function to disable it to save bandwidth for a reason. I guess with hundreds of players it could have a small effect, but probably still not much.


Re: EnablePlayerCameraTarget - Pottus - 06.05.2015

In a couple weeks you will be able to use ColAndreas to do this, it looks like to me that the function only checks against objects and not player objects obviously a system like this is going to require using the streamer. There are other options as well to check if you are looking at an object.

There is other decisions you need to make as well such has how you actually check for objects efficiently. What I would do is create a dynamic area for each object then use an iterator to store the areaids the player is in and the type of area in a variable. From there it is a matter of looping through your iterator to check if the player is looking at any one object(s).