Raised This Month: $ Target: $400
 0% 

Handling +use


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alien
Senior Member
Join Date: Aug 2005
Location: London || Slovakia
Old 09-01-2005 , 17:31   Handling +use
Reply With Quote #1

Hi,

does some1 know, how 2 handle USE key for each player? Is there an event for this??

Thnx
alien is offline
Send a message via ICQ to alien
Batman/Gorlag
Senior Member
Join Date: Aug 2005
Old 09-01-2005 , 18:07  
Reply With Quote #2

There's a function in the engine include and its called force_use(pPlayer, pEntity) where pEntity could be a hostage, or another player.
__________________
GRR If only the amxmod programming were in Java.....
Java and C used to be two different languages, now Java is turning into another C. My logevent plugin
Batman/Gorlag is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 09-01-2005 , 18:09  
Reply With Quote #3

alien what exactly do you mean handle it? like stop it?
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Batman/Gorlag
Senior Member
Join Date: Aug 2005
Old 09-01-2005 , 18:14  
Reply With Quote #4

Oh, is he talking about blocking an event, I don't know I just thought he asked how to make a use command and all.
__________________
GRR If only the amxmod programming were in Java.....
Java and C used to be two different languages, now Java is turning into another C. My logevent plugin
Batman/Gorlag is offline
alien
Senior Member
Join Date: Aug 2005
Location: London || Slovakia
Old 09-01-2005 , 21:10  
Reply With Quote #5

I mean, hook a function to that event. If there is any. Sorry for mismatch explanation
alien is offline
Send a message via ICQ to alien
atambo
Senior Member
Join Date: Oct 2004
Location: Pittsburgh, PA
Old 09-01-2005 , 21:19  
Reply With Quote #6

public client_PreThink(id)
{
new buttons = get_user_button(id)
if(buttons & IN_USE)...
}
__________________
atambo is offline
Send a message via AIM to atambo Send a message via MSN to atambo Send a message via Yahoo to atambo
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 09-01-2005 , 21:49  
Reply With Quote #7

To disable it:
Code:
public client_PreThink(id) {     if(get_user_button(id)&IN_USE)     {         entity_set_int(id,EV_INT_button,entity_get_int(id,EV_INT_button)&~IN_USE)     } }
Or something..

Hooking it normally:
Code:
public client_PreThink(id) {     if(get_user_button(id)&IN_USE)     {         // ...     } }
__________________
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
alien
Senior Member
Join Date: Aug 2005
Location: London || Slovakia
Old 09-02-2005 , 07:00  
Reply With Quote #8



I tried. It executes client_PreThink hundred times a second. Thats what I don't want.

Watch this:

Code:
set_task(CHECK_USE_PERIOD, "repeat_check_use", 8138459, "", 0, "b")

It makes repeat_check_use( ) function called every CHECK_USE_PERIOD second. repeat_check_use( ) checks if player's pressing a button. That's what I'm trying to avoid ... because it's useless to check each player repeately whether he is trying to press E on his keyboard, if so, whether he is standing near the button. client_PreThink( ) does the same.

I still believe, there is possibility to invoke an event when player presses USE key, but I have found none in meta game list.

Can you help me?
alien is offline
Send a message via ICQ to alien
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 09-02-2005 , 07:27  
Reply With Quote #9

Oh, okay.. Then do this:
Code:
public client_PreThink(id) {     if((get_user_button(id) & IN_USE) && !(get_user_oldbutton(id) & IN_USE))     {         // blah ..     } }
__________________
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
alien
Senior Member
Join Date: Aug 2005
Location: London || Slovakia
Old 09-02-2005 , 08:00  
Reply With Quote #10


Im sorry, my English sucks ...

I'll ask simple: how to write something into print_chat when some1 presses USE key?

alien is offline
Send a message via ICQ to alien
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 14:29.


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