Update base plugins for transitional syntax (#507)

This commit is contained in:
ErikMinekus
2016-05-11 10:44:58 -04:00
committed by Nicholas Hastings
parent e8734ccf28
commit d9fb0ba64e
18 changed files with 483 additions and 465 deletions
+8 -9
View File
@@ -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;
}
+19 -17
View File
@@ -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);
+24 -23
View File
@@ -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)
+26 -24
View File
@@ -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);
+8 -8
View File
@@ -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);
+33 -33
View File
@@ -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;