Raised This Month: $ Target: $400
 0% 

pev_button


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 06-09-2013 , 08:50   pev_button
Reply With Quote #1

PHP Code:
public client_PreThink(id)
{
    if(
is_user_connectedid ) && is_user_aliveid ))
    {
        if( 
pev(idpev_button) & IN_DUCK )
        {
            
client_print(idprint_chat"Duck")
            
        }
        else
        {
            
client_print(idprint_chat"Stand")
        }
    }

When I crouched, it worked well and print the "Duck" well. But when I didn't stand, the client_print flood. Did it use CPU process highly? Or is there any good method? I'm afraid it'll make the CS lag.
Randomize is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-09-2013 , 09:16   Re: pev_button
Reply With Quote #2

PHP Code:
public client_PreThink(id)
{
    if( 
is_user_aliveid ) )
    {
        new 
button entity_get_int(idEV_INT_button);
        new 
buttonsChanged button entity_get_int(idEV_INT_oldbuttons);

        if( 
buttonsChanged IN_DUCK )
        {
            if( 
button IN_DUCK )
            {
                
client_print(idprint_chat"Duck")
            }
            else
            {
                
client_print(idprint_chat"Stand")
            }
        }
    }

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 06-09-2013 at 09:17.
ConnorMcLeod is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 06-09-2013 , 09:37   Re: pev_button
Reply With Quote #3

Still flood chat.
Randomize is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-09-2013 , 09:41   Re: pev_button
Reply With Quote #4

No, make sure you have code after my edition.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 06-09-2013 , 10:35   Re: pev_button
Reply With Quote #5

Something like this?
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <acg>

#define PLUGIN "Crouch"
#define VERSION "1.0"
#define AUTHOR "DavidJr"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
// Add your code here...
}
public 
plugin_precache()
{    
    
precache_generic("gfx/csf/crouch.tga")
    
precache_generic("gfx/csf/stand.tga")
}
public 
client_PreThink(id)
{
    if( 
is_user_aliveid ) )
    {
        new 
button entity_get_int(idEV_INT_button);
        new 
buttonsChanged button entity_get_int(idEV_INT_oldbuttons);

        if( 
buttonsChanged IN_DUCK )
        {
            if( 
button IN_DUCK )
            {
                
//acg_drawtga(id, "gfx/csf/crouch.tga", 255, 255, 255, 50, 0.1375, 0.065, 0, FX_NONE, 0.0, 0.0, 0.0, 0.0, 0, ALIGN_RIGHT | ALIGN_BOTTOM, 2)
                
client_print(idprint_chat"Duck")
            }
            else
            {
                
//acg_drawtga(id, "gfx/csf/stand.tga", 255, 255, 255, 50,  0.1375, 0.065, 0, FX_NONE, 0.0, 0.0, 0.0, 0.0, 0, ALIGN_RIGHT |  ALIGN_BOTTOM, 2)
                
client_print(idprint_chat"Stand")
            }
        }
    }

and sorry, I typed 1 line code wrong from the first post.
PHP Code:
if( pev(idpev_button) & IN_DUCK )
        {
            
client_print(idprint_chat"Jongkok")
            
        }
        if( !(
pev(idpev_oldbuttons) & IN_DUCK) )
        {
            
client_print(idprint_chat"Berdiri")
        } 

Last edited by Randomize; 06-09-2013 at 10:36.
Randomize is offline
President
Member
Join Date: May 2013
Old 06-09-2013 , 11:59   Re: pev_button
Reply With Quote #6

PHP Code:
public client_PreThink(id)
{
        if(!
is_user_alive(id)) return;
        
        if(
pev(idpev_button) & IN_DUCK)
                if(
pev(idpev_flags) & FL_DUCKING)
                         
client_print(idprint_chat"Duck");
        else 
client_print(idprint_chat"Standing");

You don't have to check if the player is connected. He can't think (execute client_PreThink) when he isn't in the game.

Last edited by President; 06-09-2013 at 12:00.
President is offline
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 16:22.


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