Raised This Month: $ Target: $400
 0% 

clcmd, and keypress.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rolnaaba
Veteran Member
Join Date: May 2006
Old 07-12-2007 , 21:01   Re: clcmd, and keypress.
Reply With Quote #1

the engine automatically detects the +/- and acts accordingly?
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Deviance
Veteran Member
Join Date: Nov 2004
Location: Sweden
Old 07-12-2007 , 21:06   Re: clcmd, and keypress.
Reply With Quote #2

Quote:
Originally Posted by Rolnaaba View Post
the engine automatically detects the +/- and acts accordingly?
Yes.
Deviance is offline
draft
Senior Member
Join Date: Jul 2007
Location: Russia, Saint-Petersburg
Old 07-13-2007 , 12:14   Re: clcmd, and keypress.
Reply With Quote #3

Quote:
register_clcmd("+attack", "check_first_shot")
register_clcmd("status", "check_first_shot")
register_clcmd("-attack", "stop_check")


public check_first_shot(player)
{
client_print(0, print_chat, "Test")
}
I've made simple code but when i make a shot or write in console status there is no message "Test".
draft is offline
toazron1
Senior Member
Join Date: Oct 2006
Old 07-13-2007 , 12:44   Re: clcmd, and keypress.
Reply With Quote #4

You can not catch duck walk or attack using that type of register, you need to do something like this


This is off the top of my head but you get the idea... (not at my house right now)
Code:
 
public client_prethink(id) {
        if (get_user_buttons(id) & IN_ATTACK) {
             server_print("ATTACKED")
        }
}
__________________

Last edited by toazron1; 07-13-2007 at 12:46. Reason: tab + enter = post
toazron1 is offline
Send a message via AIM to toazron1
draft
Senior Member
Join Date: Jul 2007
Location: Russia, Saint-Petersburg
Old 07-13-2007 , 13:25   Re: clcmd, and keypress.
Reply With Quote #5

Quote:
Originally Posted by toazron1 View Post
Code:
 
public client_prethink(id) {
        if (get_user_buttons(id) & IN_ATTACK) {
             server_print("ATTACKED")
        }
}
Thanks, i got it but can u explain two things in your code?
1) What is client prethink? Is it something that is always executing instead of setting task of function? I've found only one explanation that it is "Forward" and nothing else.
2) IN_ATTACK - what is that?
Sorry, if i'm too silly
draft is offline
DotNetJunkie
Senior Member
Join Date: May 2005
Location: In front of my pc
Old 07-16-2007 , 08:13   Re: clcmd, and keypress.
Reply With Quote #6

Quote:
Originally Posted by toazron1 View Post
You can not catch duck walk or attack using that type of register, you need to do something like this


This is off the top of my head but you get the idea... (not at my house right now)
Code:
 
public client_prethink(id) {
        if (get_user_buttons(id) & IN_ATTACK) {
             server_print("ATTACKED")
        }
}

Code:
new g_UseKey[33];

...

new buffer = entity_get_int(id, EV_INT_button);
if( (buffer & IN_USE) && !g_UseKey[id] )
{
	g_UseKey[id] = 1;
	client_print(id, print_chat, "You pressed onto your use key!");
}
if( !(buffer & IN_USE) && g_UseKey[id] )
{
	g_UseKey[id] = 0;
	client_print(id, print_chat, "You let go of your use key!");
}
__________________
DotNetJunkie is offline
Send a message via ICQ to DotNetJunkie Send a message via AIM to DotNetJunkie Send a message via MSN to DotNetJunkie Send a message via Yahoo to DotNetJunkie
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 21:29.


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