Hello coders,
i have one big problem with hudtext in csgo, i made menu, and after somebody click on this menu, it will print something into hud, but it dont work and idk why no, here is code.
PHP Code:
#pragma semicolon 1
#define LoopClients(%1) for(int %1 = 1; %1 <= MaxClients; %1++)
#define DEBUG
#define PLUGIN_AUTHOR "Javierko"
#define PLUGIN_VERSION "1.0.1"
#include <sourcemod>
#include <sdktools>
#pragma newdecls required
Handle HudText;
public Plugin myinfo =
{
name = "Admin",
author = PLUGIN_AUTHOR,
description = "",
version = PLUGIN_VERSION,
url = ""
};
public void OnPluginStart()
{
RegConsoleCmd("sm_admind", Command_Adminp);
HudText = CreateHudSynchronizer();
}
public Action Command_Adminp(int client, int args)
{
Menu menu = new Menu(m_themenu);
menu.SetTitle("Admin menu");
if (IsPlayerAdmin(client))
{
menu.AddItem("item_1", "Test message");
menu.Display(client, MENU_TIME_FOREVER);
}
}
public int m_themenu(Menu menu, MenuAction action, int client, int index)
{
if(action == MenuAction_Select)
{
char szItem[12];
menu.GetItem(index, szItem, sizeof(szItem));
if(StrEqual(szItem, "item_1", false))
{
LoopClients(i)
{
SetHudTextParams(-1.0, -1.0, 10.0, 255, 255, 255, 255, 2, 0.0, 0.25, 0.25);
ShowSyncHudText(i, HudText, "This is testing message!");
}
}
}
else if(action == MenuAction_End)
{
delete menu;
}
}
stock bool IsPlayerAdmin(int client)
{
if(CheckCommandAccess(client, "", ADMFLAG_GENERIC))
{
return true;
}
return false;
}
Thanks if you help me.
__________________