Raised This Month: $ Target: $400
 0% 

blocking jump and duck in prethink


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ng1200
Member
Join Date: May 2005
Old 02-26-2006 , 07:37   blocking jump and duck in prethink
Reply With Quote #1

hi,
this is my prethink code:
Code:
public client_PreThink(id)     {     if(incar[id] != 0)         {         new bufferstop = entity_get_int(id,EV_INT_button)                 if(bufferstop != 0) {             entity_set_int(id,EV_INT_button,bufferstop & ~IN_ATTACK & ~IN_ATTACK2 & ~IN_ALT1 & ~IN_USE)         }                 if((bufferstop & IN_JUMP) && (entity_get_int(id,EV_INT_flags) & ~FL_ONGROUND & ~FL_DUCKING)) {             entity_set_int(id,EV_INT_button,entity_get_int(id,EV_INT_button) & ~IN_JUMP)         }             }     return PLUGIN_CONTINUE }
now, how do i block jump and duck?
ng1200 is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-26-2006 , 12:45  
Reply With Quote #2

Looks like you answered your own question.

If that doesn't solve it, try setting the entity's button to IN_CANCEL, like this:

Code:
entity_set_int(id,EV_INT_button,IN_CANCEL)
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
ng1200
Member
Join Date: May 2005
Old 02-27-2006 , 03:08  
Reply With Quote #3

thanks!
but i tryed that:
Code:
public client_PreThink(id)     {     if(incar[id] != 0)         {         new bufferstop = entity_get_int(id,EV_INT_button)                 if(bufferstop != 0) {             entity_set_int(id,EV_INT_button,bufferstop & ~IN_ATTACK & ~IN_ATTACK2 & ~IN_ALT1 & ~IN_USE)         }         if(bufferstop & IN_DUCK)         {             entity_set_int(id,EV_INT_button,IN_CANCEL)         }         if(bufferstop & IN_JUMP)         {             entity_set_int(id,EV_INT_button,IN_CANCEL)         }         if((bufferstop & IN_JUMP) && (entity_get_int(id,EV_INT_flags) & ~FL_ONGROUND & ~FL_DUCKING)) {             entity_set_int(id,EV_INT_button,entity_get_int(id,EV_INT_button) & ~IN_JUMP)         }                 return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE }
and it didnt work
ng1200 is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 02-27-2006 , 03:51  
Reply With Quote #4

The best antijump way for me is set player gravity to something high.
It's better than prethink velocity method.
Compare and you'll see what i'm talking about.
But be careful such gravity could kill player on non-plain surface (stairs, etc).
So you can use any method. It's depen on the purpose.

About jump block. I do not think there are a good way.
You can send "-duck" command to the client but it wouldn't affect instantly.
VEN is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-27-2006 , 09:36  
Reply With Quote #5

Although I've never tried it before, you could also try setting their z velocity (cell 2 I believe) to the negative abs of itself.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 02-27-2006 , 14:44  
Reply With Quote #6

Make sure that the incar variable is getting set to something other than 0 for that player's index.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Charr
Senior Member
Join Date: Jul 2005
Location: Long Island, New York, U
Old 02-27-2006 , 15:49  
Reply With Quote #7

You would probably want something like this:
Code:
public client_PreThink(id) {     new buttons = entity_get_int(id,EV_INT_button);     if(incar[id])     {         entity_set_int(id,EV_INT_button,buttons & ~IN_JUMP & ~IN_DUCK & ~IN_MOVELEFT & ~IN_MOVERIGHT & ~IN_USE & ~IN_ATTACK & ~IN_ATTACK2);     } }

That will block jump, duck, use, attack, attack2, strafe left, and strafe right when someone is in a car.
__________________
Charr is offline
Send a message via AIM to Charr Send a message via MSN to Charr
ng1200
Member
Join Date: May 2005
Old 02-28-2006 , 04:01  
Reply With Quote #8

didnt work charr,
and the other jump code blocked me from wall-jumping too, ur code doesnt
ng1200 is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-28-2006 , 09:24  
Reply With Quote #9

Try this, I have no time nor do I have a compiler, online one is slow (announcements are on, I'm at school)

Code:
public client_PreThink(id) {     if(entity_get_int(id,EV_INT_button) & IN_JUMP))     {         new Float:vVelocity[3]         entity_get_vector(id,EV_VEC_velocity,vVelocity)         vVelocity[2] = float(-abs(round(vVelocity[2])))         entity_set_vector(id,EV_VEC_velocity,vVelocity)         entity_set_int(id,EV_INT_button,entity_get_int(id,EV_INT_button) & ~IN_JUMP)     } }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
ng1200
Member
Join Date: May 2005
Old 03-01-2006 , 07:17  
Reply With Quote #10

thanks hawk,
but what include is needed for round()?
im using amxmisc,amxmodx,engine and fun
ng1200 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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