Hello can you explain me how i can make the plugin to work with custom flag and popup message
For example, players with custom flag T to have acces to the plugin, but players without the flag to not have and when say /admins or !admins to popup message (You dont have acces to the command)
Sorry for writting on english language but i am from Bulgaria and i dont speak russian.
For example, players with custom flag T to have acces to the plugin, but players without the flag to not have and when say /admins or !admins to popup message (You dont have acces to the command)
C-подобный:
#include <sourcemod>
#pragma semicolon 1
new Handle:AdminListEnabled = INVALID_HANDLE;
new Handle:AdminListMode = INVALID_HANDLE;
new Handle:AdminListMenu = INVALID_HANDLE;
new Handle:AdminListAdminFlag = INVALID_HANDLE;
#define PLUGIN_VERSION "1.4b"
public Plugin:myinfo =
{
name = "Admin List",
author = "Fredd",
description = "prints admins to clients",
version = PLUGIN_VERSION,
url = "www.sourcemod.net"
}
public OnPluginStart()
{
CreateConVar("adminlist_version", "1.4b", "Admin List Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
AdminListEnabled = CreateConVar("adminlist_on", "1", "turns on and off admin list, 1=on ,0=off", FCVAR_PLUGIN);
AdminListMode = CreateConVar("adminlist_mode", "2", "mode that changes how the list appears. 1-Chat, 2-Panel", FCVAR_PLUGIN);
AdminListAdminFlag = CreateConVar("adminlist_adminflag", "b", "admin flag to use for list. must be in char format", FCVAR_PLUGIN);
RegConsoleCmd("sm_admins", Command_Admins, "Displays Admins to players");
RegConsoleCmd("sm_root", Command_Admins, "Displays Admins to players");
LoadTranslations("adminlist.phrases");
AutoExecConfig(true, "adminlist");
}
public Action:Command_Admins(client, args)
{
if (GetConVarBool(AdminListEnabled))
{
new bool:noadm= true;
switch(GetConVarInt(AdminListMode))
{
case 1:
{
decl String:AdminNames[MAXPLAYERS+1][MAX_NAME_LENGTH+1];
new count = 0;
for (new i = 1; i<=MaxClients; i++)
{
if(IsClientConnected(i) && IsClientInGame(i) && IsAdmin(i))
{
noadm = false;
GetClientName(i, AdminNames[count], sizeof(AdminNames[]));
count++;
}
}
if (noadm)
{
PrintToChat(client, "\x04[SM] \x01%t", "NoAdmins");
return Plugin_Handled;
}
decl String:buffer[1024];
ImplodeStrings(AdminNames, count, "\x01,\x03 ", buffer, sizeof(buffer));
PrintToChat(client, "\x04[SM] \x01%t \x03%s", "OnlineChat", buffer);
}
case 2:
{
decl String:AdminName[MAX_NAME_LENGTH], String:admlist[128], String:noadms[128];
AdminListMenu = CreateMenu(MenuListHandler);
Format(admlist, sizeof(admlist), "%T", "OnlinePanel", client);
SetMenuTitle(AdminListMenu, admlist);
for(new i = 1; i <= MaxClients; i++)
{
if(IsClientConnected(i) && IsClientInGame(i) && IsAdmin(i))
{
noadm = false;
GetClientName(i, AdminName, sizeof(AdminName));
AddMenuItem(AdminListMenu, AdminName, AdminName);
}
}
if (noadm)
{
Format(noadms, sizeof(noadms), "%T", "NoAdmins", client);
AddMenuItem(AdminListMenu, noadms, noadms);
}
SetMenuExitButton(AdminListMenu, true);
DisplayMenu(AdminListMenu, client, 15);
}
}
}
return Plugin_Handled;
}
public MenuListHandler(Handle:menu, MenuAction:action, param1, param2)
{
if (action == MenuAction_End)
CloseHandle(menu);
}
stock bool:IsAdmin(client)
{
decl String:flags[64];
GetConVarString(AdminListAdminFlag, flags, sizeof(flags));
new ibFlags = ReadFlagString(flags);
if ((GetUserFlagBits(client) & ibFlags) == ibFlags)
return true;
if (GetUserFlagBits(client) & ADMFLAG_ROOT)
return true;
return false;
}
Sorry for writting on english language but i am from Bulgaria and i dont speak russian.