Raised This Month: $ Target: $400
 0% 

Button activation to the distance [Solved]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
niqo
Senior Member
Join Date: Feb 2010
Location: Argentina
Old 09-17-2015 , 21:51   Button activation to the distance [Solved]
Reply With Quote #1

As it says the title. This does not me work.


PHP Code:
public fw_CmdStartiduc_handlerandseed )
{
    if (!
is_user_alive(id))
        return 
FMRES_IGNORED

    
new button get_ucuc_handle UC_Buttons );
    new 
oldbutton pev(idpev_oldbuttons)

    if( 
button IN_USE && !(oldbutton IN_USE)) {
        
        
activate_button(id)
    }

    return 
FMRES_IGNORED;
}

public 
activate_button(id)
{
    new 
entbodypart
    get_user_aiming 
(id,ent,bodypart)
    
    new 
szClass[10], szTarget[7];
    
entity_get_string(entEV_SZ_classnameszClass9);
    
entity_get_string(entEV_SZ_targetnameszTarget6);
    
    if (
equal(szClass"func_button") || equal(szTarget"trap3")) {
        
        
dllfunc(DLLFunc_Use, -10)
    }

__________________
niqo is offline
Vancold
Member
Join Date: Jan 2015
Old 09-18-2015 , 08:57   Re: Button activation to the distance
Reply With Quote #2

Try force_use
Vancold is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 09-18-2015 , 13:06   Re: Button activation to the distance
Reply With Quote #3

Well, your szClass[] array can hold up to 9 characters, and "func_button" is 11 (excluding null) characters long. szClass[] will never be equal to "func_button". Therefore, make your szClass[] array 12 elements big, instead of 10.

Last edited by klippy; 09-18-2015 at 13:07.
klippy is offline
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 00:08.


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