CheckPlayerCamera

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: CheckPlayerCamera

Re: CheckPlayerCamera

by Graf Zahl » Wed Apr 16, 2008 10:19 am

It always returns the camera's tid if the passed parameter references a valid player and -1 for any kind of error.

Re: CheckPlayerCamera

by HotWax » Wed Apr 16, 2008 9:45 am

Graf Zahl wrote:I also changed it so that any error returns -1 so that 0 can be used for a player without tid not having a camera.
I'm having trouble wrapping my brain around that statement for some reason. Does the function now return -1 if the specified player isn't viewing through a camera? Or does it still return 0, and would return -1 if there was some other problem (like the player not being present, for example)?

AFAIK, there should never be a case where the camera a player is viewing through wouldn't have a TID, since the TID is needed to change the player's viewpoint. (Right?) So 0 could be reserved for "no camera."

Re: CheckPlayerCamera

by Graf Zahl » Tue Apr 15, 2008 3:03 pm

Done. I also changed it so that any error returns -1 so that 0 can be used for a player without tid not having a camera.

Re: CheckPlayerCamera

by HotWax » Tue Apr 15, 2008 1:40 pm

Very true. This means that, depending on usage, it might be required to assign TIDs to players that would be otherwise unnecessary. I recommend this be changed while it is still in SVN and thus doesn't need any compatibility taken into consideration.

Re: CheckPlayerCamera

by Blzut3 » Tue Apr 15, 2008 1:04 pm

Is there a particular reason why this uses the player's TID and not the player's number? I don't think there is something other than a player that we would want to use this on.

Re: CheckPlayerCamera

by Thomas » Tue Apr 15, 2008 3:46 am

Yeah I now realize that I forget that :? .

Anway, here is the ACC patch.
Attachments
CheckPlayerCameraACC.rar
(485 Bytes) Downloaded 28 times

Re: CheckPlayerCamera

by Graf Zahl » Tue Apr 15, 2008 2:10 am

Added. But there was a problem in the code: It didn't set a proper return value for non-players.

Re: CheckPlayerCamera

by Thomas » Tue Apr 15, 2008 1:53 am

I gave this a try yesterday. I attached a patch to my post.

Syntax is as follows:
CheckPlayerCamera(int tid)

Where tid is the players TID.
This will return the tag of the camera where the player watches through. And if not watching through the camera (so through it's own head) ir will return 0.

EDIT: I forget to make a patch of my ACC files and upload those. But since I do not have time for that right now, I'll do that later today.
Attachments
PlayerCamera.rar
(548 Bytes) Downloaded 24 times

Re: CheckPlayerCamera

by HotWax » Fri Apr 11, 2008 11:45 am

I agree this could be useful, but why in such a limited format? How about, instead of having to pass in both the player and camera TIDs, you just pass in the player TID and it returns the TID of the camera they're viewing?

CheckPlayerCamera

by Cutmanmike » Fri Apr 11, 2008 11:38 am

What an earth would that do!?

Checkplayercamera(tid, cameratid)

tid: Thing id of the player (might be better to use player numbers?). 0 = all/any players
cameratid: Thing id of the camera 0 = any camera

This would check if a player is viewing through a camera or not. Handy for things like, say freezing certain actors when the player is busy looking into a camera, or if the player is trying to cheat out of the camera by pressing coopspy.

Top