Raised This Month: $ Target: $400
 0% 

clcmd, and keypress.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 07-13-2007 , 16:34   Re: clcmd, and keypress.
Reply With Quote #1

Quote:
Originally Posted by Rolnaaba View Post
fakemeta way:
Code:
#include <amxmodx> #include <fakemeta> //... register_forward(FM_PlayerPreThink, "fwdPlayerPreThink"); //... public fwdPlayerPreThink(ent) {     if(pev(id, pev_button) & IN_ATTACK) {         client_print(id, print_chat, "YOUR ATTACKING!!")     } }
You used...
public fwdPlayerPreThink(ent)

Should it not be...
public fwdPlayerPreThink(id)

Since you used id in the function ;D?
hlstriker is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 07-13-2007 , 16:23   Re: clcmd, and keypress.
Reply With Quote #2

try FM_PlayerPostThink, and if that dont work, i guess maybe PostThink and pev_oldbutton or something cant remember....
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 07-13-2007 , 17:16   Re: clcmd, and keypress.
Reply With Quote #3

bah! I am a retard, but with that error it shouldnt have compiled....maybe he changed it before compiling and trying it.
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
draft
Senior Member
Join Date: Jul 2007
Location: Russia, Saint-Petersburg
Old 07-15-2007 , 04:39   Re: clcmd, and keypress.
Reply With Quote #4

Thanks to all, that works correct. +Karma everyone. Results:
One knife shot - 5 times of "Your Shooting"
One pistol shot - about 12 times
But I have another problem. Can u help what returns func "get_user_aiming" when checked player aims to another one? In help is said that it returns distance but i need to return hitbox (head, neck, and so on) at which player aims on another player. Can u help plz?)
draft is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 07-16-2007 , 01:19   Re: clcmd, and keypress.
Reply With Quote #5

@Rolnaaba

I like to do it like this:

PHP Code:
register_clcmd("+command""cmd_whatever")
register_clcmd("-command""cmd_whatever")

public 
cmd_whatever(id)
{
    new 
cmd[2]
    
read_argv(0cmd1)
    
    switch(
cmd[0])
    {
        case 
'+':
        {
            
//pressed
        
}
        case 
'-':
        {
            
//released
        
}
    }

stupok is offline
draft
Senior Member
Join Date: Jul 2007
Location: Russia, Saint-Petersburg
Old 07-16-2007 , 06:03   Re: clcmd, and keypress.
Reply With Quote #6

Quote:
Originally Posted by stupok69 View Post
@Rolnaaba

I like to do it like this:

PHP Code:
register_clcmd("+command""cmd_whatever")
register_clcmd("-command""cmd_whatever")
 
public 
cmd_whatever(id)
{
    new 
cmd[2]
    
read_argv(0cmd1)
 
    switch(
cmd[0])
    {
        case 
'+':
        {
            
//pressed
        
}
        case 
'-':
        {
            
//released
        
}
    }

Does it work with cmd = attack ? I've tried and no result.

Last edited by draft; 07-16-2007 at 06:50.
draft is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-16-2007 , 06:11   Re: clcmd, and keypress.
Reply With Quote #7

No! You must use Rolnaaba way! With button constants ;)
http://forums.alliedmods.net/showpos...50&postcount=8

But anyway!

Code:
public fwdPlayerPreThink(id)
{
 static button
 button = pev(id,pev_button)
 
 if(button & IN_ATTACK)
 {
  client_print(id, print_chat, "YOUR ATTACKING!!")
 }
}
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 07-16-2007 at 06:14.
Alka is offline
Old 07-16-2007, 11:37
Rolnaaba
This message has been deleted by Rolnaaba. Reason: repeat
Rolnaaba
Veteran Member
Join Date: May 2006
Old 07-16-2007 , 11:46   Re: clcmd, and keypress.
Reply With Quote #9

*barf* engine! besides he is catching +attack, which is different than use...
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
DotNetJunkie
Senior Member
Join Date: May 2005
Location: In front of my pc
Old 07-17-2007 , 05:28   Re: clcmd, and keypress.
Reply With Quote #10

Quote:
Originally Posted by Rolnaaba View Post
*barf* engine! besides he is catching +attack, which is different than use...
Code:
new g_AttackKey[33][2];

...

public client_PreThink(id)
{

new buffer = entity_get_int(id, EV_INT_button);

for( new i = 0; i < 2; i++ )
{
if( (buffer & ( i ? IN_ATTACK2 : IN_ATTACK)) && !g_AttackKey[id][i] )
{
	g_AttackKey[id][i] = 1;
	if( i ) { client_AttackSecondaryDown(id); } else { client_AttackPrimaryDown(id); }
}
if( !(buffer & ( i ? IN_ATTACK2 : IN_ATTACK )) && g_AttackKey[id][i] )
{
	g_AttackKey[id][i] = 0;
	if( i ) { client_AttackSecondaryUp(id); } else { client_AttackPrimaryUp(id); }
}
}

return PLUGIN_CONTINUE;

}

...

public client_AttackKeyPrimaryDown(id)
{
client_print(id, print_chat, "You pressed your primary attack key down!");
return 1;
}
public client_AttackKeySecondaryDown(id)
{
client_print(id, print_chat, "You pressed your secondary attack key down!");
return 1;
}

public client_AttackKeyPrimaryUp(id)
{
client_print(id, print_chat, "You let go of your primary attack key!");
return 1;
}
public client_AttackKeySecondaryUp(id)
{
client_print(id, print_chat, "You let go of your secondary attack key!");
return 1;
}
Besides, what is wrong with engine? It's so useful for so many things!
__________________
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