Archive
› Old Forum Threads › Help › Scripting Help › detecting player condition (run,duck,prone,stand,camp)
7 posts,
3 people · 939 views
Thread Rating: ★★★★★
| closeddetecting player condition (run,duck,prone,stand,camp) |
| Started by ghzero on 10-09-2007, 03:02 AM |
started this thread
Posts: 160Threads: 42
Joined: Sep 2007
10-09-2007, 03:02 AM
#1
hello,rnrnI like to ask you how it is the best(simple) procedere for detecting the players condition ..if he stands, runs, ducks, prone(yes that can be requested with funktion).rnrnreason is: i'd like to check that due later kills for saving the player condition in that he does kills other as mostly.rnrnI think the information of the actual player-model-sequence can help out really simple?!rnrnrngreetz,rnghzero
posted here
Posts: 623Threads: 57
Joined: Oct 2005
10-09-2007, 04:24 AM
#2
rn#include <amxmodx>rn#include <fakemeta>rn#include <dodx>rnrnpublic plug_init() {rn register_forward( FM_PlayerPreThink, "hook_PreThink" );rn}rnrnpublic hook_PreThink( id ) {rn new button = pev( id, pev_button );rnrn if( button & IN_DUCK )rn {rn // Duckingrn }rn if( button & IN_FORWARD || button & IN_MOVELEFT || button & IN_MOVERIGHT || button & IN_BACK )rn {rn // Movingrn }rn if( dod_get_pronestate( id ) )rn {rn // Proningrn }rn}rnstarted this thread
Posts: 160Threads: 42
Joined: Sep 2007
10-09-2007, 11:45 AM
#3
I thank you very much!! :) rnrnis it possible to use:rnbutton & IN_SPEED to detect running by +speed-key ?!rnrnI try to uses that procedere and will give feedback if works well or adaptions done..
posted here
Posts: 2,068Threads: 103
Joined: May 2005
10-09-2007, 12:02 PM
#4
i think its IN_RUN
started this thread
Posts: 160Threads: 42
Joined: Sep 2007
10-09-2007, 12:05 PM
#5
i think its IN_RUNrnrnallright.. take a look at the changed code ..pls tell me if you notice an logic error/failture..rn
if( dod_get_pronestate( id )>0 )rn{rn // Proningrn}rnelse if( button & IN_DUCK )rn{rn // Duckingrn}rnelse if( button & IN_RUN )rn{rn // runningrn if( button & IN_FORWARD || button & IN_MOVELEFT || button & IN_MOVERIGHT || button & IN_BACK )rn {rn // Moving WITH speed (running)rn }rn elsern {rn //standstillrn }rn}rnelse if( button & IN_FORWARD || button & IN_MOVELEFT || button & IN_MOVERIGHT || button & IN_BACK )rn{rn // Movingrn}rnelsern{rn //standstillrn}rnposted here
Posts: 623Threads: 57
Joined: Oct 2005
10-10-2007, 06:16 AM
#6
You can changernrn
rnelse if( button & IN_RUN )rn{rn // runningrn if( button & IN_FORWARD || button & IN_MOVELEFT || button & IN_MOVERIGHT || button & IN_BACK )rn {rn // Moving WITH speed (running)rn }rn elsern {rn //standstillrn }rn}rnrnrnTornrnrnelse if( button & IN_RUN && (button & IN_FORWARD || button & IN_MOVELEFT || button & IN_MOVERIGHT || button & IN_BACK) )rn{rn // Moving WITH speed (running)rn}rnstarted this thread
Posts: 160Threads: 42
Joined: Sep 2007
10-10-2007, 07:23 PM
#7
hello,rnrnthanks, yes I changed .. some other things too to detecting safer and exacter..rnrn
public hook_PreThink( id )rn{rn if(!is_user_alive(id))rn return;rnrn new button = pev( id, pev_button );rn // Proningrn if( dod_get_pronestate( id )>0 )rn pl_condition[id]=4rn // Duckingrn else if( button & IN_DUCK )rn pl_condition[id]=3rn //movingrn else if( button & IN_FORWARD || button & IN_MOVELEFT || button & IN_MOVERIGHT || button & IN_BACK )rn {rn new Float:plyr_speed=get_speed_f(id);rn new flags = entity_get_int(id, EV_INT_flags)rn // Moving WITH speed (running)rn if( plyr_speed>220.0 && (flags & FL_ONGROUND) )//an unit amount over walk-speed (bis 219.99999)rn pl_condition[id]=2rn // Moving/Walkrn else if( plyr_speed>3.0 )rn pl_condition[id]=1rn //walking against obstacle in map (e.g. window/sky/wall/noclip-entity)rn elsern pl_condition[id]=0rn }rn //standstillrn elsern pl_condition[id]=0rnrn rn //if(ghr_debug==1)rn // client_print(id,print_chat,"player-condition(id:%d) is #%d (speed:%f) (camp:%d/%d) (scope:%d) (drug:%d)", id, pl_condition[id], get_speed_f(id), pl_camp[id], pl_campmeter[id], pl_scope[id], pl_drug[id] );rn}rn
Archive
› Old Forum Threads › Help › Scripting Help › detecting player condition (run,duck,prone,stand,camp)

