AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Post and pre forward . (https://forums.alliedmods.net/showthread.php?t=162299)

gamer99 07-17-2011 09:06

Post and pre forward .
 
Hi ,

I have to fucntions which are being called in postthink . (FM_PlayerPostThink).

Now the logic is simple and they can be moved to prethink too.

So my question is
1)will it be better if i move them to prethink ?
2)will it be better if i move one of them to prethink ?

Just asking for my knowledge :) .

bibu 07-17-2011 09:20

Re: Post and pre forward .
 
Show us what you have in your functions.

gamer99 07-17-2011 09:58

Re: Post and pre forward .
 
1st one :

public CheckSpinHack_Post(id)
{
if(is_user_alive(id))
{
static Float:fAngles[3]
pev(id, pev_angles, fAngles)

fTotalAngle[id] += vector_distance(fLastAngles[id], fAngles)

CopyVector(fAngles, fLastAngles[id])

static Button
Button = pev(id, pev_button)

if((Button & IN_LEFT) || (Button & IN_RIGHT))
{
g_dSpinWarnings[id] = 0
//server_cmd("say pressing left/right")
}

}
}

Another one I can't post :( as it uses some slowhacking . But its a very simple developer 0 function :) .

bibu 07-17-2011 10:34

Re: Post and pre forward .
 
Use "prethink".

Bugsy 07-17-2011 10:56

Re: Post and pre forward .
 
See here

I don't think it matters which you use (pre or post) since you are not changing anything, you are only using it as a monitoring mechanism. If you plan to alter anything, then prethink must be used.

Here's just a slight improvement to button checking
PHP Code:

const IN_BUTTONS = ( IN_LEFT IN_RIGHT );

if( 
pevid pev_button ) & IN_BUTTONS )
{
    
g_dSpinWarnings[id] = 0
    
//server_cmd("say pressing left/right")



gamer99 07-17-2011 11:29

Re: Post and pre forward .
 
hey the plugin is working fine ..

I just want to know whether

1)will it be better if i move them to prethink ?
2)will it be better if i move one of them to prethink ?


just wrt to CPU load and lag :) .

Quote:

Here's just a slight improvement to button checking
Thanks bugsy :)

fysiks 07-17-2011 14:27

Re: Post and pre forward .
 
Quote:

Originally Posted by Bugsy (Post 1512491)
I don't think it matters which you use (pre or post) since you are not changing anything


bibu 07-17-2011 15:27

Re: Post and pre forward .
 
Still doing something in pre forward is better I think. Correct me when I am wrong.

fysiks 07-17-2011 17:14

Re: Post and pre forward .
 
Quote:

Originally Posted by bibu (Post 1512629)
Still doing something in pre forward is better I think. Correct me when I am wrong.

It depends on what you are doing but if you aren't going to be changing anything then it shouldn't really matter.


All times are GMT -4. The time now is 00:49.

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