Quote:
Originally Posted by Ilusion9
You haven't used my code because it doesn't even compile.
It's easy to talk that your server crashes because you are still using your code.
Use this:
PHP Code:
#pragma semicolon 1
#include <sourcemod> #include <sdktools>
public void OnPluginStart() { RegAdminCmd("sm_activatebutton", Command_ActivateButton, ADMFLAG_ROOT, "sm_activatebutton <name>"); }
public Action Command_ActivateButton(int client, int args) { if (args < 1) { ReplyToCommand(client, "[SM] Usage: sm_activatebutton <name>"); return Plugin_Handled; } char arg[65]; GetCmdArg(1, arg, sizeof(arg));
int entity = -1; while ((entity = FindEntityByClassname(entity, "func_button")) != -1) { char name[65]; GetEntPropString(entity, Prop_Data, "m_iName", name, sizeof(name)); if (StrEqual(arg, name)) { AcceptEntityInput(entity, "Press"); return Plugin_Handled; } }
return Plugin_Handled; }
|
Thanks you. Everything works fine.
Sorry to appeal to you again, but it’s not working the way I would like. I would like to do this: the administrator writes the command “sm_activatebutton 1 (or 2, 3, etc.)” And, for example, 1 - button_open, 2 - button_close, 3 - button_slay etc.
Not to write every time the name of the buttons like "sm_activatebutton button_open"