Update base plugins for transitional syntax (#507)
This commit is contained in:
parent
e8734ccf28
commit
d9fb0ba64e
@ -149,7 +149,7 @@ void DisplayBanReasonMenu(int client)
|
||||
menu.Display(client, MENU_TIME_FOREVER);
|
||||
}
|
||||
|
||||
public void AdminMenu_Ban(Handle topmenu,
|
||||
public void AdminMenu_Ban(TopMenu topmenu,
|
||||
TopMenuAction action,
|
||||
TopMenuObject object_id,
|
||||
int param,
|
||||
@ -263,7 +263,6 @@ public int MenuHandler_BanTimeList(Menu menu, MenuAction action, int param1, int
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Action Command_Ban(int client, int args)
|
||||
{
|
||||
if (args < 2)
|
||||
|
@ -35,7 +35,9 @@
|
||||
|
||||
#include <sourcemod>
|
||||
|
||||
public Plugin:myinfo =
|
||||
#pragma newdecls required
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "Basic Chat",
|
||||
author = "AlliedModders LLC",
|
||||
@ -46,14 +48,14 @@ public Plugin:myinfo =
|
||||
|
||||
#define CHAT_SYMBOL '@'
|
||||
|
||||
new String:g_ColorNames[13][10] = {"White", "Red", "Green", "Blue", "Yellow", "Purple", "Cyan", "Orange", "Pink", "Olive", "Lime", "Violet", "Lightblue"};
|
||||
new g_Colors[13][3] = {{255,255,255},{255,0,0},{0,255,0},{0,0,255},{255,255,0},{255,0,255},{0,255,255},{255,128,0},{255,0,128},{128,255,0},{0,255,128},{128,0,255},{0,128,255}};
|
||||
char g_ColorNames[13][10] = {"White", "Red", "Green", "Blue", "Yellow", "Purple", "Cyan", "Orange", "Pink", "Olive", "Lime", "Violet", "Lightblue"};
|
||||
int g_Colors[13][3] = {{255,255,255},{255,0,0},{0,255,0},{0,0,255},{255,255,0},{255,0,255},{0,255,255},{255,128,0},{255,0,128},{128,255,0},{0,255,128},{128,0,255},{0,128,255}};
|
||||
|
||||
ConVar g_Cvar_Chatmode;
|
||||
|
||||
new EngineVersion:g_GameEngine = Engine_Unknown;
|
||||
EngineVersion g_GameEngine = Engine_Unknown;
|
||||
|
||||
public OnPluginStart()
|
||||
public void OnPluginStart()
|
||||
{
|
||||
LoadTranslations("common.phrases");
|
||||
|
||||
@ -76,9 +78,9 @@ public OnPluginStart()
|
||||
RegAdminCmd("sm_msay", Command_SmMsay, ADMFLAG_CHAT, "sm_msay <message> - sends message as a menu panel");
|
||||
}
|
||||
|
||||
public Action:OnClientSayCommand(client, const String:command[], const String:sArgs[])
|
||||
public Action OnClientSayCommand(int client, const char[] command, const char[] sArgs)
|
||||
{
|
||||
new startidx;
|
||||
int startidx;
|
||||
if (sArgs[startidx] != CHAT_SYMBOL)
|
||||
return Plugin_Continue;
|
||||
|
||||
@ -108,10 +110,10 @@ public Action:OnClientSayCommand(client, const String:command[], const String:sA
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
decl String:arg[64];
|
||||
char arg[64];
|
||||
|
||||
new len = BreakString(sArgs[startidx], arg, sizeof(arg));
|
||||
new target = FindTarget(client, arg, true, false);
|
||||
int len = BreakString(sArgs[startidx], arg, sizeof(arg));
|
||||
int target = FindTarget(client, arg, true, false);
|
||||
|
||||
if (target == -1 || len == -1)
|
||||
return Plugin_Stop;
|
||||
@ -150,7 +152,7 @@ public Action:OnClientSayCommand(client, const String:command[], const String:sA
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public Action:Command_SmSay(client, args)
|
||||
public Action Command_SmSay(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -158,7 +160,7 @@ public Action:Command_SmSay(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:text[192];
|
||||
char text[192];
|
||||
GetCmdArgString(text, sizeof(text));
|
||||
|
||||
SendChatToAll(client, text);
|
||||
@ -167,7 +169,7 @@ public Action:Command_SmSay(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_SmCsay(client, args)
|
||||
public Action Command_SmCsay(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -175,7 +177,7 @@ public Action:Command_SmCsay(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:text[192];
|
||||
char text[192];
|
||||
GetCmdArgString(text, sizeof(text));
|
||||
|
||||
DisplayCenterTextToAll(client, text);
|
||||
@ -185,7 +187,7 @@ public Action:Command_SmCsay(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_SmHsay(client, args)
|
||||
public Action Command_SmHsay(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -193,12 +195,12 @@ public Action:Command_SmHsay(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:text[192];
|
||||
char text[192];
|
||||
GetCmdArgString(text, sizeof(text));
|
||||
|
||||
decl String:nameBuf[MAX_NAME_LENGTH];
|
||||
char nameBuf[MAX_NAME_LENGTH];
|
||||
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (!IsClientInGame(i) || IsFakeClient(i))
|
||||
{
|
||||
@ -213,7 +215,7 @@ public Action:Command_SmHsay(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_SmTsay(client, args)
|
||||
public Action Command_SmTsay(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -221,13 +223,13 @@ public Action:Command_SmTsay(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:text[192], String:colorStr[16];
|
||||
char text[192], colorStr[16];
|
||||
GetCmdArgString(text, sizeof(text));
|
||||
|
||||
new len = BreakString(text, colorStr, 16);
|
||||
int len = BreakString(text, colorStr, 16);
|
||||
|
||||
new color = FindColor(colorStr);
|
||||
new String:nameBuf[MAX_NAME_LENGTH];
|
||||
int color = FindColor(colorStr);
|
||||
char nameBuf[MAX_NAME_LENGTH];
|
||||
|
||||
if (color == -1)
|
||||
{
|
||||
@ -235,7 +237,7 @@ public Action:Command_SmTsay(client, args)
|
||||
len = 0;
|
||||
}
|
||||
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (!IsClientInGame(i) || IsFakeClient(i))
|
||||
{
|
||||
@ -250,7 +252,7 @@ public Action:Command_SmTsay(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_SmChat(client, args)
|
||||
public Action Command_SmChat(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -258,7 +260,7 @@ public Action:Command_SmChat(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:text[192];
|
||||
char text[192];
|
||||
GetCmdArgString(text, sizeof(text));
|
||||
|
||||
SendChatToAdmins(client, text);
|
||||
@ -267,7 +269,7 @@ public Action:Command_SmChat(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_SmPsay(client, args)
|
||||
public Action Command_SmPsay(int client, int args)
|
||||
{
|
||||
if (args < 2)
|
||||
{
|
||||
@ -275,13 +277,13 @@ public Action:Command_SmPsay(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:text[192], String:arg[64], String:message[192];
|
||||
char text[192], arg[64], message[192];
|
||||
GetCmdArgString(text, sizeof(text));
|
||||
|
||||
new len = BreakString(text, arg, sizeof(arg));
|
||||
int len = BreakString(text, arg, sizeof(arg));
|
||||
BreakString(text[len], message, sizeof(message));
|
||||
|
||||
new target = FindTarget(client, arg, true, false);
|
||||
int target = FindTarget(client, arg, true, false);
|
||||
|
||||
if (target == -1)
|
||||
return Plugin_Handled;
|
||||
@ -291,7 +293,7 @@ public Action:Command_SmPsay(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_SmMsay(client, args)
|
||||
public Action Command_SmMsay(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -299,7 +301,7 @@ public Action:Command_SmMsay(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:text[192];
|
||||
char text[192];
|
||||
GetCmdArgString(text, sizeof(text));
|
||||
|
||||
SendPanelToAll(client, text);
|
||||
@ -309,9 +311,9 @@ public Action:Command_SmMsay(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
FindColor(String:color[])
|
||||
int FindColor(const char[] color)
|
||||
{
|
||||
for (new i = 0; i < 13; i++)
|
||||
for (int i = 0; i < sizeof(g_ColorNames); i++)
|
||||
{
|
||||
if (strcmp(color, g_ColorNames[i], false) == 0)
|
||||
return i;
|
||||
@ -320,11 +322,11 @@ FindColor(String:color[])
|
||||
return -1;
|
||||
}
|
||||
|
||||
SendChatToAll(client, const String:message[])
|
||||
void SendChatToAll(int client, const char[] message)
|
||||
{
|
||||
new String:nameBuf[MAX_NAME_LENGTH];
|
||||
char nameBuf[MAX_NAME_LENGTH];
|
||||
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (!IsClientInGame(i) || IsFakeClient(i))
|
||||
{
|
||||
@ -336,11 +338,11 @@ SendChatToAll(client, const String:message[])
|
||||
}
|
||||
}
|
||||
|
||||
DisplayCenterTextToAll(client, const String:message[])
|
||||
void DisplayCenterTextToAll(int client, const char[] message)
|
||||
{
|
||||
new String:nameBuf[MAX_NAME_LENGTH];
|
||||
char nameBuf[MAX_NAME_LENGTH];
|
||||
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (!IsClientInGame(i) || IsFakeClient(i))
|
||||
{
|
||||
@ -351,10 +353,10 @@ DisplayCenterTextToAll(client, const String:message[])
|
||||
}
|
||||
}
|
||||
|
||||
SendChatToAdmins(from, const String:message[])
|
||||
void SendChatToAdmins(int from, const char[] message)
|
||||
{
|
||||
new fromAdmin = CheckCommandAccess(from, "sm_chat", ADMFLAG_CHAT);
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
int fromAdmin = CheckCommandAccess(from, "sm_chat", ADMFLAG_CHAT);
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (IsClientInGame(i) && (from == i || CheckCommandAccess(i, "sm_chat", ADMFLAG_CHAT)))
|
||||
{
|
||||
@ -363,9 +365,9 @@ SendChatToAdmins(from, const String:message[])
|
||||
}
|
||||
}
|
||||
|
||||
SendDialogToOne(client, color, const String:text[], any:...)
|
||||
void SendDialogToOne(int client, int color, const char[] text, any ...)
|
||||
{
|
||||
new String:message[100];
|
||||
char message[100];
|
||||
VFormat(message, sizeof(message), text, 4);
|
||||
|
||||
KeyValues kv = new KeyValues("Stuff", "title", message);
|
||||
@ -378,7 +380,7 @@ SendDialogToOne(client, color, const String:text[], any:...)
|
||||
delete kv;
|
||||
}
|
||||
|
||||
SendPrivateChat(client, target, const String:message[])
|
||||
void SendPrivateChat(int client, int target, const char[] message)
|
||||
{
|
||||
if (!client)
|
||||
{
|
||||
@ -400,27 +402,27 @@ void SendPanelToAll(int from, char[] message)
|
||||
|
||||
ReplaceString(message, 192, "\\n", "\n");
|
||||
|
||||
Panel mSayPanel = CreatePanel();
|
||||
Panel mSayPanel = new Panel();
|
||||
mSayPanel.SetTitle(title);
|
||||
DrawPanelItem(mSayPanel, "", ITEMDRAW_SPACER);
|
||||
DrawPanelText(mSayPanel, message);
|
||||
DrawPanelItem(mSayPanel, "", ITEMDRAW_SPACER);
|
||||
mSayPanel.DrawItem("", ITEMDRAW_SPACER);
|
||||
mSayPanel.DrawText(message);
|
||||
mSayPanel.DrawItem("", ITEMDRAW_SPACER);
|
||||
|
||||
SetPanelCurrentKey(mSayPanel, 10);
|
||||
DrawPanelItem(mSayPanel, "Exit", ITEMDRAW_CONTROL);
|
||||
mSayPanel.CurrentKey = 10;
|
||||
mSayPanel.DrawItem("Exit", ITEMDRAW_CONTROL);
|
||||
|
||||
for(new i = 1; i <= MaxClients; i++)
|
||||
for(int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if(IsClientInGame(i) && !IsFakeClient(i))
|
||||
{
|
||||
SendPanelToClient(mSayPanel, i, Handler_DoNothing, 10);
|
||||
mSayPanel.Send(i, Handler_DoNothing, 10);
|
||||
}
|
||||
}
|
||||
|
||||
delete mSayPanel;
|
||||
}
|
||||
|
||||
public Handler_DoNothing(Menu menu, MenuAction action, int param1, int param2)
|
||||
public int Handler_DoNothing(Menu menu, MenuAction action, int param1, int param2)
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
|
@ -37,8 +37,9 @@
|
||||
#include <adminmenu>
|
||||
|
||||
#pragma semicolon 1
|
||||
#pragma newdecls required
|
||||
|
||||
public Plugin:myinfo =
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "Basic Comm Control",
|
||||
author = "AlliedModders LLC",
|
||||
@ -47,22 +48,22 @@ public Plugin:myinfo =
|
||||
url = "http://www.sourcemod.net/"
|
||||
};
|
||||
|
||||
new bool:g_Muted[MAXPLAYERS+1]; // Is the player muted?
|
||||
new bool:g_Gagged[MAXPLAYERS+1]; // Is the player gagged?
|
||||
bool g_Muted[MAXPLAYERS+1]; // Is the player muted?
|
||||
bool g_Gagged[MAXPLAYERS+1]; // Is the player gagged?
|
||||
|
||||
ConVar g_Cvar_Deadtalk; // Holds the handle for sm_deadtalk
|
||||
ConVar g_Cvar_Alltalk; // Holds the handle for sv_alltalk
|
||||
new bool:g_Hooked = false; // Tracks if we've hooked events for deadtalk
|
||||
bool g_Hooked = false; // Tracks if we've hooked events for deadtalk
|
||||
|
||||
TopMenu hTopMenu;
|
||||
|
||||
new g_GagTarget[MAXPLAYERS+1];
|
||||
int g_GagTarget[MAXPLAYERS+1];
|
||||
|
||||
#include "basecomm/gag.sp"
|
||||
#include "basecomm/natives.sp"
|
||||
#include "basecomm/forwards.sp"
|
||||
|
||||
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
|
||||
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
|
||||
{
|
||||
CreateNative("BaseComm_IsClientGagged", Native_IsClientGagged);
|
||||
CreateNative("BaseComm_IsClientMuted", Native_IsClientMuted);
|
||||
@ -73,7 +74,7 @@ public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
|
||||
return APLRes_Success;
|
||||
}
|
||||
|
||||
public OnPluginStart()
|
||||
public void OnPluginStart()
|
||||
{
|
||||
LoadTranslations("common.phrases");
|
||||
LoadTranslations("basecomm.phrases");
|
||||
@ -100,7 +101,7 @@ public OnPluginStart()
|
||||
}
|
||||
}
|
||||
|
||||
public OnAdminMenuReady(Handle aTopMenu)
|
||||
public void OnAdminMenuReady(Handle aTopMenu)
|
||||
{
|
||||
TopMenu topmenu = TopMenu.FromHandle(aTopMenu);
|
||||
|
||||
@ -122,7 +123,7 @@ public OnAdminMenuReady(Handle aTopMenu)
|
||||
}
|
||||
}
|
||||
|
||||
public ConVarChange_Deadtalk(Handle:convar, const String:oldValue[], const String:newValue[])
|
||||
public void ConVarChange_Deadtalk(ConVar convar, const char[] oldValue, const char[] newValue)
|
||||
{
|
||||
if (g_Cvar_Deadtalk.IntValue)
|
||||
{
|
||||
@ -138,8 +139,7 @@ public ConVarChange_Deadtalk(Handle:convar, const String:oldValue[], const Strin
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool:OnClientConnect(client, String:rejectmsg[], maxlen)
|
||||
public bool OnClientConnect(int client, char[] rejectmsg, int maxlen)
|
||||
{
|
||||
g_Gagged[client] = false;
|
||||
g_Muted[client] = false;
|
||||
@ -147,7 +147,7 @@ public bool:OnClientConnect(client, String:rejectmsg[], maxlen)
|
||||
return true;
|
||||
}
|
||||
|
||||
public Action:OnClientSayCommand(client, const String:command[], const String:sArgs[])
|
||||
public Action OnClientSayCommand(int client, const char[] command, const char[] sArgs)
|
||||
{
|
||||
if (client && g_Gagged[client])
|
||||
{
|
||||
@ -190,9 +190,9 @@ public void ConVarChange_Alltalk(ConVar convar, const char[] oldValue, const cha
|
||||
}
|
||||
}
|
||||
|
||||
public Event_PlayerSpawn(Event event, const String:name[], bool:dontBroadcast)
|
||||
public void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
new client = GetClientOfUserId(event.GetInt("userid"));
|
||||
int client = GetClientOfUserId(event.GetInt("userid"));
|
||||
|
||||
if (!client)
|
||||
{
|
||||
@ -209,7 +209,7 @@ public Event_PlayerSpawn(Event event, const String:name[], bool:dontBroadcast)
|
||||
}
|
||||
}
|
||||
|
||||
public Event_PlayerDeath(Event event, const String:name[], bool:dontBroadcast)
|
||||
public void Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
int client = GetClientOfUserId(event.GetInt("userid"));
|
||||
|
||||
|
@ -31,9 +31,9 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
FireOnClientMute(client, bool:muteState)
|
||||
{
|
||||
static Handle:hForward;
|
||||
void FireOnClientMute(int client, bool muteState)
|
||||
{
|
||||
static Handle hForward;
|
||||
|
||||
if(hForward == null)
|
||||
{
|
||||
@ -44,11 +44,11 @@
|
||||
Call_PushCell(client);
|
||||
Call_PushCell(muteState);
|
||||
Call_Finish();
|
||||
}
|
||||
}
|
||||
|
||||
FireOnClientGag(client, bool:gagState)
|
||||
{
|
||||
static Handle:hForward;
|
||||
void FireOnClientGag(int client, bool gagState)
|
||||
{
|
||||
static Handle hForward;
|
||||
|
||||
if(hForward == null)
|
||||
{
|
||||
@ -59,4 +59,4 @@
|
||||
Call_PushCell(client);
|
||||
Call_PushCell(gagState);
|
||||
Call_Finish();
|
||||
}
|
||||
}
|
||||
|
@ -41,16 +41,16 @@ enum CommType
|
||||
CommType_UnSilence
|
||||
};
|
||||
|
||||
DisplayGagTypesMenu(client)
|
||||
void DisplayGagTypesMenu(int client)
|
||||
{
|
||||
Menu menu = CreateMenu(MenuHandler_GagTypes);
|
||||
Menu menu = new Menu(MenuHandler_GagTypes);
|
||||
|
||||
decl String:title[100];
|
||||
char title[100];
|
||||
Format(title, sizeof(title), "%T: %N", "Choose Type", client, g_GagTarget[client]);
|
||||
menu.SetTitle(title);
|
||||
menu.ExitBackButton = true;
|
||||
|
||||
new target = g_GagTarget[client];
|
||||
int target = g_GagTarget[client];
|
||||
|
||||
if (!g_Muted[target])
|
||||
{
|
||||
@ -91,7 +91,7 @@ void AddTranslatedMenuItem(Menu menu, const char[] opt, const char[] phrase, int
|
||||
|
||||
void DisplayGagPlayerMenu(int client)
|
||||
{
|
||||
Menu menu = CreateMenu(MenuHandler_GagPlayer);
|
||||
Menu menu = new Menu(MenuHandler_GagPlayer);
|
||||
|
||||
char title[100];
|
||||
Format(title, sizeof(title), "%T:", "Gag/Mute player", client);
|
||||
@ -103,12 +103,12 @@ void DisplayGagPlayerMenu(int client)
|
||||
menu.Display(client, MENU_TIME_FOREVER);
|
||||
}
|
||||
|
||||
public AdminMenu_Gag(Handle:topmenu,
|
||||
TopMenuAction:action,
|
||||
TopMenuObject:object_id,
|
||||
param,
|
||||
String:buffer[],
|
||||
maxlength)
|
||||
public void AdminMenu_Gag(TopMenu topmenu,
|
||||
TopMenuAction action,
|
||||
TopMenuObject object_id,
|
||||
int param,
|
||||
char[] buffer,
|
||||
int maxlength)
|
||||
{
|
||||
if (action == TopMenuAction_DisplayOption)
|
||||
{
|
||||
@ -120,7 +120,7 @@ public AdminMenu_Gag(Handle:topmenu,
|
||||
}
|
||||
}
|
||||
|
||||
public MenuHandler_GagPlayer(Menu menu, MenuAction action, int param1, int param2)
|
||||
public int MenuHandler_GagPlayer(Menu menu, MenuAction action, int param1, int param2)
|
||||
{
|
||||
if (action == MenuAction_End)
|
||||
{
|
||||
@ -135,8 +135,8 @@ public MenuHandler_GagPlayer(Menu menu, MenuAction action, int param1, int param
|
||||
}
|
||||
else if (action == MenuAction_Select)
|
||||
{
|
||||
decl String:info[32];
|
||||
new userid, target;
|
||||
char info[32];
|
||||
int userid, target;
|
||||
|
||||
menu.GetItem(param2, info, sizeof(info));
|
||||
userid = StringToInt(info);
|
||||
@ -157,7 +157,7 @@ public MenuHandler_GagPlayer(Menu menu, MenuAction action, int param1, int param
|
||||
}
|
||||
}
|
||||
|
||||
public MenuHandler_GagTypes(Menu menu, MenuAction action, int param1, int param2)
|
||||
public int MenuHandler_GagTypes(Menu menu, MenuAction action, int param1, int param2)
|
||||
{
|
||||
if (action == MenuAction_End)
|
||||
{
|
||||
@ -172,13 +172,13 @@ public MenuHandler_GagTypes(Menu menu, MenuAction action, int param1, int param2
|
||||
}
|
||||
else if (action == MenuAction_Select)
|
||||
{
|
||||
decl String:info[32];
|
||||
new CommType:type;
|
||||
char info[32];
|
||||
CommType type;
|
||||
|
||||
menu.GetItem(param2, info, sizeof(info));
|
||||
type = CommType:StringToInt(info);
|
||||
type = view_as<CommType>(StringToInt(info));
|
||||
|
||||
decl String:name[MAX_NAME_LENGTH];
|
||||
char name[MAX_NAME_LENGTH];
|
||||
GetClientName(g_GagTarget[param1], name, sizeof(name));
|
||||
|
||||
switch (type)
|
||||
@ -217,7 +217,7 @@ public MenuHandler_GagTypes(Menu menu, MenuAction action, int param1, int param2
|
||||
}
|
||||
}
|
||||
|
||||
PerformMute(client, target, bool:silent=false)
|
||||
void PerformMute(int client, int target, bool silent=false)
|
||||
{
|
||||
g_Muted[target] = true;
|
||||
SetClientListeningFlags(target, VOICE_MUTED);
|
||||
@ -230,7 +230,7 @@ PerformMute(client, target, bool:silent=false)
|
||||
}
|
||||
}
|
||||
|
||||
PerformUnMute(client, target, bool:silent=false)
|
||||
void PerformUnMute(int client, int target, bool silent=false)
|
||||
{
|
||||
g_Muted[target] = false;
|
||||
if (g_Cvar_Deadtalk.IntValue == 1 && !IsPlayerAlive(target))
|
||||
@ -254,7 +254,7 @@ PerformUnMute(client, target, bool:silent=false)
|
||||
}
|
||||
}
|
||||
|
||||
PerformGag(client, target, bool:silent=false)
|
||||
void PerformGag(int client, int target, bool silent=false)
|
||||
{
|
||||
g_Gagged[target] = true;
|
||||
FireOnClientGag(target, true);
|
||||
@ -265,7 +265,7 @@ PerformGag(client, target, bool:silent=false)
|
||||
}
|
||||
}
|
||||
|
||||
PerformUnGag(client, target, bool:silent=false)
|
||||
void PerformUnGag(int client, int target, bool silent=false)
|
||||
{
|
||||
g_Gagged[target] = false;
|
||||
FireOnClientGag(target, false);
|
||||
@ -276,7 +276,7 @@ PerformUnGag(client, target, bool:silent=false)
|
||||
}
|
||||
}
|
||||
|
||||
PerformSilence(client, target)
|
||||
void PerformSilence(int client, int target)
|
||||
{
|
||||
if (!g_Gagged[target])
|
||||
{
|
||||
@ -294,7 +294,7 @@ PerformSilence(client, target)
|
||||
LogAction(client, target, "\"%L\" silenced \"%L\"", client, target);
|
||||
}
|
||||
|
||||
PerformUnSilence(client, target)
|
||||
void PerformUnSilence(int client, int target)
|
||||
{
|
||||
if (g_Gagged[target])
|
||||
{
|
||||
@ -324,7 +324,7 @@ PerformUnSilence(client, target)
|
||||
LogAction(client, target, "\"%L\" unsilenced \"%L\"", client, target);
|
||||
}
|
||||
|
||||
public Action:Command_Mute(client, args)
|
||||
public Action Command_Mute(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -332,11 +332,12 @@ public Action:Command_Mute(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:arg[64];
|
||||
char arg[64];
|
||||
GetCmdArg(1, arg, sizeof(arg));
|
||||
|
||||
decl String:target_name[MAX_TARGET_LENGTH];
|
||||
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
|
||||
char target_name[MAX_TARGET_LENGTH];
|
||||
int target_list[MAXPLAYERS], target_count;
|
||||
bool tn_is_ml;
|
||||
|
||||
if ((target_count = ProcessTargetString(
|
||||
arg,
|
||||
@ -352,9 +353,9 @@ public Action:Command_Mute(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
for (new i = 0; i < target_count; i++)
|
||||
for (int i = 0; i < target_count; i++)
|
||||
{
|
||||
new target = target_list[i];
|
||||
int target = target_list[i];
|
||||
|
||||
PerformMute(client, target);
|
||||
}
|
||||
@ -371,7 +372,7 @@ public Action:Command_Mute(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_Gag(client, args)
|
||||
public Action Command_Gag(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -379,11 +380,12 @@ public Action:Command_Gag(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:arg[64];
|
||||
char arg[64];
|
||||
GetCmdArg(1, arg, sizeof(arg));
|
||||
|
||||
decl String:target_name[MAX_TARGET_LENGTH];
|
||||
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
|
||||
char target_name[MAX_TARGET_LENGTH];
|
||||
int target_list[MAXPLAYERS], target_count;
|
||||
bool tn_is_ml;
|
||||
|
||||
if ((target_count = ProcessTargetString(
|
||||
arg,
|
||||
@ -399,9 +401,9 @@ public Action:Command_Gag(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
for (new i = 0; i < target_count; i++)
|
||||
for (int i = 0; i < target_count; i++)
|
||||
{
|
||||
new target = target_list[i];
|
||||
int target = target_list[i];
|
||||
|
||||
PerformGag(client, target);
|
||||
}
|
||||
@ -418,7 +420,7 @@ public Action:Command_Gag(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_Silence(client, args)
|
||||
public Action Command_Silence(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -426,11 +428,12 @@ public Action:Command_Silence(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:arg[64];
|
||||
char arg[64];
|
||||
GetCmdArg(1, arg, sizeof(arg));
|
||||
|
||||
decl String:target_name[MAX_TARGET_LENGTH];
|
||||
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
|
||||
char target_name[MAX_TARGET_LENGTH];
|
||||
int target_list[MAXPLAYERS], target_count;
|
||||
bool tn_is_ml;
|
||||
|
||||
if ((target_count = ProcessTargetString(
|
||||
arg,
|
||||
@ -446,9 +449,9 @@ public Action:Command_Silence(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
for (new i = 0; i < target_count; i++)
|
||||
for (int i = 0; i < target_count; i++)
|
||||
{
|
||||
new target = target_list[i];
|
||||
int target = target_list[i];
|
||||
|
||||
PerformSilence(client, target);
|
||||
}
|
||||
@ -465,7 +468,7 @@ public Action:Command_Silence(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_Unmute(client, args)
|
||||
public Action Command_Unmute(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -473,11 +476,12 @@ public Action:Command_Unmute(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:arg[64];
|
||||
char arg[64];
|
||||
GetCmdArg(1, arg, sizeof(arg));
|
||||
|
||||
decl String:target_name[MAX_TARGET_LENGTH];
|
||||
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
|
||||
char target_name[MAX_TARGET_LENGTH];
|
||||
int target_list[MAXPLAYERS], target_count;
|
||||
bool tn_is_ml;
|
||||
|
||||
if ((target_count = ProcessTargetString(
|
||||
arg,
|
||||
@ -493,9 +497,9 @@ public Action:Command_Unmute(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
for (new i = 0; i < target_count; i++)
|
||||
for (int i = 0; i < target_count; i++)
|
||||
{
|
||||
new target = target_list[i];
|
||||
int target = target_list[i];
|
||||
|
||||
if (!g_Muted[target])
|
||||
{
|
||||
@ -517,7 +521,7 @@ public Action:Command_Unmute(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_Ungag(client, args)
|
||||
public Action Command_Ungag(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -525,11 +529,12 @@ public Action:Command_Ungag(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:arg[64];
|
||||
char arg[64];
|
||||
GetCmdArg(1, arg, sizeof(arg));
|
||||
|
||||
decl String:target_name[MAX_TARGET_LENGTH];
|
||||
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
|
||||
char target_name[MAX_TARGET_LENGTH];
|
||||
int target_list[MAXPLAYERS], target_count;
|
||||
bool tn_is_ml;
|
||||
|
||||
if ((target_count = ProcessTargetString(
|
||||
arg,
|
||||
@ -545,9 +550,9 @@ public Action:Command_Ungag(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
for (new i = 0; i < target_count; i++)
|
||||
for (int i = 0; i < target_count; i++)
|
||||
{
|
||||
new target = target_list[i];
|
||||
int target = target_list[i];
|
||||
|
||||
PerformUnGag(client, target);
|
||||
}
|
||||
@ -564,7 +569,7 @@ public Action:Command_Ungag(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_Unsilence(client, args)
|
||||
public Action Command_Unsilence(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -572,11 +577,12 @@ public Action:Command_Unsilence(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:arg[64];
|
||||
char arg[64];
|
||||
GetCmdArg(1, arg, sizeof(arg));
|
||||
|
||||
decl String:target_name[MAX_TARGET_LENGTH];
|
||||
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
|
||||
char target_name[MAX_TARGET_LENGTH];
|
||||
int target_list[MAXPLAYERS], target_count;
|
||||
bool tn_is_ml;
|
||||
|
||||
if ((target_count = ProcessTargetString(
|
||||
arg,
|
||||
@ -592,9 +598,9 @@ public Action:Command_Unsilence(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
for (new i = 0; i < target_count; i++)
|
||||
for (int i = 0; i < target_count; i++)
|
||||
{
|
||||
new target = target_list[i];
|
||||
int target = target_list[i];
|
||||
|
||||
PerformUnSilence(client, target);
|
||||
}
|
||||
|
@ -31,9 +31,9 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
public Native_IsClientGagged(Handle:hPlugin, numParams)
|
||||
public int Native_IsClientGagged(Handle hPlugin, int numParams)
|
||||
{
|
||||
new client = GetNativeCell(1);
|
||||
int client = GetNativeCell(1);
|
||||
if (client < 1 || client > MaxClients)
|
||||
{
|
||||
return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index %d", client);
|
||||
@ -47,9 +47,9 @@
|
||||
return g_Gagged[client];
|
||||
}
|
||||
|
||||
public Native_IsClientMuted(Handle:hPlugin, numParams)
|
||||
public int Native_IsClientMuted(Handle hPlugin, int numParams)
|
||||
{
|
||||
new client = GetNativeCell(1);
|
||||
int client = GetNativeCell(1);
|
||||
if (client < 1 || client > MaxClients)
|
||||
{
|
||||
return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index %d", client);
|
||||
@ -63,9 +63,9 @@ public Native_IsClientMuted(Handle:hPlugin, numParams)
|
||||
return g_Muted[client];
|
||||
}
|
||||
|
||||
public Native_SetClientGag(Handle:hPlugin, numParams)
|
||||
public int Native_SetClientGag(Handle hPlugin, int numParams)
|
||||
{
|
||||
new client = GetNativeCell(1);
|
||||
int client = GetNativeCell(1);
|
||||
if (client < 1 || client > MaxClients)
|
||||
{
|
||||
return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index %d", client);
|
||||
@ -76,7 +76,7 @@ public Native_SetClientGag(Handle:hPlugin, numParams)
|
||||
return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not in game", client);
|
||||
}
|
||||
|
||||
new bool:gagState = GetNativeCell(2);
|
||||
bool gagState = GetNativeCell(2);
|
||||
|
||||
if (gagState)
|
||||
{
|
||||
@ -100,9 +100,9 @@ public Native_SetClientGag(Handle:hPlugin, numParams)
|
||||
return true;
|
||||
}
|
||||
|
||||
public Native_SetClientMute(Handle:hPlugin, numParams)
|
||||
public int Native_SetClientMute(Handle hPlugin, int numParams)
|
||||
{
|
||||
new client = GetNativeCell(1);
|
||||
int client = GetNativeCell(1);
|
||||
if (client < 1 || client > MaxClients)
|
||||
{
|
||||
return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index %d", client);
|
||||
@ -113,7 +113,7 @@ public Native_SetClientMute(Handle:hPlugin, numParams)
|
||||
return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not in game", client);
|
||||
}
|
||||
|
||||
new bool:muteState = GetNativeCell(2);
|
||||
bool muteState = GetNativeCell(2);
|
||||
|
||||
if (muteState)
|
||||
{
|
||||
|
@ -37,7 +37,9 @@
|
||||
#undef REQUIRE_PLUGIN
|
||||
#include <adminmenu>
|
||||
|
||||
public Plugin:myinfo =
|
||||
#pragma newdecls required
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "Basic Commands",
|
||||
author = "AlliedModders LLC",
|
||||
@ -49,7 +51,7 @@ public Plugin:myinfo =
|
||||
TopMenu hTopMenu;
|
||||
|
||||
Menu g_MapList;
|
||||
new Handle:g_ProtectedVars;
|
||||
StringMap g_ProtectedVars;
|
||||
|
||||
#include "basecommands/kick.sp"
|
||||
#include "basecommands/reloadadmins.sp"
|
||||
@ -58,7 +60,7 @@ new Handle:g_ProtectedVars;
|
||||
#include "basecommands/map.sp"
|
||||
#include "basecommands/execcfg.sp"
|
||||
|
||||
public OnPluginStart()
|
||||
public void OnPluginStart()
|
||||
{
|
||||
LoadTranslations("common.phrases");
|
||||
LoadTranslations("plugin.basecommands");
|
||||
@ -81,7 +83,7 @@ public OnPluginStart()
|
||||
OnAdminMenuReady(topmenu);
|
||||
}
|
||||
|
||||
g_MapList = CreateMenu(MenuHandler_ChangeMap, MenuAction_Display);
|
||||
g_MapList = new Menu(MenuHandler_ChangeMap, MenuAction_Display);
|
||||
g_MapList.SetTitle("%T", "Please select a map", LANG_SERVER);
|
||||
g_MapList.ExitBackButton = true;
|
||||
|
||||
@ -89,39 +91,39 @@ public OnPluginStart()
|
||||
BuildPath(Path_SM, mapListPath, sizeof(mapListPath), "configs/adminmenu_maplist.ini");
|
||||
SetMapListCompatBind("sm_map menu", mapListPath);
|
||||
|
||||
g_ProtectedVars = CreateTrie();
|
||||
g_ProtectedVars = new StringMap();
|
||||
ProtectVar("rcon_password");
|
||||
ProtectVar("sm_show_activity");
|
||||
ProtectVar("sm_immunity_mode");
|
||||
}
|
||||
|
||||
public OnMapStart()
|
||||
public void OnMapStart()
|
||||
{
|
||||
ParseConfigs();
|
||||
}
|
||||
|
||||
public OnConfigsExecuted()
|
||||
public void OnConfigsExecuted()
|
||||
{
|
||||
LoadMapList(g_MapList);
|
||||
}
|
||||
|
||||
ProtectVar(const String:cvar[])
|
||||
void ProtectVar(const char[] cvar)
|
||||
{
|
||||
SetTrieValue(g_ProtectedVars, cvar, 1);
|
||||
g_ProtectedVars.SetValue(cvar, 1);
|
||||
}
|
||||
|
||||
bool:IsVarProtected(const String:cvar[])
|
||||
bool IsVarProtected(const char[] cvar)
|
||||
{
|
||||
decl dummy_value;
|
||||
return GetTrieValue(g_ProtectedVars, cvar, dummy_value);
|
||||
int dummy_value;
|
||||
return g_ProtectedVars.GetValue(cvar, dummy_value);
|
||||
}
|
||||
|
||||
bool:IsClientAllowedToChangeCvar(client, const String:cvarname[])
|
||||
bool IsClientAllowedToChangeCvar(int client, const char[] cvarname)
|
||||
{
|
||||
ConVar hndl = FindConVar(cvarname);
|
||||
|
||||
new bool:allowed = false;
|
||||
new client_flags = client == 0 ? ADMFLAG_ROOT : GetUserFlagBits(client);
|
||||
bool allowed = false;
|
||||
int client_flags = client == 0 ? ADMFLAG_ROOT : GetUserFlagBits(client);
|
||||
|
||||
if (client_flags & ADMFLAG_ROOT)
|
||||
{
|
||||
@ -146,7 +148,7 @@ bool:IsClientAllowedToChangeCvar(client, const String:cvarname[])
|
||||
return allowed;
|
||||
}
|
||||
|
||||
public OnAdminMenuReady(Handle aTopMenu)
|
||||
public void OnAdminMenuReady(Handle aTopMenu)
|
||||
{
|
||||
TopMenu topmenu = TopMenu.FromHandle(aTopMenu);
|
||||
|
||||
@ -185,7 +187,7 @@ public OnAdminMenuReady(Handle aTopMenu)
|
||||
}
|
||||
}
|
||||
|
||||
public OnLibraryRemoved(const String:name[])
|
||||
public void OnLibraryRemoved(const char[] name)
|
||||
{
|
||||
if (strcmp(name, "adminmenu") == 0)
|
||||
{
|
||||
@ -194,7 +196,7 @@ public OnLibraryRemoved(const String:name[])
|
||||
}
|
||||
|
||||
#define FLAG_STRINGS 14
|
||||
new String:g_FlagNames[FLAG_STRINGS][20] =
|
||||
char g_FlagNames[FLAG_STRINGS][20] =
|
||||
{
|
||||
"res",
|
||||
"admin",
|
||||
@ -212,16 +214,16 @@ new String:g_FlagNames[FLAG_STRINGS][20] =
|
||||
"cheat"
|
||||
};
|
||||
|
||||
CustomFlagsToString(String:buffer[], maxlength, flags)
|
||||
int CustomFlagsToString(char[] buffer, int maxlength, int flags)
|
||||
{
|
||||
char joins[6][6];
|
||||
new total;
|
||||
int total;
|
||||
|
||||
for (new i=_:Admin_Custom1; i<=_:Admin_Custom6; i++)
|
||||
for (int i=view_as<int>(Admin_Custom1); i<=view_as<int>(Admin_Custom6); i++)
|
||||
{
|
||||
if (flags & (1<<i))
|
||||
{
|
||||
IntToString(i - _:Admin_Custom1 + 1, joins[total++], 6);
|
||||
IntToString(i - view_as<int>(Admin_Custom1) + 1, joins[total++], 6);
|
||||
}
|
||||
}
|
||||
|
||||
@ -230,12 +232,12 @@ CustomFlagsToString(String:buffer[], maxlength, flags)
|
||||
return total;
|
||||
}
|
||||
|
||||
FlagsToString(String:buffer[], maxlength, flags)
|
||||
void FlagsToString(char[] buffer, int maxlength, int flags)
|
||||
{
|
||||
char joins[FLAG_STRINGS+1][32];
|
||||
new total;
|
||||
int total;
|
||||
|
||||
for (new i=0; i<FLAG_STRINGS; i++)
|
||||
for (int i=0; i<FLAG_STRINGS; i++)
|
||||
{
|
||||
if (flags & (1<<i))
|
||||
{
|
||||
@ -252,7 +254,7 @@ FlagsToString(String:buffer[], maxlength, flags)
|
||||
ImplodeStrings(joins, total, ", ", buffer, maxlength);
|
||||
}
|
||||
|
||||
public Action:Command_Cvar(client, args)
|
||||
public Action Command_Cvar(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -323,7 +325,7 @@ public Action:Command_Cvar(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_ResetCvar(client, args)
|
||||
public Action Command_ResetCvar(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -367,7 +369,7 @@ public Action:Command_ResetCvar(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_Rcon(client, args)
|
||||
public Action Command_Rcon(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -384,7 +386,7 @@ public Action:Command_Rcon(client, args)
|
||||
{
|
||||
ServerCommand("%s", argstring);
|
||||
} else {
|
||||
new String:responseBuffer[4096];
|
||||
char responseBuffer[4096];
|
||||
ServerCommandEx(responseBuffer, sizeof(responseBuffer), "%s", argstring);
|
||||
ReplyToCommand(client, responseBuffer);
|
||||
}
|
||||
@ -392,7 +394,7 @@ public Action:Command_Rcon(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_ReVote(client, args)
|
||||
public Action Command_ReVote(int client, int args)
|
||||
{
|
||||
if (client == 0)
|
||||
{
|
||||
|
@ -31,7 +31,7 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
PerformCancelVote(client)
|
||||
void PerformCancelVote(int client)
|
||||
{
|
||||
if (!IsVoteInProgress())
|
||||
{
|
||||
@ -44,12 +44,12 @@ PerformCancelVote(client)
|
||||
CancelVote();
|
||||
}
|
||||
|
||||
public AdminMenu_CancelVote(Handle:topmenu,
|
||||
TopMenuAction:action,
|
||||
TopMenuObject:object_id,
|
||||
param,
|
||||
String:buffer[],
|
||||
maxlength)
|
||||
public void AdminMenu_CancelVote(TopMenu topmenu,
|
||||
TopMenuAction action,
|
||||
TopMenuObject object_id,
|
||||
int param,
|
||||
char[] buffer,
|
||||
int maxlength)
|
||||
{
|
||||
if (action == TopMenuAction_DisplayOption)
|
||||
{
|
||||
@ -66,10 +66,9 @@ public AdminMenu_CancelVote(Handle:topmenu,
|
||||
}
|
||||
}
|
||||
|
||||
public Action:Command_CancelVote(client, args)
|
||||
public Action Command_CancelVote(int client, int args)
|
||||
{
|
||||
PerformCancelVote(client);
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
Menu g_ConfigMenu = null;
|
||||
|
||||
PerformExec(client, String:path[])
|
||||
void PerformExec(int client, char[] path)
|
||||
{
|
||||
if (!FileExists(path))
|
||||
{
|
||||
@ -48,12 +48,12 @@ PerformExec(client, String:path[])
|
||||
ServerCommand("exec \"%s\"", path[4]);
|
||||
}
|
||||
|
||||
public AdminMenu_ExecCFG(Handle:topmenu,
|
||||
TopMenuAction:action,
|
||||
TopMenuObject:object_id,
|
||||
param,
|
||||
String:buffer[],
|
||||
maxlength)
|
||||
public void AdminMenu_ExecCFG(TopMenu topmenu,
|
||||
TopMenuAction action,
|
||||
TopMenuObject object_id,
|
||||
int param,
|
||||
char[] buffer,
|
||||
int maxlength)
|
||||
{
|
||||
if (action == TopMenuAction_DisplayOption)
|
||||
{
|
||||
@ -65,7 +65,7 @@ public AdminMenu_ExecCFG(Handle:topmenu,
|
||||
}
|
||||
}
|
||||
|
||||
public MenuHandler_ExecCFG(Menu menu, MenuAction action, int param1, int param2)
|
||||
public int MenuHandler_ExecCFG(Menu menu, MenuAction action, int param1, int param2)
|
||||
{
|
||||
if (action == MenuAction_Cancel)
|
||||
{
|
||||
@ -76,7 +76,7 @@ public MenuHandler_ExecCFG(Menu menu, MenuAction action, int param1, int param2)
|
||||
}
|
||||
else if (action == MenuAction_Select)
|
||||
{
|
||||
decl String:path[256];
|
||||
char path[256];
|
||||
|
||||
menu.GetItem(param2, path, sizeof(path));
|
||||
|
||||
@ -84,13 +84,15 @@ public MenuHandler_ExecCFG(Menu menu, MenuAction action, int param1, int param2)
|
||||
}
|
||||
else if (action == MenuAction_Display)
|
||||
{
|
||||
decl String:title[128];
|
||||
char title[128];
|
||||
Format(title, sizeof(title), "%T", "Choose Config", param1);
|
||||
SetPanelTitle(Handle:param2, title);
|
||||
|
||||
Panel panel = view_as<Panel>(param2);
|
||||
panel.SetTitle(title);
|
||||
}
|
||||
}
|
||||
|
||||
public Action:Command_ExecCfg(client, args)
|
||||
public Action Command_ExecCfg(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -98,7 +100,7 @@ public Action:Command_ExecCfg(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
new String:path[64] = "cfg/";
|
||||
char path[64] = "cfg/";
|
||||
GetCmdArg(1, path[4], sizeof(path)-4);
|
||||
|
||||
PerformExec(client, path);
|
||||
@ -107,7 +109,7 @@ public Action:Command_ExecCfg(client, args)
|
||||
}
|
||||
|
||||
SMCParser config_parser;
|
||||
ParseConfigs()
|
||||
void ParseConfigs()
|
||||
{
|
||||
if (!config_parser)
|
||||
config_parser = new SMCParser();
|
||||
@ -121,11 +123,11 @@ ParseConfigs()
|
||||
delete g_ConfigMenu;
|
||||
}
|
||||
|
||||
g_ConfigMenu = CreateMenu(MenuHandler_ExecCFG, MenuAction_Display);
|
||||
g_ConfigMenu = new Menu(MenuHandler_ExecCFG, MenuAction_Display);
|
||||
g_ConfigMenu.SetTitle("%T", "Choose Config", LANG_SERVER);
|
||||
g_ConfigMenu.ExitBackButton = true;
|
||||
|
||||
decl String:configPath[256];
|
||||
char configPath[256];
|
||||
BuildPath(Path_SM, configPath, sizeof(configPath), "configs/adminmenu_cfgs.txt");
|
||||
|
||||
if (!FileExists(configPath))
|
||||
@ -139,7 +141,7 @@ ParseConfigs()
|
||||
SMCError err = config_parser.ParseFile(configPath, line);
|
||||
if (err != SMCError_Okay)
|
||||
{
|
||||
decl String:error[256];
|
||||
char error[256];
|
||||
SMC_GetErrorString(err, error, sizeof(error));
|
||||
LogError("Could not parse file (line %d, file \"%s\"):", line, configPath);
|
||||
LogError("Parser encountered error: %s", error);
|
||||
|
@ -31,7 +31,7 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
PerformKick(client, target, const String:reason[])
|
||||
void PerformKick(int client, int target, const char[] reason)
|
||||
{
|
||||
LogAction(client, target, "\"%L\" kicked \"%L\" (reason \"%s\")", client, target, reason);
|
||||
|
||||
@ -45,11 +45,11 @@ PerformKick(client, target, const String:reason[])
|
||||
}
|
||||
}
|
||||
|
||||
DisplayKickMenu(client)
|
||||
void DisplayKickMenu(int client)
|
||||
{
|
||||
Menu menu = CreateMenu(MenuHandler_Kick);
|
||||
Menu menu = new Menu(MenuHandler_Kick);
|
||||
|
||||
decl String:title[100];
|
||||
char title[100];
|
||||
Format(title, sizeof(title), "%T:", "Kick player", client);
|
||||
menu.SetTitle(title);
|
||||
menu.ExitBackButton = true;
|
||||
@ -59,12 +59,12 @@ DisplayKickMenu(client)
|
||||
menu.Display(client, MENU_TIME_FOREVER);
|
||||
}
|
||||
|
||||
public AdminMenu_Kick(Handle:topmenu,
|
||||
TopMenuAction:action,
|
||||
TopMenuObject:object_id,
|
||||
param,
|
||||
String:buffer[],
|
||||
maxlength)
|
||||
public void AdminMenu_Kick(TopMenu topmenu,
|
||||
TopMenuAction action,
|
||||
TopMenuObject object_id,
|
||||
int param,
|
||||
char[] buffer,
|
||||
int maxlength)
|
||||
{
|
||||
if (action == TopMenuAction_DisplayOption)
|
||||
{
|
||||
@ -76,7 +76,7 @@ public AdminMenu_Kick(Handle:topmenu,
|
||||
}
|
||||
}
|
||||
|
||||
public MenuHandler_Kick(Menu menu, MenuAction action, int param1, int param2)
|
||||
public int MenuHandler_Kick(Menu menu, MenuAction action, int param1, int param2)
|
||||
{
|
||||
if (action == MenuAction_End)
|
||||
{
|
||||
@ -91,8 +91,8 @@ public MenuHandler_Kick(Menu menu, MenuAction action, int param1, int param2)
|
||||
}
|
||||
else if (action == MenuAction_Select)
|
||||
{
|
||||
decl String:info[32];
|
||||
new userid, target;
|
||||
char info[32];
|
||||
int userid, target;
|
||||
|
||||
menu.GetItem(param2, info, sizeof(info));
|
||||
userid = StringToInt(info);
|
||||
@ -107,7 +107,7 @@ public MenuHandler_Kick(Menu menu, MenuAction action, int param1, int param2)
|
||||
}
|
||||
else
|
||||
{
|
||||
decl String:name[MAX_NAME_LENGTH];
|
||||
char name[MAX_NAME_LENGTH];
|
||||
GetClientName(target, name, sizeof(name));
|
||||
ShowActivity2(param1, "[SM] ", "%t", "Kicked target", "_s", name);
|
||||
PerformKick(param1, target, "");
|
||||
@ -121,7 +121,7 @@ public MenuHandler_Kick(Menu menu, MenuAction action, int param1, int param2)
|
||||
}
|
||||
}
|
||||
|
||||
public Action:Command_Kick(client, args)
|
||||
public Action Command_Kick(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -129,11 +129,11 @@ public Action:Command_Kick(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:Arguments[256];
|
||||
char Arguments[256];
|
||||
GetCmdArgString(Arguments, sizeof(Arguments));
|
||||
|
||||
decl String:arg[65];
|
||||
new len = BreakString(Arguments, arg, sizeof(arg));
|
||||
char arg[65];
|
||||
int len = BreakString(Arguments, arg, sizeof(arg));
|
||||
|
||||
if (len == -1)
|
||||
{
|
||||
@ -142,8 +142,9 @@ public Action:Command_Kick(client, args)
|
||||
Arguments[0] = '\0';
|
||||
}
|
||||
|
||||
decl String:target_name[MAX_TARGET_LENGTH];
|
||||
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
|
||||
char target_name[MAX_TARGET_LENGTH];
|
||||
int target_list[MAXPLAYERS], target_count;
|
||||
bool tn_is_ml;
|
||||
|
||||
if ((target_count = ProcessTargetString(
|
||||
arg,
|
||||
@ -155,7 +156,7 @@ public Action:Command_Kick(client, args)
|
||||
sizeof(target_name),
|
||||
tn_is_ml)) > 0)
|
||||
{
|
||||
decl String:reason[64];
|
||||
char reason[64];
|
||||
Format(reason, sizeof(reason), Arguments[len]);
|
||||
|
||||
if (tn_is_ml)
|
||||
@ -181,9 +182,9 @@ public Action:Command_Kick(client, args)
|
||||
}
|
||||
}
|
||||
|
||||
new kick_self = 0;
|
||||
int kick_self = 0;
|
||||
|
||||
for (new i = 0; i < target_count; i++)
|
||||
for (int i = 0; i < target_count; i++)
|
||||
{
|
||||
/* Kick everyone else first */
|
||||
if (target_list[i] == client)
|
||||
|
@ -31,7 +31,7 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
public MenuHandler_ChangeMap(Menu menu, MenuAction action, int param1, int param2)
|
||||
public int MenuHandler_ChangeMap(Menu menu, MenuAction action, int param1, int param2)
|
||||
{
|
||||
if (action == MenuAction_Cancel)
|
||||
{
|
||||
@ -42,7 +42,7 @@ public MenuHandler_ChangeMap(Menu menu, MenuAction action, int param1, int param
|
||||
}
|
||||
else if (action == MenuAction_Select)
|
||||
{
|
||||
decl String:map[64];
|
||||
char map[64];
|
||||
|
||||
menu.GetItem(param2, map, sizeof(map));
|
||||
|
||||
@ -50,24 +50,26 @@ public MenuHandler_ChangeMap(Menu menu, MenuAction action, int param1, int param
|
||||
|
||||
LogAction(param1, -1, "\"%L\" changed map to \"%s\"", param1, map);
|
||||
|
||||
new Handle:dp;
|
||||
DataPack dp;
|
||||
CreateDataTimer(3.0, Timer_ChangeMap, dp);
|
||||
WritePackString(dp, map);
|
||||
dp.WriteString(map);
|
||||
}
|
||||
else if (action == MenuAction_Display)
|
||||
{
|
||||
decl String:title[128];
|
||||
char title[128];
|
||||
Format(title, sizeof(title), "%T", "Please select a map", param1);
|
||||
SetPanelTitle(Handle:param2, title);
|
||||
|
||||
Panel panel = view_as<Panel>(param2);
|
||||
panel.SetTitle(title);
|
||||
}
|
||||
}
|
||||
|
||||
public AdminMenu_Map(Handle:topmenu,
|
||||
TopMenuAction:action,
|
||||
TopMenuObject:object_id,
|
||||
param,
|
||||
String:buffer[],
|
||||
maxlength)
|
||||
public void AdminMenu_Map(TopMenu topmenu,
|
||||
TopMenuAction action,
|
||||
TopMenuObject object_id,
|
||||
int param,
|
||||
char[] buffer,
|
||||
int maxlength)
|
||||
{
|
||||
if (action == TopMenuAction_DisplayOption)
|
||||
{
|
||||
@ -79,7 +81,7 @@ public AdminMenu_Map(Handle:topmenu,
|
||||
}
|
||||
}
|
||||
|
||||
public Action:Command_Map(client, args)
|
||||
public Action Command_Map(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -87,7 +89,7 @@ public Action:Command_Map(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:map[64];
|
||||
char map[64];
|
||||
GetCmdArg(1, map, sizeof(map));
|
||||
|
||||
if (!IsMapValid(map))
|
||||
@ -100,31 +102,31 @@ public Action:Command_Map(client, args)
|
||||
|
||||
LogAction(client, -1, "\"%L\" changed map to \"%s\"", client, map);
|
||||
|
||||
new Handle:dp;
|
||||
DataPack dp;
|
||||
CreateDataTimer(3.0, Timer_ChangeMap, dp);
|
||||
WritePackString(dp, map);
|
||||
dp.WriteString(map);
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Timer_ChangeMap(Handle:timer, Handle:dp)
|
||||
public Action Timer_ChangeMap(Handle timer, DataPack dp)
|
||||
{
|
||||
decl String:map[65];
|
||||
char map[65];
|
||||
|
||||
ResetPack(dp);
|
||||
ReadPackString(dp, map, sizeof(map));
|
||||
dp.Reset();
|
||||
dp.ReadString(map, sizeof(map));
|
||||
|
||||
ForceChangeLevel(map, "sm_map Command");
|
||||
|
||||
return Plugin_Stop;
|
||||
}
|
||||
|
||||
new Handle:g_map_array = null;
|
||||
new g_map_serial = -1;
|
||||
Handle g_map_array = null;
|
||||
int g_map_serial = -1;
|
||||
|
||||
int LoadMapList(Menu menu)
|
||||
{
|
||||
new Handle:map_array;
|
||||
Handle map_array;
|
||||
|
||||
if ((map_array = ReadMapList(g_map_array,
|
||||
g_map_serial,
|
||||
@ -140,7 +142,7 @@ int LoadMapList(Menu menu)
|
||||
return 0;
|
||||
}
|
||||
|
||||
RemoveAllMenuItems(menu);
|
||||
menu.RemoveAllItems();
|
||||
|
||||
char map_name[64];
|
||||
int map_count = GetArraySize(g_map_array);
|
||||
|
@ -31,7 +31,7 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
PerformReloadAdmins(client)
|
||||
void PerformReloadAdmins(int client)
|
||||
{
|
||||
/* Dump it all! */
|
||||
DumpAdminCache(AdminCache_Groups, true);
|
||||
@ -41,12 +41,12 @@ PerformReloadAdmins(client)
|
||||
ReplyToCommand(client, "[SM] %t", "Admin cache refreshed");
|
||||
}
|
||||
|
||||
public AdminMenu_ReloadAdmins(Handle:topmenu,
|
||||
TopMenuAction:action,
|
||||
TopMenuObject:object_id,
|
||||
param,
|
||||
String:buffer[],
|
||||
maxlength)
|
||||
public void AdminMenu_ReloadAdmins(TopMenu topmenu,
|
||||
TopMenuAction action,
|
||||
TopMenuObject object_id,
|
||||
int param,
|
||||
char[] buffer,
|
||||
int maxlength)
|
||||
{
|
||||
if (action == TopMenuAction_DisplayOption)
|
||||
{
|
||||
@ -59,7 +59,7 @@ public AdminMenu_ReloadAdmins(Handle:topmenu,
|
||||
}
|
||||
}
|
||||
|
||||
public Action:Command_ReloadAdmins(client, args)
|
||||
public Action Command_ReloadAdmins(int client, int args)
|
||||
{
|
||||
PerformReloadAdmins(client);
|
||||
|
||||
|
@ -31,20 +31,20 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
PerformWho(client, target, ReplySource:reply, bool:is_admin)
|
||||
void PerformWho(int client, int target, ReplySource reply, bool is_admin)
|
||||
{
|
||||
decl String:name[MAX_NAME_LENGTH];
|
||||
char name[MAX_NAME_LENGTH];
|
||||
GetClientName(target, name, sizeof(name));
|
||||
|
||||
new bool:show_name = false;
|
||||
new String:admin_name[MAX_NAME_LENGTH];
|
||||
new AdminId:id = GetUserAdmin(target);
|
||||
if (id != INVALID_ADMIN_ID && GetAdminUsername(id, admin_name, sizeof(admin_name)))
|
||||
bool show_name = false;
|
||||
char admin_name[MAX_NAME_LENGTH];
|
||||
AdminId id = GetUserAdmin(target);
|
||||
if (id != INVALID_ADMIN_ID && id.GetUsername(admin_name, sizeof(admin_name)))
|
||||
{
|
||||
show_name = true;
|
||||
}
|
||||
|
||||
new ReplySource:old_reply = SetCmdReplySource(reply);
|
||||
ReplySource old_reply = SetCmdReplySource(reply);
|
||||
|
||||
if (id == INVALID_ADMIN_ID)
|
||||
{
|
||||
@ -58,8 +58,8 @@ PerformWho(client, target, ReplySource:reply, bool:is_admin)
|
||||
}
|
||||
else
|
||||
{
|
||||
new flags = GetUserFlagBits(target);
|
||||
decl String:flagstring[255];
|
||||
int flags = GetUserFlagBits(target);
|
||||
char flagstring[255];
|
||||
if (flags == 0)
|
||||
{
|
||||
strcopy(flagstring, sizeof(flagstring), "none");
|
||||
@ -87,11 +87,11 @@ PerformWho(client, target, ReplySource:reply, bool:is_admin)
|
||||
SetCmdReplySource(old_reply);
|
||||
}
|
||||
|
||||
DisplayWhoMenu(client)
|
||||
void DisplayWhoMenu(int client)
|
||||
{
|
||||
Menu menu = CreateMenu(MenuHandler_Who);
|
||||
Menu menu = new Menu(MenuHandler_Who);
|
||||
|
||||
decl String:title[100];
|
||||
char title[100];
|
||||
Format(title, sizeof(title), "%T:", "Identify player", client);
|
||||
menu.SetTitle(title);
|
||||
menu.ExitBackButton = true;
|
||||
@ -101,12 +101,12 @@ DisplayWhoMenu(client)
|
||||
menu.Display(client, MENU_TIME_FOREVER);
|
||||
}
|
||||
|
||||
public AdminMenu_Who(Handle:topmenu,
|
||||
TopMenuAction:action,
|
||||
TopMenuObject:object_id,
|
||||
param,
|
||||
String:buffer[],
|
||||
maxlength)
|
||||
public void AdminMenu_Who(TopMenu topmenu,
|
||||
TopMenuAction action,
|
||||
TopMenuObject object_id,
|
||||
int param,
|
||||
char[] buffer,
|
||||
int maxlength)
|
||||
{
|
||||
if (action == TopMenuAction_DisplayOption)
|
||||
{
|
||||
@ -118,7 +118,7 @@ public AdminMenu_Who(Handle:topmenu,
|
||||
}
|
||||
}
|
||||
|
||||
public MenuHandler_Who(Menu menu, MenuAction action, int param1, int param2)
|
||||
public int MenuHandler_Who(Menu menu, MenuAction action, int param1, int param2)
|
||||
{
|
||||
if (action == MenuAction_End)
|
||||
{
|
||||
@ -133,8 +133,8 @@ public MenuHandler_Who(Menu menu, MenuAction action, int param1, int param2)
|
||||
}
|
||||
else if (action == MenuAction_Select)
|
||||
{
|
||||
decl String:info[32];
|
||||
new userid, target;
|
||||
char info[32];
|
||||
int userid, target;
|
||||
|
||||
menu.GetItem(param2, info, sizeof(info));
|
||||
userid = StringToInt(info);
|
||||
@ -162,9 +162,9 @@ public MenuHandler_Who(Menu menu, MenuAction action, int param1, int param2)
|
||||
*/
|
||||
}
|
||||
}
|
||||
public Action:Command_Who(client, args)
|
||||
public Action Command_Who(int client, int args)
|
||||
{
|
||||
new bool:is_admin = false;
|
||||
bool is_admin = false;
|
||||
|
||||
if (!client || (client && GetUserFlagBits(client) != 0))
|
||||
{
|
||||
@ -174,7 +174,7 @@ public Action:Command_Who(client, args)
|
||||
if (args < 1)
|
||||
{
|
||||
/* Display header */
|
||||
decl String:t_access[16], String:t_name[16], String:t_username[16];
|
||||
char t_access[16], t_name[16], t_username[16];
|
||||
Format(t_access, sizeof(t_access), "%T", "Admin access", client);
|
||||
Format(t_name, sizeof(t_name), "%T", "Name", client);
|
||||
Format(t_username, sizeof(t_username), "%T", "Username", client);
|
||||
@ -189,16 +189,16 @@ public Action:Command_Who(client, args)
|
||||
}
|
||||
|
||||
/* List all players */
|
||||
decl String:flagstring[255];
|
||||
char flagstring[255];
|
||||
|
||||
for (new i=1; i<=MaxClients; i++)
|
||||
for (int i=1; i<=MaxClients; i++)
|
||||
{
|
||||
if (!IsClientInGame(i))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
new flags = GetUserFlagBits(i);
|
||||
new AdminId:id = GetUserAdmin(i);
|
||||
int flags = GetUserFlagBits(i);
|
||||
AdminId id = GetUserAdmin(i);
|
||||
if (flags == 0)
|
||||
{
|
||||
strcopy(flagstring, sizeof(flagstring), "none");
|
||||
@ -211,14 +211,14 @@ public Action:Command_Who(client, args)
|
||||
{
|
||||
FlagsToString(flagstring, sizeof(flagstring), flags);
|
||||
}
|
||||
decl String:name[MAX_NAME_LENGTH];
|
||||
new String:username[MAX_NAME_LENGTH];
|
||||
char name[MAX_NAME_LENGTH];
|
||||
char username[MAX_NAME_LENGTH];
|
||||
|
||||
GetClientName(i, name, sizeof(name));
|
||||
|
||||
if (id != INVALID_ADMIN_ID)
|
||||
{
|
||||
GetAdminUsername(id, username, sizeof(username));
|
||||
id.GetUsername(username, sizeof(username));
|
||||
}
|
||||
|
||||
if (is_admin)
|
||||
@ -246,10 +246,10 @@ public Action:Command_Who(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:arg[65];
|
||||
char arg[65];
|
||||
GetCmdArg(1, arg, sizeof(arg));
|
||||
|
||||
new target = FindTarget(client, arg, false, false);
|
||||
int target = FindTarget(client, arg, false, false);
|
||||
if (target == -1)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
|
@ -39,7 +39,9 @@
|
||||
#include <mapchooser>
|
||||
#define REQUIRE_PLUGIN
|
||||
|
||||
public Plugin:myinfo =
|
||||
#pragma newdecls required
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "Basic Info Triggers",
|
||||
author = "AlliedModders LLC",
|
||||
@ -62,11 +64,11 @@ ConVar g_Cvar_MaxRounds;
|
||||
#define TIMELEFT_ALL_MAYBE 1 /* Print to all players if sm_trigger_show allows */
|
||||
#define TIMELEFT_ONE 2 /* Print to a single player */
|
||||
|
||||
new bool:mapchooser;
|
||||
bool mapchooser;
|
||||
|
||||
new g_TotalRounds;
|
||||
int g_TotalRounds;
|
||||
|
||||
public OnPluginStart()
|
||||
public void OnPluginStart()
|
||||
{
|
||||
LoadTranslations("common.phrases");
|
||||
LoadTranslations("basetriggers.phrases");
|
||||
@ -82,17 +84,17 @@ public OnPluginStart()
|
||||
|
||||
g_Cvar_TimeleftInterval.AddChangeHook(ConVarChange_TimeleftInterval);
|
||||
|
||||
decl String:folder[64];
|
||||
GetGameFolderName(folder, sizeof(folder));
|
||||
char folder[64];
|
||||
GetGameFolderName(folder, sizeof(folder));
|
||||
|
||||
if (strcmp(folder, "insurgency") == 0)
|
||||
{
|
||||
HookEvent("game_newmap", Event_GameStart);
|
||||
}
|
||||
else
|
||||
{
|
||||
HookEvent("game_start", Event_GameStart);
|
||||
}
|
||||
if (strcmp(folder, "insurgency") == 0)
|
||||
{
|
||||
HookEvent("game_newmap", Event_GameStart);
|
||||
}
|
||||
else
|
||||
{
|
||||
HookEvent("game_start", Event_GameStart);
|
||||
}
|
||||
|
||||
if (strcmp(folder, "nucleardawn") == 0)
|
||||
{
|
||||
@ -114,25 +116,25 @@ public OnPluginStart()
|
||||
mapchooser = LibraryExists("mapchooser");
|
||||
}
|
||||
|
||||
public OnMapStart()
|
||||
public void OnMapStart()
|
||||
{
|
||||
g_TotalRounds = 0;
|
||||
}
|
||||
|
||||
/* Round count tracking */
|
||||
public Event_TFRestartRound(Handle:event, const String:name[], bool:dontBroadcast)
|
||||
public void Event_TFRestartRound(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
/* Game got restarted - reset our round count tracking */
|
||||
g_TotalRounds = 0;
|
||||
}
|
||||
|
||||
public Event_GameStart(Handle:event, const String:name[], bool:dontBroadcast)
|
||||
public void Event_GameStart(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
/* Game got restarted - reset our round count tracking */
|
||||
g_TotalRounds = 0;
|
||||
}
|
||||
|
||||
public Event_TeamPlayWinPanel(Event event, const String:name[], bool:dontBroadcast)
|
||||
public void Event_TeamPlayWinPanel(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
if (event.GetInt("round_complete") == 1 || StrEqual(name, "arena_win_panel"))
|
||||
{
|
||||
@ -140,12 +142,12 @@ public Event_TeamPlayWinPanel(Event event, const String:name[], bool:dontBroadca
|
||||
}
|
||||
}
|
||||
/* You ask, why don't you just use team_score event? And I answer... Because CSS doesn't. */
|
||||
public Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
|
||||
public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
g_TotalRounds++;
|
||||
}
|
||||
|
||||
public OnLibraryRemoved(const String:name[])
|
||||
public void OnLibraryRemoved(const char[] name)
|
||||
{
|
||||
if (StrEqual(name, "mapchooser"))
|
||||
{
|
||||
@ -153,7 +155,7 @@ public OnLibraryRemoved(const String:name[])
|
||||
}
|
||||
}
|
||||
|
||||
public OnLibraryAdded(const String:name[])
|
||||
public void OnLibraryAdded(const char[] name)
|
||||
{
|
||||
if (StrEqual(name, "mapchooser"))
|
||||
{
|
||||
@ -161,9 +163,9 @@ public OnLibraryAdded(const String:name[])
|
||||
}
|
||||
}
|
||||
|
||||
public ConVarChange_TimeleftInterval(Handle:convar, const String:oldValue[], const String:newValue[])
|
||||
public void ConVarChange_TimeleftInterval(ConVar convar, const char[] oldValue, const char[] newValue)
|
||||
{
|
||||
new Float:newval = StringToFloat(newValue);
|
||||
float newval = StringToFloat(newValue);
|
||||
|
||||
if (newval < 1.0)
|
||||
{
|
||||
@ -184,24 +186,24 @@ public ConVarChange_TimeleftInterval(Handle:convar, const String:oldValue[], con
|
||||
g_Timer_TimeShow = CreateTimer(newval, Timer_DisplayTimeleft, _, TIMER_REPEAT);
|
||||
}
|
||||
|
||||
public Action:Timer_DisplayTimeleft(Handle:timer)
|
||||
public Action Timer_DisplayTimeleft(Handle timer)
|
||||
{
|
||||
ShowTimeLeft(0, TIMELEFT_ALL_ALWAYS);
|
||||
}
|
||||
|
||||
public Action:Command_Timeleft(client, args)
|
||||
public Action Command_Timeleft(int client, int args)
|
||||
{
|
||||
ShowTimeLeft(client, TIMELEFT_ONE);
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_Nextmap(client, args)
|
||||
public Action Command_Nextmap(int client, int args)
|
||||
{
|
||||
if (client && !IsClientInGame(client))
|
||||
return Plugin_Handled;
|
||||
|
||||
decl String:map[PLATFORM_MAX_PATH];
|
||||
char map[PLATFORM_MAX_PATH];
|
||||
|
||||
GetNextMap(map, sizeof(map));
|
||||
|
||||
@ -218,7 +220,7 @@ public Action:Command_Nextmap(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_Motd(client, args)
|
||||
public Action Command_Motd(int client, int args)
|
||||
{
|
||||
if (client == 0)
|
||||
{
|
||||
@ -234,7 +236,7 @@ public Action:Command_Motd(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_FriendlyFire(client, args)
|
||||
public Action Command_FriendlyFire(int client, int args)
|
||||
{
|
||||
if (client == 0)
|
||||
{
|
||||
@ -250,7 +252,7 @@ public Action:Command_FriendlyFire(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public OnClientSayCommand_Post(client, const String:command[], const String:sArgs[])
|
||||
public void OnClientSayCommand_Post(int client, const char[] command, const char[] sArgs)
|
||||
{
|
||||
if (strcmp(sArgs, "timeleft", false) == 0)
|
||||
{
|
||||
@ -323,7 +325,7 @@ public OnClientSayCommand_Post(client, const String:command[], const String:sArg
|
||||
}
|
||||
}
|
||||
|
||||
ShowTimeLeft(client, who)
|
||||
void ShowTimeLeft(int client, int who)
|
||||
{
|
||||
bool lastround = false;
|
||||
bool written = false;
|
||||
@ -337,11 +339,11 @@ ShowTimeLeft(client, who)
|
||||
client = 0;
|
||||
}
|
||||
|
||||
new timeleft;
|
||||
int timeleft;
|
||||
if (GetMapTimeLeft(timeleft))
|
||||
{
|
||||
new mins, secs;
|
||||
new timelimit;
|
||||
int mins, secs;
|
||||
int timelimit;
|
||||
|
||||
if (timeleft > 0)
|
||||
{
|
||||
@ -371,7 +373,7 @@ ShowTimeLeft(client, who)
|
||||
{
|
||||
if (written)
|
||||
{
|
||||
new len = strlen(finalOutput);
|
||||
int len = strlen(finalOutput);
|
||||
if (len < sizeof(finalOutput))
|
||||
{
|
||||
if (winlimit > 1)
|
||||
@ -408,7 +410,7 @@ ShowTimeLeft(client, who)
|
||||
{
|
||||
if (written)
|
||||
{
|
||||
new len = strlen(finalOutput);
|
||||
int len = strlen(finalOutput);
|
||||
if (len < sizeof(finalOutput))
|
||||
{
|
||||
if (fraglimit > 1)
|
||||
@ -443,11 +445,11 @@ ShowTimeLeft(client, who)
|
||||
|
||||
if (maxrounds > 0)
|
||||
{
|
||||
new remaining = maxrounds - g_TotalRounds;
|
||||
int remaining = maxrounds - g_TotalRounds;
|
||||
|
||||
if (written)
|
||||
{
|
||||
new len = strlen(finalOutput);
|
||||
int len = strlen(finalOutput);
|
||||
if (len < sizeof(finalOutput))
|
||||
{
|
||||
if (remaining > 1)
|
||||
@ -502,7 +504,7 @@ ShowTimeLeft(client, who)
|
||||
}
|
||||
}
|
||||
|
||||
ShowFriendlyFire(client)
|
||||
void ShowFriendlyFire(int client)
|
||||
{
|
||||
if (g_Cvar_FriendlyFire)
|
||||
{
|
||||
|
@ -37,7 +37,9 @@
|
||||
#undef REQUIRE_PLUGIN
|
||||
#include <adminmenu>
|
||||
|
||||
public Plugin:myinfo =
|
||||
#pragma newdecls required
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "Basic Votes",
|
||||
author = "AlliedModders LLC",
|
||||
@ -52,7 +54,7 @@ public Plugin:myinfo =
|
||||
Menu g_hVoteMenu = null;
|
||||
|
||||
ConVar g_Cvar_Limits[3] = {null, ...};
|
||||
//new Handle:g_Cvar_VoteSay = INVALID_HANDLE;
|
||||
//ConVar g_Cvar_VoteSay = null;
|
||||
|
||||
enum voteType
|
||||
{
|
||||
@ -62,21 +64,21 @@ enum voteType
|
||||
question
|
||||
}
|
||||
|
||||
new voteType:g_voteType = voteType:question;
|
||||
voteType g_voteType = question;
|
||||
|
||||
// Menu API does not provide us with a way to pass multiple peices of data with a single
|
||||
// choice, so some globals are used to hold stuff.
|
||||
//
|
||||
#define VOTE_CLIENTID 0
|
||||
#define VOTE_USERID 1
|
||||
new g_voteClient[2]; /* Holds the target's client id and user id */
|
||||
int g_voteClient[2]; /* Holds the target's client id and user id */
|
||||
|
||||
#define VOTE_NAME 0
|
||||
#define VOTE_AUTHID 1
|
||||
#define VOTE_IP 2
|
||||
new String:g_voteInfo[3][65]; /* Holds the target's name, authid, and IP */
|
||||
char g_voteInfo[3][65]; /* Holds the target's name, authid, and IP */
|
||||
|
||||
new String:g_voteArg[256]; /* Used to hold ban/kick reasons or vote questions */
|
||||
char g_voteArg[256]; /* Used to hold ban/kick reasons or vote questions */
|
||||
|
||||
|
||||
TopMenu hTopMenu;
|
||||
@ -85,7 +87,7 @@ TopMenu hTopMenu;
|
||||
#include "basevotes/voteban.sp"
|
||||
#include "basevotes/votemap.sp"
|
||||
|
||||
public OnPluginStart()
|
||||
public void OnPluginStart()
|
||||
{
|
||||
LoadTranslations("common.phrases");
|
||||
LoadTranslations("basevotes.phrases");
|
||||
@ -116,23 +118,23 @@ public OnPluginStart()
|
||||
OnAdminMenuReady(topmenu);
|
||||
}
|
||||
|
||||
g_SelectedMaps = CreateArray(ByteCountToCells(PLATFORM_MAX_PATH));
|
||||
g_SelectedMaps = new ArrayList(ByteCountToCells(PLATFORM_MAX_PATH));
|
||||
|
||||
g_MapList = CreateMenu(MenuHandler_Map, MenuAction_DrawItem|MenuAction_Display);
|
||||
g_MapList = new Menu(MenuHandler_Map, MenuAction_DrawItem|MenuAction_Display);
|
||||
g_MapList.SetTitle("%T", "Please select a map", LANG_SERVER);
|
||||
g_MapList.ExitBackButton = true;
|
||||
|
||||
decl String:mapListPath[PLATFORM_MAX_PATH];
|
||||
char mapListPath[PLATFORM_MAX_PATH];
|
||||
BuildPath(Path_SM, mapListPath, sizeof(mapListPath), "configs/adminmenu_maplist.ini");
|
||||
SetMapListCompatBind("sm_votemap menu", mapListPath);
|
||||
}
|
||||
|
||||
public OnConfigsExecuted()
|
||||
public void OnConfigsExecuted()
|
||||
{
|
||||
g_mapCount = LoadMapList(g_MapList);
|
||||
}
|
||||
|
||||
public OnAdminMenuReady(Handle aTopMenu)
|
||||
public void OnAdminMenuReady(Handle aTopMenu)
|
||||
{
|
||||
TopMenu topmenu = TopMenu.FromHandle(aTopMenu);
|
||||
|
||||
@ -146,7 +148,7 @@ public OnAdminMenuReady(Handle aTopMenu)
|
||||
hTopMenu = topmenu;
|
||||
|
||||
/* Build the "Voting Commands" category */
|
||||
new TopMenuObject:voting_commands = hTopMenu.FindCategory(ADMINMENU_VOTINGCOMMANDS);
|
||||
TopMenuObject voting_commands = hTopMenu.FindCategory(ADMINMENU_VOTINGCOMMANDS);
|
||||
|
||||
if (voting_commands != INVALID_TOPMENUOBJECT)
|
||||
{
|
||||
@ -156,7 +158,7 @@ public OnAdminMenuReady(Handle aTopMenu)
|
||||
}
|
||||
}
|
||||
|
||||
public Action:Command_Vote(client, args)
|
||||
public Action Command_Vote(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -175,13 +177,13 @@ public Action:Command_Vote(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:text[256];
|
||||
char text[256];
|
||||
GetCmdArgString(text, sizeof(text));
|
||||
|
||||
decl String:answers[5][64];
|
||||
new answerCount;
|
||||
new len = BreakString(text, g_voteArg, sizeof(g_voteArg));
|
||||
new pos = len;
|
||||
char answers[5][64];
|
||||
int answerCount;
|
||||
int len = BreakString(text, g_voteArg, sizeof(g_voteArg));
|
||||
int pos = len;
|
||||
|
||||
while (args > 1 && pos != -1 && answerCount < 5)
|
||||
{
|
||||
@ -197,9 +199,9 @@ public Action:Command_Vote(client, args)
|
||||
LogAction(client, -1, "\"%L\" initiated a generic vote.", client);
|
||||
ShowActivity2(client, "[SM] ", "%t", "Initiate Vote", g_voteArg);
|
||||
|
||||
g_voteType = voteType:question;
|
||||
g_voteType = question;
|
||||
|
||||
g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
|
||||
g_hVoteMenu = new Menu(Handler_VoteCallback, MENU_ACTIONS_ALL);
|
||||
g_hVoteMenu.SetTitle("%s?", g_voteArg);
|
||||
|
||||
if (answerCount < 2)
|
||||
@ -209,7 +211,7 @@ public Action:Command_Vote(client, args)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (new i = 0; i < answerCount; i++)
|
||||
for (int i = 0; i < answerCount; i++)
|
||||
{
|
||||
g_hVoteMenu.AddItem(answers[i], answers[i]);
|
||||
}
|
||||
@ -221,7 +223,7 @@ public Action:Command_Vote(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Handler_VoteCallback(Menu menu, MenuAction action, param1, param2)
|
||||
public int Handler_VoteCallback(Menu menu, MenuAction action, int param1, int param2)
|
||||
{
|
||||
if (action == MenuAction_End)
|
||||
{
|
||||
@ -229,7 +231,7 @@ public Handler_VoteCallback(Menu menu, MenuAction action, param1, param2)
|
||||
}
|
||||
else if (action == MenuAction_Display)
|
||||
{
|
||||
if (g_voteType != voteType:question)
|
||||
if (g_voteType != question)
|
||||
{
|
||||
char title[64];
|
||||
menu.GetTitle(title, sizeof(title));
|
||||
@ -237,18 +239,18 @@ public Handler_VoteCallback(Menu menu, MenuAction action, param1, param2)
|
||||
char buffer[255];
|
||||
Format(buffer, sizeof(buffer), "%T", title, param1, g_voteInfo[VOTE_NAME]);
|
||||
|
||||
Panel panel = Panel:param2;
|
||||
Panel panel = view_as<Panel>(param2);
|
||||
panel.SetTitle(buffer);
|
||||
}
|
||||
}
|
||||
else if (action == MenuAction_DisplayItem)
|
||||
{
|
||||
decl String:display[64];
|
||||
char display[64];
|
||||
menu.GetItem(param2, "", 0, _, display, sizeof(display));
|
||||
|
||||
if (strcmp(display, "No") == 0 || strcmp(display, "Yes") == 0)
|
||||
{
|
||||
decl String:buffer[255];
|
||||
char buffer[255];
|
||||
Format(buffer, sizeof(buffer), "%T", display, param1);
|
||||
|
||||
return RedrawMenuItem(buffer);
|
||||
@ -278,7 +280,7 @@ public Handler_VoteCallback(Menu menu, MenuAction action, param1, param2)
|
||||
|
||||
percent = GetVotePercent(votes, totalVotes);
|
||||
|
||||
if (g_voteType != voteType:question)
|
||||
if (g_voteType != question)
|
||||
{
|
||||
limit = g_Cvar_Limits[g_voteType].FloatValue;
|
||||
}
|
||||
@ -299,7 +301,7 @@ public Handler_VoteCallback(Menu menu, MenuAction action, param1, param2)
|
||||
|
||||
switch (g_voteType)
|
||||
{
|
||||
case (voteType:question):
|
||||
case (question):
|
||||
{
|
||||
if (strcmp(item, VOTE_NO) == 0 || strcmp(item, VOTE_YES) == 0)
|
||||
{
|
||||
@ -309,19 +311,19 @@ public Handler_VoteCallback(Menu menu, MenuAction action, param1, param2)
|
||||
PrintToChatAll("[SM] %t", "Vote End", g_voteArg, item);
|
||||
}
|
||||
|
||||
case (voteType:map):
|
||||
case (map):
|
||||
{
|
||||
// single-vote items don't use the display item
|
||||
char displayName[PLATFORM_MAX_PATH];
|
||||
GetMapDisplayName(item, displayName, sizeof(displayName));
|
||||
LogAction(-1, -1, "Changing map to %s due to vote.", item);
|
||||
PrintToChatAll("[SM] %t", "Changing map", displayName);
|
||||
new Handle:dp;
|
||||
DataPack dp;
|
||||
CreateDataTimer(5.0, Timer_ChangeMap, dp);
|
||||
WritePackString(dp, item);
|
||||
dp.WriteString(item);
|
||||
}
|
||||
|
||||
case (voteType:kick):
|
||||
case (kick):
|
||||
{
|
||||
if (g_voteArg[0] == '\0')
|
||||
{
|
||||
@ -334,7 +336,7 @@ public Handler_VoteCallback(Menu menu, MenuAction action, param1, param2)
|
||||
ServerCommand("kickid %d \"%s\"", g_voteClient[VOTE_USERID], g_voteArg);
|
||||
}
|
||||
|
||||
case (voteType:ban):
|
||||
case (ban):
|
||||
{
|
||||
if (g_voteArg[0] == '\0')
|
||||
{
|
||||
@ -359,11 +361,11 @@ public Handler_VoteCallback(Menu menu, MenuAction action, param1, param2)
|
||||
}
|
||||
|
||||
/*
|
||||
VoteSelect(Handle:menu, param1, param2 = 0)
|
||||
void VoteSelect(Menu menu, int param1, int param2 = 0)
|
||||
{
|
||||
if (GetConVarInt(g_Cvar_VoteShow) == 1)
|
||||
if (g_Cvar_VoteShow.IntValue == 1)
|
||||
{
|
||||
decl String:voter[64], String:junk[64], String:choice[64];
|
||||
char voter[64], junk[64], choice[64];
|
||||
GetClientName(param1, voter, sizeof(voter));
|
||||
menu.GetItem(param2, junk, sizeof(junk), _, choice, sizeof(choice));
|
||||
PrintToChatAll("[SM] %T", "Vote Select", LANG_SERVER, voter, choice);
|
||||
@ -371,20 +373,20 @@ VoteSelect(Handle:menu, param1, param2 = 0)
|
||||
}
|
||||
*/
|
||||
|
||||
VoteMenuClose()
|
||||
void VoteMenuClose()
|
||||
{
|
||||
delete g_hVoteMenu;
|
||||
g_hVoteMenu = null;
|
||||
}
|
||||
|
||||
Float:GetVotePercent(votes, totalVotes)
|
||||
float GetVotePercent(int votes, int totalVotes)
|
||||
{
|
||||
return FloatDiv(float(votes),float(totalVotes));
|
||||
}
|
||||
|
||||
bool:TestVoteDelay(client)
|
||||
bool TestVoteDelay(int client)
|
||||
{
|
||||
new delay = CheckVoteDelay();
|
||||
int delay = CheckVoteDelay();
|
||||
|
||||
if (delay > 0)
|
||||
{
|
||||
@ -403,12 +405,12 @@ bool:TestVoteDelay(client)
|
||||
return true;
|
||||
}
|
||||
|
||||
public Action:Timer_ChangeMap(Handle:timer, Handle:dp)
|
||||
public Action Timer_ChangeMap(Handle timer, DataPack dp)
|
||||
{
|
||||
decl String:mapname[65];
|
||||
char mapname[65];
|
||||
|
||||
ResetPack(dp);
|
||||
ReadPackString(dp, mapname, sizeof(mapname));
|
||||
dp.Reset();
|
||||
dp.ReadString(mapname, sizeof(mapname));
|
||||
|
||||
ForceChangeLevel(mapname, "sm_votemap Result");
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
DisplayVoteBanMenu(client, target)
|
||||
void DisplayVoteBanMenu(int client, int target)
|
||||
{
|
||||
g_voteClient[VOTE_CLIENTID] = target;
|
||||
g_voteClient[VOTE_USERID] = GetClientUserId(target);
|
||||
@ -42,9 +42,9 @@ DisplayVoteBanMenu(client, target)
|
||||
LogAction(client, target, "\"%L\" initiated a ban vote against \"%L\"", client, target);
|
||||
ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Ban", g_voteInfo[VOTE_NAME]);
|
||||
|
||||
g_voteType = voteType:ban;
|
||||
g_voteType = ban;
|
||||
|
||||
g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
|
||||
g_hVoteMenu = new Menu(Handler_VoteCallback, MENU_ACTIONS_ALL);
|
||||
g_hVoteMenu.SetTitle("Voteban Player");
|
||||
g_hVoteMenu.AddItem(VOTE_YES, "Yes");
|
||||
g_hVoteMenu.AddItem(VOTE_NO, "No");
|
||||
@ -52,11 +52,11 @@ DisplayVoteBanMenu(client, target)
|
||||
g_hVoteMenu.DisplayVoteToAll(20);
|
||||
}
|
||||
|
||||
DisplayBanTargetMenu(client)
|
||||
void DisplayBanTargetMenu(int client)
|
||||
{
|
||||
Menu menu = CreateMenu(MenuHandler_Ban);
|
||||
Menu menu = new Menu(MenuHandler_Ban);
|
||||
|
||||
decl String:title[100];
|
||||
char title[100];
|
||||
Format(title, sizeof(title), "%T:", "Ban vote", client);
|
||||
menu.SetTitle(title);
|
||||
menu.ExitBackButton = true;
|
||||
@ -66,12 +66,12 @@ DisplayBanTargetMenu(client)
|
||||
menu.Display(client, MENU_TIME_FOREVER);
|
||||
}
|
||||
|
||||
public AdminMenu_VoteBan(Handle:topmenu,
|
||||
TopMenuAction:action,
|
||||
TopMenuObject:object_id,
|
||||
param,
|
||||
String:buffer[],
|
||||
maxlength)
|
||||
public void AdminMenu_VoteBan(TopMenu topmenu,
|
||||
TopMenuAction action,
|
||||
TopMenuObject object_id,
|
||||
int param,
|
||||
char[] buffer,
|
||||
int maxlength)
|
||||
{
|
||||
if (action == TopMenuAction_DisplayOption)
|
||||
{
|
||||
@ -88,7 +88,7 @@ public AdminMenu_VoteBan(Handle:topmenu,
|
||||
}
|
||||
}
|
||||
|
||||
public MenuHandler_Ban(Menu menu, MenuAction action, int param1, int param2)
|
||||
public int MenuHandler_Ban(Menu menu, MenuAction action, int param1, int param2)
|
||||
{
|
||||
if (action == MenuAction_End)
|
||||
{
|
||||
@ -103,8 +103,8 @@ public MenuHandler_Ban(Menu menu, MenuAction action, int param1, int param2)
|
||||
}
|
||||
else if (action == MenuAction_Select)
|
||||
{
|
||||
decl String:info[32], String:name[32];
|
||||
new userid, target;
|
||||
char info[32], name[32];
|
||||
int userid, target;
|
||||
|
||||
menu.GetItem(param2, info, sizeof(info), _, name, sizeof(name));
|
||||
userid = StringToInt(info);
|
||||
@ -125,7 +125,7 @@ public MenuHandler_Ban(Menu menu, MenuAction action, int param1, int param2)
|
||||
}
|
||||
}
|
||||
|
||||
public Action:Command_Voteban(client, args)
|
||||
public Action Command_Voteban(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -144,10 +144,10 @@ public Action:Command_Voteban(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:text[256], String:arg[64];
|
||||
char text[256], arg[64];
|
||||
GetCmdArgString(text, sizeof(text));
|
||||
|
||||
new len = BreakString(text, arg, sizeof(arg));
|
||||
int len = BreakString(text, arg, sizeof(arg));
|
||||
|
||||
if (len != -1)
|
||||
{
|
||||
@ -158,8 +158,9 @@ public Action:Command_Voteban(client, args)
|
||||
g_voteArg[0] = '\0';
|
||||
}
|
||||
|
||||
decl String:target_name[MAX_TARGET_LENGTH];
|
||||
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
|
||||
char target_name[MAX_TARGET_LENGTH];
|
||||
int target_list[MAXPLAYERS], target_count;
|
||||
bool tn_is_ml;
|
||||
|
||||
if ((target_count = ProcessTargetString(
|
||||
arg,
|
||||
|
@ -31,8 +31,7 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
|
||||
DisplayVoteKickMenu(client, target)
|
||||
void DisplayVoteKickMenu(int client, int target)
|
||||
{
|
||||
g_voteClient[VOTE_CLIENTID] = target;
|
||||
g_voteClient[VOTE_USERID] = GetClientUserId(target);
|
||||
@ -42,22 +41,21 @@ DisplayVoteKickMenu(client, target)
|
||||
LogAction(client, target, "\"%L\" initiated a kick vote against \"%L\"", client, target);
|
||||
ShowActivity(client, "%t", "Initiated Vote Kick", g_voteInfo[VOTE_NAME]);
|
||||
|
||||
g_voteType = voteType:kick;
|
||||
g_voteType = kick;
|
||||
|
||||
g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
|
||||
g_hVoteMenu = new Menu(Handler_VoteCallback, MENU_ACTIONS_ALL);
|
||||
g_hVoteMenu.SetTitle("Votekick Player");
|
||||
g_hVoteMenu.AddItem(VOTE_YES, "Yes");
|
||||
g_hVoteMenu.AddItem(VOTE_NO, "No");
|
||||
g_hVoteMenu.ExitButton = false;
|
||||
g_hVoteMenu.DisplayVoteToAll(20);
|
||||
|
||||
}
|
||||
|
||||
DisplayKickTargetMenu(client)
|
||||
void DisplayKickTargetMenu(int client)
|
||||
{
|
||||
Menu menu = CreateMenu(MenuHandler_Kick);
|
||||
Menu menu = new Menu(MenuHandler_Kick);
|
||||
|
||||
decl String:title[100];
|
||||
char title[100];
|
||||
Format(title, sizeof(title), "%T:", "Kick vote", client);
|
||||
menu.SetTitle(title);
|
||||
menu.ExitBackButton = true;
|
||||
@ -67,12 +65,12 @@ DisplayKickTargetMenu(client)
|
||||
menu.Display(client, MENU_TIME_FOREVER);
|
||||
}
|
||||
|
||||
public AdminMenu_VoteKick(Handle:topmenu,
|
||||
TopMenuAction:action,
|
||||
TopMenuObject:object_id,
|
||||
param,
|
||||
String:buffer[],
|
||||
maxlength)
|
||||
public void AdminMenu_VoteKick(TopMenu topmenu,
|
||||
TopMenuAction action,
|
||||
TopMenuObject object_id,
|
||||
int param,
|
||||
char[] buffer,
|
||||
int maxlength)
|
||||
{
|
||||
if (action == TopMenuAction_DisplayOption)
|
||||
{
|
||||
@ -89,7 +87,7 @@ public AdminMenu_VoteKick(Handle:topmenu,
|
||||
}
|
||||
}
|
||||
|
||||
public MenuHandler_Kick(Menu menu, MenuAction action, int param1, int param2)
|
||||
public int MenuHandler_Kick(Menu menu, MenuAction action, int param1, int param2)
|
||||
{
|
||||
if (action == MenuAction_End)
|
||||
{
|
||||
@ -104,8 +102,8 @@ public MenuHandler_Kick(Menu menu, MenuAction action, int param1, int param2)
|
||||
}
|
||||
else if (action == MenuAction_Select)
|
||||
{
|
||||
decl String:info[32], String:name[32];
|
||||
new userid, target;
|
||||
char info[32], name[32];
|
||||
int userid, target;
|
||||
|
||||
menu.GetItem(param2, info, sizeof(info), _, name, sizeof(name));
|
||||
userid = StringToInt(info);
|
||||
@ -126,7 +124,7 @@ public MenuHandler_Kick(Menu menu, MenuAction action, int param1, int param2)
|
||||
}
|
||||
}
|
||||
|
||||
public Action:Command_Votekick(client, args)
|
||||
public Action Command_Votekick(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -145,12 +143,12 @@ public Action:Command_Votekick(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:text[256], String:arg[64];
|
||||
char text[256], arg[64];
|
||||
GetCmdArgString(text, sizeof(text));
|
||||
|
||||
new len = BreakString(text, arg, sizeof(arg));
|
||||
int len = BreakString(text, arg, sizeof(arg));
|
||||
|
||||
new target = FindTarget(client, arg);
|
||||
int target = FindTarget(client, arg);
|
||||
if (target == -1)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
|
@ -32,19 +32,19 @@
|
||||
*/
|
||||
|
||||
Menu g_MapList;
|
||||
new g_mapCount;
|
||||
int g_mapCount;
|
||||
|
||||
new Handle:g_SelectedMaps;
|
||||
new bool:g_VoteMapInUse;
|
||||
ArrayList g_SelectedMaps;
|
||||
bool g_VoteMapInUse;
|
||||
|
||||
DisplayVoteMapMenu(client, mapCount, String:maps[5][])
|
||||
void DisplayVoteMapMenu(int client, int mapCount, char[][] maps)
|
||||
{
|
||||
LogAction(client, -1, "\"%L\" initiated a map vote.", client);
|
||||
ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Map");
|
||||
|
||||
g_voteType = voteType:map;
|
||||
g_voteType = map;
|
||||
|
||||
g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
|
||||
g_hVoteMenu = new Menu(Handler_VoteCallback, MENU_ACTIONS_ALL);
|
||||
|
||||
if (mapCount == 1)
|
||||
{
|
||||
@ -59,9 +59,9 @@ DisplayVoteMapMenu(client, mapCount, String:maps[5][])
|
||||
g_voteInfo[VOTE_NAME][0] = '\0';
|
||||
|
||||
g_hVoteMenu.SetTitle("Map Vote");
|
||||
for (new i = 0; i < mapCount; i++)
|
||||
for (int i = 0; i < mapCount; i++)
|
||||
{
|
||||
decl String:displayName[PLATFORM_MAX_PATH];
|
||||
char displayName[PLATFORM_MAX_PATH];
|
||||
GetMapDisplayName(maps[i], displayName, sizeof(displayName));
|
||||
g_hVoteMenu.AddItem(maps[i], displayName);
|
||||
}
|
||||
@ -71,29 +71,29 @@ DisplayVoteMapMenu(client, mapCount, String:maps[5][])
|
||||
g_hVoteMenu.DisplayVoteToAll(20);
|
||||
}
|
||||
|
||||
ResetMenu()
|
||||
void ResetMenu()
|
||||
{
|
||||
g_VoteMapInUse = false;
|
||||
ClearArray(g_SelectedMaps);
|
||||
g_SelectedMaps.Clear();
|
||||
}
|
||||
|
||||
ConfirmVote(client)
|
||||
void ConfirmVote(int client)
|
||||
{
|
||||
Menu menu = CreateMenu(MenuHandler_Confirm);
|
||||
Menu menu = new Menu(MenuHandler_Confirm);
|
||||
|
||||
decl String:title[100];
|
||||
char title[100];
|
||||
Format(title, sizeof(title), "%T:", "Confirm Vote", client);
|
||||
menu.SetTitle(title);
|
||||
menu.ExitBackButton = true;
|
||||
|
||||
decl String:itemtext[256];
|
||||
char itemtext[256];
|
||||
Format(itemtext, sizeof(itemtext), "%T", "Start the Vote", client);
|
||||
menu.AddItem("Confirm", itemtext);
|
||||
|
||||
menu.Display(client, MENU_TIME_FOREVER);
|
||||
}
|
||||
|
||||
public MenuHandler_Confirm(Menu menu, MenuAction action, int param1, int param2)
|
||||
public int MenuHandler_Confirm(Menu menu, MenuAction action, int param1, int param2)
|
||||
{
|
||||
if (action == MenuAction_End)
|
||||
{
|
||||
@ -111,12 +111,12 @@ public MenuHandler_Confirm(Menu menu, MenuAction action, int param1, int param2)
|
||||
}
|
||||
else if (action == MenuAction_Select)
|
||||
{
|
||||
decl String:maps[5][PLATFORM_MAX_PATH];
|
||||
new selectedmaps = GetArraySize(g_SelectedMaps);
|
||||
char maps[5][PLATFORM_MAX_PATH];
|
||||
int selectedmaps = g_SelectedMaps.Length;
|
||||
|
||||
for (new i = 0; i < selectedmaps; i++)
|
||||
for (int i = 0; i < selectedmaps; i++)
|
||||
{
|
||||
GetArrayString(g_SelectedMaps, i, maps[i], sizeof(maps[]));
|
||||
g_SelectedMaps.GetString(i, maps[i], sizeof(maps[]));
|
||||
}
|
||||
|
||||
DisplayVoteMapMenu(param1, selectedmaps, maps);
|
||||
@ -125,7 +125,7 @@ public MenuHandler_Confirm(Menu menu, MenuAction action, int param1, int param2)
|
||||
}
|
||||
}
|
||||
|
||||
public MenuHandler_Map(Menu menu, MenuAction action, int param1, int param2)
|
||||
public int MenuHandler_Map(Menu menu, MenuAction action, int param1, int param2)
|
||||
{
|
||||
if (action == MenuAction_Cancel)
|
||||
{
|
||||
@ -141,11 +141,11 @@ public MenuHandler_Map(Menu menu, MenuAction action, int param1, int param2)
|
||||
}
|
||||
else if (action == MenuAction_DrawItem)
|
||||
{
|
||||
decl String:info[32], String:name[32];
|
||||
char info[32], name[32];
|
||||
|
||||
menu.GetItem(param2, info, sizeof(info), _, name, sizeof(name));
|
||||
|
||||
if (FindStringInArray(g_SelectedMaps, info) != -1)
|
||||
if (g_SelectedMaps.FindString(info) != -1)
|
||||
{
|
||||
return ITEMDRAW_IGNORE;
|
||||
}
|
||||
@ -156,14 +156,14 @@ public MenuHandler_Map(Menu menu, MenuAction action, int param1, int param2)
|
||||
}
|
||||
else if (action == MenuAction_Select)
|
||||
{
|
||||
decl String:info[32], String:name[32];
|
||||
char info[32], name[32];
|
||||
|
||||
menu.GetItem(param2, info, sizeof(info), _, name, sizeof(name));
|
||||
|
||||
PushArrayString(g_SelectedMaps, info);
|
||||
g_SelectedMaps.PushString(info);
|
||||
|
||||
/* Redisplay the list */
|
||||
if (GetArraySize(g_SelectedMaps) < 5)
|
||||
if (g_SelectedMaps.Length < 5)
|
||||
{
|
||||
g_MapList.Display(param1, MENU_TIME_FOREVER);
|
||||
}
|
||||
@ -174,20 +174,22 @@ public MenuHandler_Map(Menu menu, MenuAction action, int param1, int param2)
|
||||
}
|
||||
else if (action == MenuAction_Display)
|
||||
{
|
||||
decl String:title[128];
|
||||
char title[128];
|
||||
Format(title, sizeof(title), "%T", "Please select a map", param1);
|
||||
SetPanelTitle(Handle:param2, title);
|
||||
|
||||
Panel panel = view_as<Panel>(param2);
|
||||
panel.SetTitle(title);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public AdminMenu_VoteMap(Handle:topmenu,
|
||||
TopMenuAction:action,
|
||||
TopMenuObject:object_id,
|
||||
param,
|
||||
String:buffer[],
|
||||
maxlength)
|
||||
public void AdminMenu_VoteMap(TopMenu topmenu,
|
||||
TopMenuAction action,
|
||||
TopMenuObject object_id,
|
||||
int param,
|
||||
char[] buffer,
|
||||
int maxlength)
|
||||
{
|
||||
if (action == TopMenuAction_DisplayOption)
|
||||
{
|
||||
@ -213,7 +215,7 @@ public AdminMenu_VoteMap(Handle:topmenu,
|
||||
}
|
||||
}
|
||||
|
||||
public Action:Command_Votemap(client, args)
|
||||
public Action Command_Votemap(int client, int args)
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
@ -232,12 +234,12 @@ public Action:Command_Votemap(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:text[256];
|
||||
char text[256];
|
||||
GetCmdArgString(text, sizeof(text));
|
||||
|
||||
decl String:maps[5][PLATFORM_MAX_PATH];
|
||||
new mapCount;
|
||||
new len, pos;
|
||||
char maps[5][PLATFORM_MAX_PATH];
|
||||
int mapCount;
|
||||
int len, pos;
|
||||
|
||||
while (pos != -1 && mapCount < 5)
|
||||
{
|
||||
@ -262,12 +264,12 @@ public Action:Command_Votemap(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
new Handle:g_map_array = null;
|
||||
new g_map_serial = -1;
|
||||
Handle g_map_array = null;
|
||||
int g_map_serial = -1;
|
||||
|
||||
int LoadMapList(Menu menu)
|
||||
{
|
||||
new Handle:map_array;
|
||||
Handle map_array;
|
||||
|
||||
if ((map_array = ReadMapList(g_map_array,
|
||||
g_map_serial,
|
||||
@ -283,14 +285,14 @@ int LoadMapList(Menu menu)
|
||||
return 0;
|
||||
}
|
||||
|
||||
RemoveAllMenuItems(menu);
|
||||
menu.RemoveAllItems();
|
||||
|
||||
char map_name[PLATFORM_MAX_PATH];
|
||||
new map_count = GetArraySize(g_map_array);
|
||||
int map_count = GetArraySize(g_map_array);
|
||||
|
||||
for (new i = 0; i < map_count; i++)
|
||||
for (int i = 0; i < map_count; i++)
|
||||
{
|
||||
decl String:displayName[PLATFORM_MAX_PATH];
|
||||
char displayName[PLATFORM_MAX_PATH];
|
||||
GetArrayString(g_map_array, i, map_name, sizeof(map_name));
|
||||
GetMapDisplayName(map_name, displayName, sizeof(displayName));
|
||||
menu.AddItem(map_name, displayName);
|
||||
|
Loading…
Reference in New Issue
Block a user