Raised This Month: $ Target: $400
 0% 

[PROBLEM SOLVED]Problem catching pre pre think +commands


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SubStream
Veteran Member
Join Date: Aug 2005
Location: USA
Old 04-01-2006 , 18:45   [PROBLEM SOLVED]Problem catching pre pre think +commands
Reply With Quote #1

here is what I have so far
Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fakemeta> new const gs_PLUGIN[]   = "test" new const gs_VERSION[]  = "1.0" new const gs_AUTHOR[]   = "SubStream" new gi_players[32] new gi_playercnt new gi_playernum new gi_playerID public plugin_init () {     register_plugin ( gs_PLUGIN, gs_VERSION, gs_AUTHOR )     register_forward ( FM_PlayerPreThink, "fn_hookprethink" ) } public fn_hookprethink ( id ) {     if ( get_user_button ( id ) & IN_ATTACK )     {         entity_set_int ( id, EV_INT_button, get_user_button ( id ) & ~IN_ATTACK )                 fn_saymessage ()                 return FMRES_SUPERCEDE     }         else     {         return FMRES_IGNORED     } } public fn_saymessage () {     get_players ( gi_players, gi_playercnt, "ch" )         for ( gi_playernum = 0; gi_playernum < gi_playercnt; gi_playernum++ )     {         gi_playerID = gi_players[gi_playernum]                 client_print ( gi_playerID, print_center, "hello its working" )                 return PLUGIN_HANDLED     }         return PLUGIN_HANDLED }

I am testing to see if I can block +attack... I have read other forums threads in here about this but haven't got it working yet ... I have looked up as much as I can and according to other topics posted this is supposed to work but its not. Can someone tell me what I am doing wrong I appreciate any help to actually get this working. My goal is to block +attack.

The message shows up when I press the attack button, but I am still allowed to fire.

I already looked at Restricting buttons if you need to reference to where I got my information.

Edit:

Ven solved the problem. Thank you Ven I appreciate it.
SubStream is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-01-2006 , 18:51  
Reply With Quote #2

Well first of all change:
Code:
else {   return PLUGIN_CONTINUE }
to
Code:
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
SubStream
Veteran Member
Join Date: Aug 2005
Location: USA
Old 04-01-2006 , 19:01  
Reply With Quote #3

ok now what? lol
SubStream is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 04-01-2006 , 20:56  
Reply With Quote #4

u can do that? what is it?
Code:
get_user_button ( id ) & -IN_ATTACK
[ --<-@ ] Black Rose is offline
SubStream
Veteran Member
Join Date: Aug 2005
Location: USA
Old 04-01-2006 , 21:04  
Reply With Quote #5

Quote:
Originally Posted by [ --<-@
Black Rose]u can do that? what is it?
Code:
get_user_button ( id ) & -IN_ATTACK
In another thread it said to make sure to block -IN_ATTACK also... so I tried that too... even with only IN_ATTACK it doesn't work... but I think that -IN_ATTACK isn't even recognized at all. I was just trying something that someone else posted... but I guess that it's nothing.

Edit:

Check first post I updated the code. I tried doing what was said on another post and it simply does not work. Can someone finalize if it is in fact possible to block +attack and all the other commands or is it simply not possible.
SubStream is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 04-03-2006 , 14:33  
Reply With Quote #6

First of all - a common mistake is recognizing whether button blocked or not by player's animation/decals/etc. All that done on the client's side while on the server side only actual button state is altered. Your code will block "the bullets" but not the animation etc.
Also it's not a good idea to block player's entity from thinking neither it's necessary (at least in this case).
VEN 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 16:47.


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