View Single Post
Author Message
farawayf
Senior Member
Join Date: Jan 2019
Old 01-19-2019 , 11:40   How to activate func_button
Reply With Quote #1

Hello.

How i can activate func_button "target name" with command ? I find that code but it crash server when i type command
PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>

public OnPluginStart()
{
      
RegAdminCmd"sm_activatebutton"CmdbuttonADMFLAG_ROOT);
}

public 
Action:Cmdbuttonclientargs )
{
    
decl String:TargetName[128];
    new 
CurEnt FindEntityByClassname(-1"func_button");
    while (
CurEnt >= 0
    {
        
GetEntPropString(CurEntProp_Data"m_iName"TargetName128);
        if (
StrEqual(TargetName"button_name")) 
        {
            
LogMessage("%d : %s"CurEntTargetName);
            
ActivateEntity(CurEnt);
        }
        
CurEnt FindEntityByClassname(CurEnt"func_button");
    }


Last edited by farawayf; 01-19-2019 at 11:41.
farawayf is offline