AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Question on register_think. (https://forums.alliedmods.net/showthread.php?t=172480)

Excalibur.007 11-21-2011 03:24

Question on register_think.
 
I'm creating an entity(not a player) and checking if players are around the area and visible to it. But I'm confused with register_think and client_PreThink. Which of them are more suitable for the entity or both of them are different from each other.

mrhellish 11-21-2011 05:13

Re: Question on register_think.
 
client_PreThink -> for clients/players
register_think(... -> you choose the entity type

Excalibur.007 11-21-2011 05:42

Re: Question on register_think.
 
So, I assumed both of them works the same way just that client_PreThink is (mostly) used for players while register_think is used for entities we choose right?

Snaker beatter 11-21-2011 05:51

Re: Question on register_think.
 
Whats the difference of prethink and postthink?

Excalibur.007 11-21-2011 05:56

Re: Question on register_think.
 
Quote:

Originally Posted by Snaker beatter (Post 1600090)
Whats the difference of prethink and postthink?

Quote:

Originally Posted by Hawk552 (Post 221965)
PreThink is called every time before a client renders a frame with physics. This means that if the client's FPS is 50, it will be called 50 times a second, just before each frame is actually rendered. This gives you a fraction of a second to change whatever you need to, before the client actually renders the frame.

PostThink works the same way, except it's a fraction of a second after.

You got your answers :)

Snaker beatter 11-21-2011 05:59

Re: Question on register_think.
 
Quote:

Originally Posted by Excalibur.007 (Post 1600094)
You got your answers :)

Ok :up:

mrhellish 11-21-2011 14:57

Re: Question on register_think.
 
Pre - detect when happened
Post - detect after happend

then if you want to block some event, you can do it in Pre, not Post. in Post the event is already happened

Xellath 11-21-2011 15:09

Re: Question on register_think.
 
If you want to check whether a client is in range of your entity, hook think on the entity and repeatedly check for entities using find_ent_in_sphere.

nikhilgupta345 11-22-2011 16:48

Re: Question on register_think.
 
Quote:

Originally Posted by Excalibur.007 (Post 1600087)
So, I assumed both of them works the same way just that client_PreThink is (mostly) used for players while register_think is used for entities we choose right?

Not mostly, only. client_PreThink is only called for player entities.


All times are GMT -4. The time now is 08:31.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.