Raised This Month: $ Target: $400
 0% 

Checking +jump


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
WaZZeR++
Veteran Member
Join Date: Mar 2005
Location: Sweden
Old 04-26-2006 , 04:23   Checking +jump
Reply With Quote #1

I want to "hook" the +jump command to check for bhop scripts...

But its not possible to do:
Code:
register_clcmd("+jump"....)

How should i do it?
WaZZeR++ is offline
Send a message via MSN to WaZZeR++
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-26-2006 , 04:25  
Reply With Quote #2

The only way is to use the Engine forward "client_PreThink" like so:
Code:
public client_PreThink(id) {   if(!is_user_alive(id))     return PLUGIN_CONTINUE;   if(get_user_button(id) & IN_JUMP)     // player is holding the jump button   else if(get_user_button(id) & IN_JUMP && !(get_user_oldbutton(id) & IN_JUMP))     // player just tapped the jump button   return PLUGIN_CONTINUE; }
__________________
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
WaZZeR++
Veteran Member
Join Date: Mar 2005
Location: Sweden
Old 04-26-2006 , 04:28  
Reply With Quote #3

So there is no way to read what commands that are sent from the client to the server?

But thx anyway, I'll try it out.
WaZZeR++ is offline
Send a message via MSN to WaZZeR++
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-26-2006 , 04:43  
Reply With Quote #4

Engine & Fakemeta versions:
Code:
#include <amxmodx> #include <engine> new button[33]; public client_PreThink(id) {   if(!is_user_alive(id))     return PLUGIN_CONTINUE;   button[id] = get_user_button(id);   if(button[id] & IN_JUMP)   {     // player is holding the jump button     return PLUGIN_CONTINUE;   }   if((button[id] & IN_JUMP) && !(get_user_oldbutton(id) & IN_JUMP))   {     // player just tapped the jump button     return PLUGIN_CONTINUE;   }   return PLUGIN_CONTINUE; }
Code:
#include <amxmodx> #include <fakemeta> #define IN_JUMP (1<<1) public plugin_init() {   register_plugin("test" , "0.1" , "v3x");   register_forward(FM_PlayerPreThink , "forward_playerprethink"); } new button[33]; public forward_playerprethink(id) {   if(!is_user_alive(id))     return FMRES_IGNORED;   button[id] = pev(id , pev_button);   if(button[id] & IN_JUMP)   {     // player is holding the jump button     return FMRES_IGNORED;   }   if((button[id] & IN_JUMP) && !(pev(id , pev_oldbuttons) & IN_JUMP))   {     // player just tapped the jump button     return FMRES_IGNORED;   }   return FMRES_IGNORED; }
__________________
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
kmal2t
BANNED
Join Date: Apr 2006
Old 04-26-2006 , 06:33  
Reply With Quote #5

This won't work for several reasons. You can use a bhop script without holding down jump. You can use it in a non-tapping, hold release, hold release fashion and not change anything. Or maybe I'd just bind +bhop to my mousewheel and scroll it if I'm super lazy? What about people that don't use a bhop script that happen to hold their jump key? Not to mention someone could just change their script from a +command to a toggle?

There are already anti-bhop scripts in TFC. They detect if you're using alias _special (the main command used in bhop scripts) and the server kicks you. Check some TFC forums for that.
kmal2t is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 04-26-2006 , 10:50  
Reply With Quote #6

well this works but it may take some cpu

Code:
new somestring[32] public plugin_init() {     new detectcmd[32]     format(detectcmd,31, "plop%d%d%d", random_num(0,99), random_num(0,99), random_num(0,99))     register_clcmd(detectcmd, "detected")     format(somestring,31, " alias _special %s",detectcmd) } public client_PreThink(id) {     if(!is_user_alive(id)) return PLUGIN_CONTINUE     new buttons = entity_get_int(id, EV_INT_button)     new oldbuttons = entity_get_int(id, EV_INT_oldbuttons)     if(buttons&IN_JUMP && !(oldbuttons&IN_JUMP))         client_cmd(id, "%s", somestring)     return PLUGIN_CONTINUE } public detected(id) {     new flags = entity_get_int(id, EV_INT_flags)     if(!(flags&FL_WATERJUMP) && !(flags&FL_ONGROUND) && entity_get_int(id, EV_INT_waterlevel) < 2) {         new name[32], steamid[34]         get_user_name(id, name,31)         get_user_authid(id, steamid,33)         client_print(0,print_chat, "[AMXX] Bhop-script detected on %s (%s)", name,steamid)         server_cmd("kick #%d", get_user_userid(id))     }     return PLUGIN_HANDLED }

so the alias _special is overwritten on every frame when they're pressing jump

EDIT: donnu why i have the flags being check in detected()
__________________
plop
p3tsin is offline
WaZZeR++
Veteran Member
Join Date: Mar 2005
Location: Sweden
Old 04-26-2006 , 18:19  
Reply With Quote #7

Quote:
Originally Posted by p3tsin
well this works but it may take some cpu

Code:
new somestring[32] public plugin_init() {     new detectcmd[32]     format(detectcmd,31, "plop%d%d%d", random_num(0,99), random_num(0,99), random_num(0,99))     register_clcmd(detectcmd, "detected")     format(somestring,31, " alias _special %s",detectcmd) } public client_PreThink(id) {     if(!is_user_alive(id)) return PLUGIN_CONTINUE     new buttons = entity_get_int(id, EV_INT_button)     new oldbuttons = entity_get_int(id, EV_INT_oldbuttons)     if(buttons&IN_JUMP && !(oldbuttons&IN_JUMP))         client_cmd(id, "%s", somestring)     return PLUGIN_CONTINUE } public detected(id) {     new flags = entity_get_int(id, EV_INT_flags)     if(!(flags&FL_WATERJUMP) && !(flags&FL_ONGROUND) && entity_get_int(id, EV_INT_waterlevel) < 2) {         new name[32], steamid[34]         get_user_name(id, name,31)         get_user_authid(id, steamid,33)         client_print(0,print_chat, "[AMXX] Bhop-script detected on %s (%s)", name,steamid)         server_cmd("kick #%d", get_user_userid(id))     }     return PLUGIN_HANDLED }

so the alias _special is overwritten on every frame when they're pressing jump

EDIT: donnu why i have the flags being check in detected()
Didnt knew it was possible to send alias command to the cilent, think valve removed it in cs in some of the latest update. But i try it out. Thx for the help.
WaZZeR++ is offline
Send a message via MSN to WaZZeR++
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 04-27-2006 , 08:58  
Reply With Quote #8

yeah they removed it
but it still works if u put a space before the word "alias"
Code:
format(somestring,31, " alias _special %s",detectcmd)
__________________
plop
p3tsin is offline
Reply



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 05:03.


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