AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Button activation to the distance [Solved] (https://forums.alliedmods.net/showthread.php?t=271693)

niqo 09-17-2015 21:51

Button activation to the distance [Solved]
 
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)
    }



Vancold 09-18-2015 08:57

Re: Button activation to the distance
 
Try force_use

klippy 09-18-2015 13:06

Re: Button activation to the distance
 
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.


All times are GMT -4. The time now is 22:12.

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