Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- public OnPluginStart()
- {
- RegConsoleCmd("sm_button", CMD_Button);
- HookEntityOutput("func_button", "OnPressed", OnPushed);
- CreateTimer(0.1, Timer, _, TIMER_REPEAT);
- }
- public OnPushed(char[] output, int caller, int activator, float delay)
- {
- if (activator > MaxClients && activator <= 0)
- return;
- char sName[64], curMap[64];
- GetCurrentMap(curMap, sizeof(curMap));
- if (StrEqual(curMap, "jb_clouds_beta01"))
- {
- GetEntPropString(caller, Prop_Data, "m_iName", sName, sizeof(sName));
- PrintToChatAll("Correct button (%i - %s - %s)", caller, sName, output);
- }
- }
- public Action Timer(Handle timer)
- {
- for(new i = 1; i <= MaxClients; i++)
- {
- if(IsClientInGame(i) && IsClientAuthorized(i) && IsPlayerAlive(i))
- {
- int target = GetClientAimTarget(i, false);
- char clsname[64], sName[64];
- GetEntityClassname(target, clsname, sizeof(clsname));
- GetEntPropString(target, Prop_Data, "m_iName", sName, sizeof(sName));
- PrintHintText(i, "%i %s - %s", target, clsname, sName);
- }
- }
- }
- public Action CMD_Button(int client, int args)
- {
- char curMap[64];
- GetCurrentMap(curMap, sizeof(curMap));
- if (!StrEqual(curMap, "jb_clouds_beta01"))
- return Plugin_Handled;
- int iEnt = -1;
- char sName[64];
- while((iEnt = FindEntityByClassname(iEnt, "func_button")) > 0)
- {
- GetEntPropString(iEnt, Prop_Data, "m_iName", sName, sizeof(sName));
- if (StrEqual(sName, "secret_master_button_final"))
- {
- AcceptEntityInput(iEnt, "Press");
- }
- }
- return Plugin_Handled;
- }
Advertisement
Add Comment
Please, Sign In to add comment