Raised This Month: $ Target: $400
 0% 

get_user_buttom


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
2reason2kill
Senior Member
Join Date: Feb 2011
Old 07-24-2011 , 14:04   get_user_buttom
Reply With Quote #1

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <cstrike>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
}
public 
test(id)
{
    if(
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T))
    {
        if(
get_user_button(id) & IN_ATTACK)
        {
            
make_visble(id)
        }
        else
        {
            
make_invisble(id)
        }
    }
}
public 
make_invisble(id)
{
    
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha0)
}
public 
make_visble(id)
{
    
set_user_rendering(idkRenderFxNone0,0,0kRenderNormal255)

Should I define It?

Im trying To do if a user isnt Movieng The Make Him Invisble But If a User Moves make him Visble.
2reason2kill is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-24-2011 , 14:28   Re: get_user_buttom
Reply With Quote #2

Define what? Do you only want if user moving via his own buttons to be visible or also visible if falling?
__________________
Bugsy is offline
fireattack
Senior Member
Join Date: Jul 2008
Old 07-24-2011 , 15:13   Re: get_user_buttom
Reply With Quote #3

Your code won't work, check this (ConnoMcLeod's Furien):

PHP Code:
public plugin_init( )
{
    new 
iEnt
    iEnt 
create_entity("info_target")
    
set_pev(iEntpev_classname"check_speed")
    
set_pev(iEntpev_nextthinkget_gametime() + 0.1)
    
register_think("check_speed""Set_Furiens_Visibility")
}
    
    
public 
Set_Furiens_VisibilityiEnt )
{
    
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 0.1)

    new 
iPlayers[MAX_PLAYERS], iNumidFloat:fVecVelocity[3], iSpeed

    get_players
(iPlayersiNum"ae"g_iFuriensTeam == CS_TEAM_T "TERRORIST" "CT")

    for(new 
ii<iNumi++)
    {
        
id iPlayers[i]
        if( 
get_user_weapon(id) == CSW_KNIFE )
        {
            
entity_get_vector(idEV_VEC_velocityfVecVelocity)
            
iSpeed floatroundvector_length(fVecVelocity) )
            if( 
iSpeed g_iInvisFactor*255 )
            {
                
set_user_rendering(idkRenderFxNone000kRenderTransAlphaiSpeed/g_iInvisFactor)
            }
            else
            {
                
set_user_rendering(idkRenderFxNone000kRenderNormal0)
            }
        }
        else
        {
            
set_user_rendering(idkRenderFxNone000kRenderNormal0)
        }
    }


Last edited by fireattack; 07-24-2011 at 15:15.
fireattack is offline
2reason2kill
Senior Member
Join Date: Feb 2011
Old 07-24-2011 , 15:23   Re: get_user_buttom
Reply With Quote #4

Quote:
Originally Posted by Bugsy View Post
Define what? Do you only want if user moving via his own buttons to be visible or also visible if falling?
1)Do i need to Define the Buttoms?


2)His own buttoms

And when Hes Not Moving He get invisble.
2reason2kill is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-24-2011 , 16:05   Re: get_user_buttom
Reply With Quote #5

This will only detect moving while user pressing buttons (no falling/surfing/pushed etc).

http://forums.alliedmods.net/showpos...62&postcount=9
__________________
Bugsy is offline
2reason2kill
Senior Member
Join Date: Feb 2011
Old 07-24-2011 , 16:14   Re: get_user_buttom
Reply With Quote #6

Do You think this Work?


PHP Code:
#include <amxmodx>
#include <fakemeta>

new const Version[] = "0.1";

const 
ButtonBits = ( IN_FORWARD IN_BACK IN_MOVELEFT IN_MOVERIGHT );

const 
Float:SlowestRun 210.0//vector_length(velocity) returns 210 when running with AWP

public plugin_init() 
{
    
register_plugin"Detect Moving" Version "bugsy" );
    
    
register_forwardFM_CmdStart "fw_FMCmdStart" );
}

public 
fw_FMCmdStartid handle seed )
{
    if ( 
get_uchandle UC_Buttons ) & ButtonBits )
    {
        static 
Float:fVelocity];

        
pevid pev_velocity fVelocity );
    
make_invisble(id)
    else
    {
        
make_visble(id)
    }
    }
}
public 
make_invisble(id)
{
    
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha0)
}
public 
make_visble(id)
{
    
set_user_rendering(idkRenderFxNone0,0,0kRenderNormal255)

2reason2kill is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-24-2011 , 16:39   Re: get_user_buttom
Reply With Quote #7

Try this. I added extra conditions so if a user is walking\running and collides with a wall to stop him from moving while still holding the move buttons he will become visible again. Remove the client_prints after you test it.

Edit: Fixed code so player visible when moving and invisible when not moving. It was originally done vice versa.
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fun>

new const Version[] = "0.2";

const 
ButtonBits = ( IN_FORWARD IN_BACK IN_MOVELEFT IN_MOVERIGHT );
new 
boolg_bVisible33 ];
new const 
Float:g_fSlowestWalk 108.0;

public 
plugin_init() 
{
    
register_plugin"Visible When Moving" Version "bugsy" );
    
    
register_forwardFM_CmdStart "fw_FMCmdStart" );
}

public 
fw_FMCmdStartid handle seed )
{
    if ( 
get_uchandle UC_Buttons ) & ButtonBits )
    {
        static 
Float:fVelocity];
        
pevid pev_velocity fVelocity );
        
        if ( 
vector_lengthfVelocity ) >= g_fSlowestWalk )
        {
            if ( !
g_bVisibleid ] )
                
make_visble(id)
        }
        else
        {
            if ( 
g_bVisibleid ] )
                
make_invisble(id)
        }
    }
    else
    {
        if ( 
g_bVisibleid ] )
            
make_invisble(id)
    }
}

public 
make_invisble(id)
{
    
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha0)
    
g_bVisibleid ] = false;
    
    
client_print(id,print_chat,"Player Invisible");
}

public 
make_visble(id)
{
    
set_user_rendering(idkRenderFxNone0,0,0kRenderNormal255)
    
g_bVisibleid ] = true;
    
    
client_print(id,print_chat,"Player Visible");

__________________

Last edited by Bugsy; 07-24-2011 at 20:33.
Bugsy is offline
2reason2kill
Senior Member
Join Date: Feb 2011
Old 07-24-2011 , 17:43   Re: get_user_buttom
Reply With Quote #8

Quote:
Originally Posted by Bugsy View Post
Try this. I added extra conditions so if a user is walking\running and collides with a wall to stop him from moving while still holding the move buttons he will become visible again. Remove the client_prints after you test it.

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fun>

new const Version[] = "0.1";

const 
ButtonBits = ( IN_FORWARD IN_BACK IN_MOVELEFT IN_MOVERIGHT );
new 
boolg_bIsInvisible33 ];
new const 
Float:g_fSlowestWalk 108.0;

public 
plugin_init() 
{
    
register_plugin"Detect Moving" Version "bugsy" );
    
    
register_forwardFM_CmdStart "fw_FMCmdStart" );
}

public 
fw_FMCmdStartid handle seed )
{
    if ( 
get_uchandle UC_Buttons ) & ButtonBits )
    {
        static 
Float:fVelocity];
        
pevid pev_velocity fVelocity );
        
        if ( 
vector_lengthfVelocity ) >= g_fSlowestWalk )
        {
            if ( !
g_bIsInvisibleid ] )
                
make_invisble(id)
        }
        else
        {
            if ( 
g_bIsInvisibleid ] )
                
make_visble(id)
        }
    }
    else
    {
        if ( 
g_bIsInvisibleid ] )
            
make_visble(id)
    }
}

public 
make_invisble(id)
{
    
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha0)
    
g_bIsInvisibleid ] = true;
    
client_print(id,print_chat,"visible=false");
}

public 
make_visble(id)
{
    
set_user_rendering(idkRenderFxNone0,0,0kRenderNormal255)
    
g_bIsInvisibleid ] = false;
    
client_print(id,print_chat,"visible=true");

It make Him Invisble When hes moving and visble when hes not xD
2reason2kill is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-24-2011 , 18:55   Re: get_user_buttom
Reply With Quote #9

Quote:
Originally Posted by 2reason2kill View Post
It make Him Invisble When hes moving and visble when hes not xD
Then change the invisible to visible and vice versa in fw_FMCmdStart().

Bugsy updated his code.
__________________

Last edited by fysiks; 07-24-2011 at 21:16.
fysiks is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 07-24-2011 , 16:28   Re: get_user_buttom
Reply With Quote #10

Test it.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu 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 01:08.


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