Update plugins for transitional methods.

This commit is contained in:
David Anderson 2014-11-15 16:30:45 -08:00
parent 722a23c818
commit 1328984e0b
48 changed files with 620 additions and 620 deletions

View File

@ -58,7 +58,7 @@ public OnRebuildAdminCache(AdminCachePart:part)
db = SQL_Connect("default", true, error, sizeof(error));
}
if (db == INVALID_HANDLE)
if (db == null)
{
LogError("Could not connect to database \"default\": %s", error);
return;
@ -73,7 +73,7 @@ public OnRebuildAdminCache(AdminCachePart:part)
FetchUsers(db);
}
CloseHandle(db);
delete db;
}
FetchUsers(Handle:db)
@ -82,7 +82,7 @@ FetchUsers(Handle:db)
new Handle:hQuery;
Format(query, sizeof(query), "SELECT id, authtype, identity, password, flags, name, immunity FROM sm_admins");
if ((hQuery = SQL_Query(db, query)) == INVALID_HANDLE)
if ((hQuery = SQL_Query(db, query)) == null)
{
SQL_GetError(db, error, sizeof(error));
LogError("FetchUsers() query failed: %s", query);
@ -155,7 +155,7 @@ FetchUsers(Handle:db)
new Handle:hGroupQuery;
Format(query, sizeof(query), "SELECT ag.admin_id AS id, g.name FROM sm_admins_groups ag JOIN sm_groups g ON ag.group_id = g.id ORDER BY id, inherit_order ASC");
if ((hGroupQuery = SQL_Query(db, query)) == INVALID_HANDLE)
if ((hGroupQuery = SQL_Query(db, query)) == null)
{
SQL_GetError(db, error, sizeof(error));
LogError("FetchUsers() query failed: %s", query);
@ -181,9 +181,9 @@ FetchUsers(Handle:db)
}
}
CloseHandle(hQuery);
CloseHandle(hGroupQuery);
CloseHandle(htAdmins);
delete hQuery;
delete hGroupQuery;
delete htAdmins;
}
FetchGroups(Handle:db)
@ -193,7 +193,7 @@ FetchGroups(Handle:db)
Format(query, sizeof(query), "SELECT flags, name, immunity_level FROM sm_groups");
if ((hQuery = SQL_Query(db, query)) == INVALID_HANDLE)
if ((hQuery = SQL_Query(db, query)) == null)
{
decl String:error[255];
SQL_GetError(db, error, sizeof(error));
@ -239,7 +239,7 @@ FetchGroups(Handle:db)
SetAdmGroupImmunityLevel(gid, immunity);
}
CloseHandle(hQuery);
delete hQuery;
/**
* Get immunity in a big lump. This is a nasty query but it gets the job done.
@ -249,7 +249,7 @@ FetchGroups(Handle:db)
len += Format(query[len], sizeof(query)-len, " LEFT JOIN sm_groups g1 ON g1.id = gi.group_id ");
len += Format(query[len], sizeof(query)-len, " LEFT JOIN sm_groups g2 ON g2.id = gi.other_id");
if ((hQuery = SQL_Query(db, query)) == INVALID_HANDLE)
if ((hQuery = SQL_Query(db, query)) == null)
{
decl String:error[255];
SQL_GetError(db, error, sizeof(error));
@ -279,14 +279,14 @@ FetchGroups(Handle:db)
#endif
}
CloseHandle(hQuery);
delete hQuery;
/**
* Fetch overrides in a lump query.
*/
Format(query, sizeof(query), "SELECT g.name, go.type, go.name, go.access FROM sm_group_overrides go LEFT JOIN sm_groups g ON go.group_id = g.id");
if ((hQuery = SQL_Query(db, query)) == INVALID_HANDLE)
if ((hQuery = SQL_Query(db, query)) == null)
{
decl String:error[255];
SQL_GetError(db, error, sizeof(error));
@ -330,7 +330,7 @@ FetchGroups(Handle:db)
AddAdmGroupCmdOverride(gid, cmd, o_type, o_rule);
}
CloseHandle(hQuery);
delete hQuery;
}
FetchOverrides(Handle:db)
@ -340,7 +340,7 @@ FetchOverrides(Handle:db)
Format(query, sizeof(query), "SELECT type, name, flags FROM sm_overrides");
if ((hQuery = SQL_Query(db, query)) == INVALID_HANDLE)
if ((hQuery = SQL_Query(db, query)) == null)
{
decl String:error[255];
SQL_GetError(db, error, sizeof(error));
@ -372,6 +372,6 @@ FetchOverrides(Handle:db)
}
}
CloseHandle(hQuery);
delete hQuery;
}

View File

@ -67,7 +67,7 @@ public Plugin:myinfo =
* powers.
*/
new Handle:hDatabase = INVALID_HANDLE; /** Database connection */
new Handle:hDatabase = null; /** Database connection */
new g_sequence = 0; /** Global unique sequence number */
new ConnectLock = 0; /** Connect sequence number */
new RebuildCachePart[3] = {0}; /** Cache part sequence numbers */
@ -81,10 +81,10 @@ public OnMapEnd()
/**
* Clean up on map end just so we can start a fresh connection when we need it later.
*/
if (hDatabase != INVALID_HANDLE)
if (hDatabase != null)
{
CloseHandle(hDatabase);
hDatabase = INVALID_HANDLE;
delete hDatabase;
hDatabase = null;
}
}
@ -110,11 +110,11 @@ public OnDatabaseConnect(Handle:owner, Handle:hndl, const String:error[], any:da
/**
* If this happens to be an old connection request, ignore it.
*/
if (data != ConnectLock || hDatabase != INVALID_HANDLE)
if (data != ConnectLock || hDatabase != null)
{
if (hndl != INVALID_HANDLE)
if (hndl != null)
{
CloseHandle(hndl);
delete hndl;
}
return;
}
@ -126,7 +126,7 @@ public OnDatabaseConnect(Handle:owner, Handle:hndl, const String:error[], any:da
* See if the connection is valid. If not, don't un-mark the caches
* as needing rebuilding, in case the next connection request works.
*/
if (hDatabase == INVALID_HANDLE)
if (hDatabase == null)
{
LogError("Failed to connect to database: %s", error);
return;
@ -206,7 +206,7 @@ public Action:OnClientPreAdminCheck(client)
* we just have to hope either the database is waiting or someone will type
* sm_reloadadmins.
*/
if (hDatabase == INVALID_HANDLE)
if (hDatabase == null)
{
return Plugin_Continue;
}
@ -248,7 +248,7 @@ public OnReceiveUserGroups(Handle:owner, Handle:hndl, const String:error[], any:
*/
if (PlayerSeq[client] != sequence)
{
CloseHandle(pk);
delete pk;
return;
}
@ -260,21 +260,21 @@ public OnReceiveUserGroups(Handle:owner, Handle:hndl, const String:error[], any:
if (GetUserAdmin(client) != adm)
{
NotifyPostAdminCheck(client);
CloseHandle(pk);
delete pk;
return;
}
/**
* See if we got results.
*/
if (hndl == INVALID_HANDLE)
if (hndl == null)
{
decl String:query[255];
ReadPackString(pk, query, sizeof(query));
LogError("SQL error receiving user: %s", error);
LogError("Query dump: %s", query);
NotifyPostAdminCheck(client);
CloseHandle(pk);
delete pk;
return;
}
@ -301,7 +301,7 @@ public OnReceiveUserGroups(Handle:owner, Handle:hndl, const String:error[], any:
* We're DONE! Omg.
*/
NotifyPostAdminCheck(client);
CloseHandle(pk);
delete pk;
}
public OnReceiveUser(Handle:owner, Handle:hndl, const String:error[], any:data)
@ -318,14 +318,14 @@ public OnReceiveUser(Handle:owner, Handle:hndl, const String:error[], any:data)
if (PlayerSeq[client] != sequence)
{
/* Discard everything, since we're out of sequence. */
CloseHandle(pk);
delete pk;
return;
}
/**
* If we need to use the results, make sure they succeeded.
*/
if (hndl == INVALID_HANDLE)
if (hndl == null)
{
decl String:query[255];
ReadPackString(pk, query, sizeof(query));
@ -333,7 +333,7 @@ public OnReceiveUser(Handle:owner, Handle:hndl, const String:error[], any:data)
LogError("Query dump: %s", query);
RunAdminCacheChecks(client);
NotifyPostAdminCheck(client);
CloseHandle(pk);
delete pk;
return;
}
@ -342,7 +342,7 @@ public OnReceiveUser(Handle:owner, Handle:hndl, const String:error[], any:data)
{
RunAdminCacheChecks(client);
NotifyPostAdminCheck(client);
CloseHandle(pk);
delete pk;
return;
}
@ -443,7 +443,7 @@ public OnReceiveUser(Handle:owner, Handle:hndl, const String:error[], any:data)
if (!id || !group_count)
{
NotifyPostAdminCheck(client);
CloseHandle(pk);
delete pk;
return;
}
@ -553,25 +553,25 @@ public OnReceiveGroupImmunity(Handle:owner, Handle:hndl, const String:error[], a
if (RebuildCachePart[_:AdminCache_Groups] != sequence)
{
/* Discard everything, since we're out of sequence. */
CloseHandle(pk);
delete pk;
return;
}
/**
* If we need to use the results, make sure they succeeded.
*/
if (hndl == INVALID_HANDLE)
if (hndl == null)
{
decl String:query[255];
ReadPackString(pk, query, sizeof(query));
LogError("SQL error receiving group immunity: %s", error);
LogError("Query dump: %s", query);
CloseHandle(pk);
delete pk;
return;
}
/* We're done with the pack forever. */
CloseHandle(pk);
delete pk;
while (SQL_FetchRow(hndl))
{
@ -610,20 +610,20 @@ public OnReceiveGroupOverrides(Handle:owner, Handle:hndl, const String:error[],
if (RebuildCachePart[_:AdminCache_Groups] != sequence)
{
/* Discard everything, since we're out of sequence. */
CloseHandle(pk);
delete pk;
return;
}
/**
* If we need to use the results, make sure they succeeded.
*/
if (hndl == INVALID_HANDLE)
if (hndl == null)
{
decl String:query[255];
ReadPackString(pk, query, sizeof(query));
LogError("SQL error receiving group overrides: %s", error);
LogError("Query dump: %s", query);
CloseHandle(pk);
delete pk;
return;
}
@ -696,20 +696,20 @@ public OnReceiveGroups(Handle:owner, Handle:hndl, const String:error[], any:data
if (RebuildCachePart[_:AdminCache_Groups] != sequence)
{
/* Discard everything, since we're out of sequence. */
CloseHandle(pk);
delete pk;
return;
}
/**
* If we need to use the results, make sure they succeeded.
*/
if (hndl == INVALID_HANDLE)
if (hndl == null)
{
decl String:query[255];
ReadPackString(pk, query, sizeof(query));
LogError("SQL error receiving groups: %s", error);
LogError("Query dump: %s", query);
CloseHandle(pk);
delete pk;
return;
}
@ -792,27 +792,27 @@ public OnReceiveOverrides(Handle:owner, Handle:hndl, const String:error[], any:d
if (RebuildCachePart[_:AdminCache_Overrides] != sequence)
{
/* Discard everything, since we're out of sequence. */
CloseHandle(pk);
delete pk;
return;
}
/**
* If we need to use the results, make sure they succeeded.
*/
if (hndl == INVALID_HANDLE)
if (hndl == null)
{
decl String:query[255];
ReadPackString(pk, query, sizeof(query));
LogError("SQL error receiving overrides: %s", error);
LogError("Query dump: %s", query);
CloseHandle(pk);
delete pk;
return;
}
/**
* We're done with you, now.
*/
CloseHandle(pk);
delete pk;
decl String:type[64];
decl String:name[64];

View File

@ -118,7 +118,7 @@ public Action:HelpCmd(client, args)
if (i == 0)
{
PrintToConsole(client, "%t", "No commands available");
CloseHandle(CmdIter);
delete CmdIter;
return Plugin_Handled;
}
}
@ -149,7 +149,7 @@ public Action:HelpCmd(client, args)
}
}
CloseHandle(CmdIter);
delete CmdIter;
return Plugin_Handled;
}

View File

@ -46,8 +46,8 @@ public Plugin:myinfo =
};
/* Forwards */
new Handle:hOnAdminMenuReady = INVALID_HANDLE;
new Handle:hOnAdminMenuCreated = INVALID_HANDLE;
new Handle:hOnAdminMenuReady = null;
new Handle:hOnAdminMenuCreated = null;
/* Menus */
TopMenu hAdminMenu;
@ -182,7 +182,7 @@ public __AddTargetsToMenu2(Handle:plugin, numParams)
return UTIL_AddTargetsToMenu2(GetNativeCell(1), GetNativeCell(2), GetNativeCell(3));
}
public Action:Command_DisplayMenu(client, args)
public Action:Command_DisplayMenu(int client, int args)
{
if (client == 0)
{
@ -194,11 +194,11 @@ public Action:Command_DisplayMenu(client, args)
return Plugin_Handled;
}
stock UTIL_AddTargetsToMenu2(Handle:menu, source_client, flags)
stock int UTIL_AddTargetsToMenu2(Menu menu, source_client, flags)
{
decl String:user_id[12];
decl String:name[MAX_NAME_LENGTH];
decl String:display[MAX_NAME_LENGTH+12];
char user_id[12];
char name[MAX_NAME_LENGTH];
char display[MAX_NAME_LENGTH+12];
new num_clients;
@ -242,14 +242,14 @@ stock UTIL_AddTargetsToMenu2(Handle:menu, source_client, flags)
IntToString(GetClientUserId(i), user_id, sizeof(user_id));
GetClientName(i, name, sizeof(name));
Format(display, sizeof(display), "%s (%s)", name, user_id);
AddMenuItem(menu, user_id, display);
menu.AddItem(user_id, display);
num_clients++;
}
return num_clients;
}
stock UTIL_AddTargetsToMenu(Handle:menu, source_client, bool:in_game_only, bool:alive_only)
stock UTIL_AddTargetsToMenu(Menu menu, source_client, bool:in_game_only, bool:alive_only)
{
new flags = 0;

View File

@ -336,7 +336,7 @@ ParseConfigs()
CloseHandle(g_groupList[groupListName]);
}
if (g_groupList[groupListCommand] != INVALID_HANDLE)
if (g_groupList[groupListCommand] != null)
{
CloseHandle(g_groupList[groupListCommand]);
}
@ -457,8 +457,8 @@ public ParamCheck(client)
{
GetArrayArray(outputItem[Item_submenus], g_currentPlace[client][Place_ReplaceNum] - 1, outputSubmenu[0]);
new Handle:itemMenu = CreateMenu(Menu_Selection);
SetMenuExitBackButton(itemMenu, true);
Menu itemMenu = CreateMenu(Menu_Selection);
itemMenu.ExitBackButton = true;
if ((outputSubmenu[Submenu_type] == SubMenu_Group) || (outputSubmenu[Submenu_type] == SubMenu_GroupPlayer))
{
@ -469,7 +469,7 @@ public ParamCheck(client)
{
GetArrayString(g_groupList[groupListName], i, nameBuffer, sizeof(nameBuffer));
GetArrayString(g_groupList[groupListCommand], i, commandBuffer, sizeof(commandBuffer));
AddMenuItem(itemMenu, commandBuffer, nameBuffer);
itemMenu.AddItem(commandBuffer, nameBuffer);
}
}
@ -490,7 +490,7 @@ public ParamCheck(client)
if (IsMapValid(readData))
{
AddMenuItem(itemMenu, readData, readData);
itemMenu.AddItem(readData, readData);
}
}
}
@ -516,32 +516,32 @@ public ParamCheck(client)
{
new userid = GetClientUserId(i);
Format(infoBuffer, sizeof(infoBuffer), "#%i", userid);
AddMenuItem(itemMenu, infoBuffer, nameBuffer);
itemMenu.AddItem(infoBuffer, nameBuffer);
}
case UserId2:
{
new userid = GetClientUserId(i);
Format(infoBuffer, sizeof(infoBuffer), "%i", userid);
AddMenuItem(itemMenu, infoBuffer, nameBuffer);
itemMenu.AddItem(infoBuffer, nameBuffer);
}
case SteamId:
{
if (GetClientAuthId(i, AuthId_Steam2, infoBuffer, sizeof(infoBuffer)))
AddMenuItem(itemMenu, infoBuffer, nameBuffer);
itemMenu.AddItem(infoBuffer, nameBuffer);
}
case IpAddress:
{
GetClientIP(i, infoBuffer, sizeof(infoBuffer));
AddMenuItem(itemMenu, infoBuffer, nameBuffer);
itemMenu.AddItem(infoBuffer, nameBuffer);
}
case Name:
{
AddMenuItem(itemMenu, nameBuffer, nameBuffer);
itemMenu.AddItem(nameBuffer, nameBuffer);
}
default: //assume client id
{
Format(temp,3,"%i",i);
AddMenuItem(itemMenu, temp, nameBuffer);
itemMenu.AddItem(temp, nameBuffer);
}
}
}
@ -549,8 +549,8 @@ public ParamCheck(client)
}
else if (outputSubmenu[Submenu_type] == SubMenu_OnOff)
{
AddMenuItem(itemMenu, "1", "On");
AddMenuItem(itemMenu, "0", "Off");
itemMenu.AddItem("1", "On");
itemMenu.AddItem("0", "Off");
}
else
{
@ -567,16 +567,16 @@ public ParamCheck(client)
if (CheckCommandAccess(client, admin, 0))
{
AddMenuItem(itemMenu, value, text);
itemMenu.AddItem(value, text);
}
}
ResetPack(outputSubmenu[Submenu_listdata]);
}
SetMenuTitle(itemMenu, outputSubmenu[Submenu_title]);
itemMenu.SetTitle(outputSubmenu[Submenu_title]);
DisplayMenu(itemMenu, client, MENU_TIME_FOREVER);
itemMenu.Display(client, MENU_TIME_FOREVER);
}
else
{
@ -602,11 +602,11 @@ public ParamCheck(client)
}
}
public Menu_Selection(Handle:menu, MenuAction:action, param1, param2)
public Menu_Selection(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
if (action == MenuAction_Select)
@ -614,7 +614,7 @@ public Menu_Selection(Handle:menu, MenuAction:action, param1, param2)
new String:unquotedinfo[NAME_LENGTH];
/* Get item info */
new bool:found = GetMenuItem(menu, param2, unquotedinfo, sizeof(unquotedinfo));
new bool:found = menu.GetItem(param2, unquotedinfo, sizeof(unquotedinfo));
if (!found)
{

View File

@ -83,49 +83,49 @@ PrepareBan(client, target, time, const String:reason[])
DisplayBanTargetMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_BanPlayerList);
Menu menu = CreateMenu(MenuHandler_BanPlayerList);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Ban player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu2(menu, client, COMMAND_FILTER_NO_BOTS|COMMAND_FILTER_CONNECTED);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
DisplayBanTimeMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_BanTimeList);
Menu menu = CreateMenu(MenuHandler_BanTimeList);
decl String:title[100];
Format(title, sizeof(title), "%T: %N", "Ban player", client, g_BanTarget[client]);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddMenuItem(menu, "0", "Permanent");
AddMenuItem(menu, "10", "10 Minutes");
AddMenuItem(menu, "30", "30 Minutes");
AddMenuItem(menu, "60", "1 Hour");
AddMenuItem(menu, "240", "4 Hours");
AddMenuItem(menu, "1440", "1 Day");
AddMenuItem(menu, "10080", "1 Week");
menu.AddItem("0", "Permanent");
menu.AddItem("10", "10 Minutes");
menu.AddItem("30", "30 Minutes");
menu.AddItem("60", "1 Hour");
menu.AddItem("240", "4 Hours");
menu.AddItem("1440", "1 Day");
menu.AddItem("10080", "1 Week");
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
DisplayBanReasonMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_BanReasonList);
Menu menu = CreateMenu(MenuHandler_BanReasonList);
decl String:title[100];
Format(title, sizeof(title), "%T: %N", "Ban reason", client, g_BanTarget[client]);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
//Add custom chat reason entry first
AddMenuItem(menu, "", "Custom reason (type in chat)");
menu.AddItem("", "Custom reason (type in chat)");
//Loading configurable entries from the kv-file
decl String:reasonName[100];
@ -139,14 +139,14 @@ DisplayBanReasonMenu(client)
g_hKvBanReasons.GetString(NULL_STRING, reasonFull, sizeof(reasonFull));
//Add entry
AddMenuItem(menu, reasonFull, reasonName);
menu.AddItem(reasonFull, reasonName);
} while (g_hKvBanReasons.GotoNextKey(false));
//Reset kvHandle
g_hKvBanReasons.Rewind();
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public AdminMenu_Ban(Handle:topmenu,
@ -169,11 +169,11 @@ public AdminMenu_Ban(Handle:topmenu,
}
}
public MenuHandler_BanReasonList(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_BanReasonList(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -194,18 +194,18 @@ public MenuHandler_BanReasonList(Handle:menu, MenuAction:action, param1, param2)
{
decl String:info[64];
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
PrepareBan(param1, g_BanTarget[param1], g_BanTime[param1], info);
}
}
}
public MenuHandler_BanPlayerList(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_BanPlayerList(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -219,7 +219,7 @@ public MenuHandler_BanPlayerList(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32], String:name[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
menu.GetItem(param2, info, sizeof(info), _, name, sizeof(name));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)
@ -239,11 +239,11 @@ public MenuHandler_BanPlayerList(Handle:menu, MenuAction:action, param1, param2)
}
}
public MenuHandler_BanTimeList(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_BanTimeList(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -256,7 +256,7 @@ public MenuHandler_BanTimeList(Handle:menu, MenuAction:action, param1, param2)
{
decl String:info[32];
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
g_BanTime[param1] = StringToInt(info);
DisplayBanReasonMenu(param1);

View File

@ -393,15 +393,15 @@ SendPrivateChat(client, target, const String:message[])
LogAction(client, -1, "\"%L\" triggered sm_psay to \"%L\" (text %s)", client, target, message);
}
SendPanelToAll(from, String:message[])
void SendPanelToAll(int from, char[] message)
{
decl String:title[100];
char title[100];
Format(title, 64, "%N:", from);
ReplaceString(message, 192, "\\n", "\n");
new Handle:mSayPanel = CreatePanel();
SetPanelTitle(mSayPanel, title);
Panel mSayPanel = CreatePanel();
mSayPanel.SetTitle(title);
DrawPanelItem(mSayPanel, "", ITEMDRAW_SPACER);
DrawPanelText(mSayPanel, message);
DrawPanelItem(mSayPanel, "", ITEMDRAW_SPACER);
@ -417,10 +417,10 @@ SendPanelToAll(from, String:message[])
}
}
CloseHandle(mSayPanel);
delete mSayPanel;
}
public Handler_DoNothing(Handle:menu, MenuAction:action, param1, param2)
public Handler_DoNothing(Menu menu, MenuAction action, int param1, int param2)
{
/* Do nothing */
}

View File

@ -35,7 +35,7 @@
{
static Handle:hForward;
if(hForward == INVALID_HANDLE)
if(hForward == null)
{
hForward = CreateGlobalForward("BaseComm_OnClientMute", ET_Ignore, Param_Cell, Param_Cell);
}
@ -50,7 +50,7 @@
{
static Handle:hForward;
if(hForward == INVALID_HANDLE)
if(hForward == null)
{
hForward = CreateGlobalForward("BaseComm_OnClientGag", ET_Ignore, Param_Cell, Param_Cell);
}

View File

@ -43,12 +43,12 @@ enum CommType
DisplayGagTypesMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_GagTypes);
Menu menu = CreateMenu(MenuHandler_GagTypes);
decl String:title[100];
Format(title, sizeof(title), "%T: %N", "Choose Type", client, g_GagTarget[client]);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
new target = g_GagTarget[client];
@ -79,28 +79,28 @@ DisplayGagTypesMenu(client)
AddTranslatedMenuItem(menu, "5", "UnSilence Player", client);
}
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
AddTranslatedMenuItem(Handle:menu, const String:opt[], const String:phrase[], client)
void AddTranslatedMenuItem(Menu menu, const char[] opt, const char[] phrase, int client)
{
decl String:buffer[128];
char buffer[128];
Format(buffer, sizeof(buffer), "%T", phrase, client);
AddMenuItem(menu, opt, buffer);
menu.AddItem(opt, buffer);
}
DisplayGagPlayerMenu(client)
void DisplayGagPlayerMenu(int client)
{
new Handle:menu = CreateMenu(MenuHandler_GagPlayer);
Menu menu = CreateMenu(MenuHandler_GagPlayer);
decl String:title[100];
char title[100];
Format(title, sizeof(title), "%T:", "Gag/Mute player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, false);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public AdminMenu_Gag(Handle:topmenu,
@ -120,11 +120,11 @@ public AdminMenu_Gag(Handle:topmenu,
}
}
public MenuHandler_GagPlayer(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_GagPlayer(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -138,7 +138,7 @@ public MenuHandler_GagPlayer(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)
@ -157,11 +157,11 @@ public MenuHandler_GagPlayer(Handle:menu, MenuAction:action, param1, param2)
}
}
public MenuHandler_GagTypes(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_GagTypes(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -175,7 +175,7 @@ public MenuHandler_GagTypes(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32];
new CommType:type;
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
type = CommType:StringToInt(info);
decl String:name[MAX_NAME_LENGTH];

View File

@ -48,7 +48,7 @@ public Plugin:myinfo =
TopMenu hTopMenu;
new Handle:g_MapList;
Menu g_MapList;
new Handle:g_ProtectedVars;
#include "basecommands/kick.sp"
@ -82,8 +82,8 @@ public OnPluginStart()
}
g_MapList = CreateMenu(MenuHandler_ChangeMap, MenuAction_Display);
SetMenuTitle(g_MapList, "%T", "Please select a map", LANG_SERVER);
SetMenuExitBackButton(g_MapList, true);
g_MapList.SetTitle("%T", "Please select a map", LANG_SERVER);
g_MapList.ExitBackButton = true;
char mapListPath[PLATFORM_MAX_PATH];
BuildPath(Path_SM, mapListPath, sizeof(mapListPath), "configs/adminmenu_maplist.ini");
@ -284,7 +284,7 @@ public Action:Command_Cvar(client, args)
}
ConVar hndl = FindConVar(cvarname);
if (hndl == INVALID_HANDLE)
if (hndl == null)
{
ReplyToCommand(client, "[SM] %t", "Unable to find cvar", cvarname);
return Plugin_Handled;
@ -336,7 +336,7 @@ public Action:Command_ResetCvar(client, args)
GetCmdArg(1, cvarname, sizeof(cvarname));
ConVar hndl = FindConVar(cvarname);
if (hndl == INVALID_HANDLE)
if (hndl == null)
{
ReplyToCommand(client, "[SM] %t", "Unable to find cvar", cvarname);
return Plugin_Handled;

View File

@ -31,7 +31,7 @@
* Version: $Id$
*/
new Handle:g_ConfigMenu = INVALID_HANDLE;
Menu g_ConfigMenu = null;
PerformExec(client, String:path[])
{
@ -61,11 +61,11 @@ public AdminMenu_ExecCFG(Handle:topmenu,
}
else if (action == TopMenuAction_SelectOption)
{
DisplayMenu(g_ConfigMenu, param, MENU_TIME_FOREVER);
g_ConfigMenu.Display(param, MENU_TIME_FOREVER);
}
}
public MenuHandler_ExecCFG(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_ExecCFG(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_Cancel)
{
@ -78,7 +78,7 @@ public MenuHandler_ExecCFG(Handle:menu, MenuAction:action, param1, param2)
{
decl String:path[256];
GetMenuItem(menu, param2, path, sizeof(path));
menu.GetItem(param2, path, sizeof(path));
PerformExec(param1, path);
}
@ -116,14 +116,14 @@ ParseConfigs()
config_parser.OnLeaveSection = EndSection;
config_parser.OnKeyValue = KeyValue;
if (g_ConfigMenu != INVALID_HANDLE)
if (g_ConfigMenu != null)
{
CloseHandle(g_ConfigMenu);
delete g_ConfigMenu;
}
g_ConfigMenu = CreateMenu(MenuHandler_ExecCFG, MenuAction_Display);
SetMenuTitle(g_ConfigMenu, "%T", "Choose Config", LANG_SERVER);
SetMenuExitBackButton(g_ConfigMenu, true);
g_ConfigMenu.SetTitle("%T", "Choose Config", LANG_SERVER);
g_ConfigMenu.ExitBackButton = true;
decl String:configPath[256];
BuildPath(Path_SM, configPath, sizeof(configPath), "configs/adminmenu_cfgs.txt");
@ -155,7 +155,7 @@ public SMCResult NewSection(SMCParser smc, const char[] name, bool opt_quotes)
public SMCResult KeyValue(SMCParser smc, const char[] key, const char[] value, bool key_quotes, bool value_quotes)
{
AddMenuItem(g_ConfigMenu, key, value);
g_ConfigMenu.AddItem(key, value);
}
public SMCResult EndSection(SMCParser smc)

View File

@ -47,16 +47,16 @@ PerformKick(client, target, const String:reason[])
DisplayKickMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_Kick);
Menu menu = CreateMenu(MenuHandler_Kick);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Kick player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, false, false);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public AdminMenu_Kick(Handle:topmenu,
@ -76,11 +76,11 @@ public AdminMenu_Kick(Handle:topmenu,
}
}
public MenuHandler_Kick(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_Kick(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -94,7 +94,7 @@ public MenuHandler_Kick(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)

View File

@ -31,7 +31,7 @@
* Version: $Id$
*/
public MenuHandler_ChangeMap(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_ChangeMap(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_Cancel)
{
@ -44,7 +44,7 @@ public MenuHandler_ChangeMap(Handle:menu, MenuAction:action, param1, param2)
{
decl String:map[64];
GetMenuItem(menu, param2, map, sizeof(map));
menu.GetItem(param2, map, sizeof(map));
ShowActivity2(param1, "[SM] ", "%t", "Changing map", map);
@ -75,7 +75,7 @@ public AdminMenu_Map(Handle:topmenu,
}
else if (action == TopMenuAction_SelectOption)
{
DisplayMenu(g_MapList, param, MENU_TIME_FOREVER);
g_MapList.Display(param, MENU_TIME_FOREVER);
}
}
@ -119,10 +119,10 @@ public Action:Timer_ChangeMap(Handle:timer, Handle:dp)
return Plugin_Stop;
}
new Handle:g_map_array = INVALID_HANDLE;
new Handle:g_map_array = null;
new g_map_serial = -1;
LoadMapList(Handle:menu)
int LoadMapList(Menu menu)
{
new Handle:map_array;
@ -130,25 +130,25 @@ LoadMapList(Handle:menu)
g_map_serial,
"sm_map menu",
MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_NO_DEFAULT|MAPLIST_FLAG_MAPSFOLDER))
!= INVALID_HANDLE)
!= null)
{
g_map_array = map_array;
}
if (g_map_array == INVALID_HANDLE)
if (g_map_array == null)
{
return 0;
}
RemoveAllMenuItems(menu);
decl String:map_name[64];
new map_count = GetArraySize(g_map_array);
char map_name[64];
int map_count = GetArraySize(g_map_array);
for (new i = 0; i < map_count; i++)
for (int i = 0; i < map_count; i++)
{
GetArrayString(g_map_array, i, map_name, sizeof(map_name));
AddMenuItem(menu, map_name, map_name);
menu.AddItem(map_name, map_name);
}
return map_count;

View File

@ -89,16 +89,16 @@ PerformWho(client, target, ReplySource:reply, bool:is_admin)
DisplayWhoMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_Who);
Menu menu = CreateMenu(MenuHandler_Who);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Identify player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu2(menu, 0, COMMAND_FILTER_CONNECTED);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public AdminMenu_Who(Handle:topmenu,
@ -118,11 +118,11 @@ public AdminMenu_Who(Handle:topmenu,
}
}
public MenuHandler_Who(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_Who(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -136,7 +136,7 @@ public MenuHandler_Who(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)

View File

@ -52,7 +52,7 @@ ConVar g_Cvar_TriggerShow;
ConVar g_Cvar_TimeleftInterval;
ConVar g_Cvar_FriendlyFire;
new Handle:g_Timer_TimeShow = INVALID_HANDLE;
Handle g_Timer_TimeShow = null;
ConVar g_Cvar_WinLimit;
ConVar g_Cvar_FragLimit;
@ -167,7 +167,7 @@ public ConVarChange_TimeleftInterval(Handle:convar, const String:oldValue[], con
if (newval < 1.0)
{
if (g_Timer_TimeShow != INVALID_HANDLE)
if (g_Timer_TimeShow != null)
{
KillTimer(g_Timer_TimeShow);
}
@ -175,7 +175,7 @@ public ConVarChange_TimeleftInterval(Handle:convar, const String:oldValue[], con
return;
}
if (g_Timer_TimeShow != INVALID_HANDLE)
if (g_Timer_TimeShow != null)
{
KillTimer(g_Timer_TimeShow);
g_Timer_TimeShow = CreateTimer(newval, Timer_DisplayTimeleft, _, TIMER_REPEAT);

View File

@ -49,7 +49,7 @@ public Plugin:myinfo =
#define VOTE_NO "###no###"
#define VOTE_YES "###yes###"
new Handle:g_hVoteMenu = INVALID_HANDLE;
Menu g_hVoteMenu = null;
ConVar g_Cvar_Limits[3] = {null, ...};
//new Handle:g_Cvar_VoteSay = INVALID_HANDLE;
@ -99,7 +99,7 @@ public OnPluginStart()
/*
g_Cvar_Show = FindConVar("sm_vote_show");
if (g_Cvar_Show == INVALID_HANDLE)
if (g_Cvar_Show == null)
{
g_Cvar_Show = CreateConVar("sm_vote_show", "1", "Show player's votes? Default on.", 0, true, 0.0, true, 1.0);
}
@ -119,8 +119,8 @@ public OnPluginStart()
g_SelectedMaps = CreateArray(33);
g_MapList = CreateMenu(MenuHandler_Map, MenuAction_DrawItem|MenuAction_Display);
SetMenuTitle(g_MapList, "%T", "Please select a map", LANG_SERVER);
SetMenuExitBackButton(g_MapList, true);
g_MapList.SetTitle("%T", "Please select a map", LANG_SERVER);
g_MapList.ExitBackButton = true;
decl String:mapListPath[PLATFORM_MAX_PATH];
BuildPath(Path_SM, mapListPath, sizeof(mapListPath), "configs/adminmenu_maplist.ini");
@ -200,28 +200,28 @@ public Action:Command_Vote(client, args)
g_voteType = voteType:question;
g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
SetMenuTitle(g_hVoteMenu, "%s?", g_voteArg);
g_hVoteMenu.SetTitle("%s?", g_voteArg);
if (answerCount < 2)
{
AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
g_hVoteMenu.AddItem(VOTE_YES, "Yes");
g_hVoteMenu.AddItem(VOTE_NO, "No");
}
else
{
for (new i = 0; i < answerCount; i++)
{
AddMenuItem(g_hVoteMenu, answers[i], answers[i]);
g_hVoteMenu.AddItem(answers[i], answers[i]);
}
}
SetMenuExitButton(g_hVoteMenu, false);
VoteMenuToAll(g_hVoteMenu, 20);
g_hVoteMenu.ExitButton = false;
g_hVoteMenu.DisplayVoteToAll(20);
return Plugin_Handled;
}
public Handler_VoteCallback(Handle:menu, MenuAction:action, param1, param2)
public Handler_VoteCallback(Menu menu, MenuAction action, param1, param2)
{
if (action == MenuAction_End)
{
@ -231,20 +231,20 @@ public Handler_VoteCallback(Handle:menu, MenuAction:action, param1, param2)
{
if (g_voteType != voteType:question)
{
decl String:title[64];
GetMenuTitle(menu, title, sizeof(title));
char title[64];
menu.GetTitle(title, sizeof(title));
decl String:buffer[255];
char buffer[255];
Format(buffer, sizeof(buffer), "%T", title, param1, g_voteInfo[VOTE_NAME]);
new Handle:panel = Handle:param2;
SetPanelTitle(panel, buffer);
Panel panel = Panel:param2;
panel.SetTitle(buffer);
}
}
else if (action == MenuAction_DisplayItem)
{
decl String:display[64];
GetMenuItem(menu, param2, "", 0, _, display, sizeof(display));
menu.GetItem(param2, "", 0, _, display, sizeof(display));
if (strcmp(display, "No") == 0 || strcmp(display, "Yes") == 0)
{
@ -269,7 +269,7 @@ public Handler_VoteCallback(Handle:menu, MenuAction:action, param1, param2)
int votes, totalVotes;
GetMenuVoteInfo(param2, votes, totalVotes);
GetMenuItem(menu, param1, item, sizeof(item), _, display, sizeof(display));
menu.GetItem(param1, item, sizeof(item), _, display, sizeof(display));
if (strcmp(item, VOTE_NO) == 0 && param1 == 1)
{
@ -362,7 +362,7 @@ VoteSelect(Handle:menu, param1, param2 = 0)
{
decl String:voter[64], String:junk[64], String:choice[64];
GetClientName(param1, voter, sizeof(voter));
GetMenuItem(menu, param2, junk, sizeof(junk), _, choice, sizeof(choice));
menu.GetItem(param2, junk, sizeof(junk), _, choice, sizeof(choice));
PrintToChatAll("[SM] %T", "Vote Select", LANG_SERVER, voter, choice);
}
}
@ -370,8 +370,8 @@ VoteSelect(Handle:menu, param1, param2 = 0)
VoteMenuClose()
{
CloseHandle(g_hVoteMenu);
g_hVoteMenu = INVALID_HANDLE;
delete g_hVoteMenu;
g_hVoteMenu = null;
}
Float:GetVotePercent(votes, totalVotes)

View File

@ -45,25 +45,25 @@ DisplayVoteBanMenu(client, target)
g_voteType = voteType:ban;
g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
SetMenuTitle(g_hVoteMenu, "Voteban Player");
AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
SetMenuExitButton(g_hVoteMenu, false);
VoteMenuToAll(g_hVoteMenu, 20);
g_hVoteMenu.SetTitle("Voteban Player");
g_hVoteMenu.AddItem(VOTE_YES, "Yes");
g_hVoteMenu.AddItem(VOTE_NO, "No");
g_hVoteMenu.ExitButton = false;
g_hVoteMenu.DisplayVoteToAll(20);
}
DisplayBanTargetMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_Ban);
Menu menu = CreateMenu(MenuHandler_Ban);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Ban vote", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, false, false);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public AdminMenu_VoteBan(Handle:topmenu,
@ -88,11 +88,11 @@ public AdminMenu_VoteBan(Handle:topmenu,
}
}
public MenuHandler_Ban(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_Ban(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -106,7 +106,7 @@ public MenuHandler_Ban(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32], String:name[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
menu.GetItem(param2, info, sizeof(info), _, name, sizeof(name));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)

View File

@ -45,26 +45,26 @@ DisplayVoteKickMenu(client, target)
g_voteType = voteType:kick;
g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
SetMenuTitle(g_hVoteMenu, "Votekick Player");
AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
SetMenuExitButton(g_hVoteMenu, false);
VoteMenuToAll(g_hVoteMenu, 20);
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)
{
new Handle:menu = CreateMenu(MenuHandler_Kick);
Menu menu = CreateMenu(MenuHandler_Kick);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Kick vote", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, false, false);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public AdminMenu_VoteKick(Handle:topmenu,
@ -89,11 +89,11 @@ public AdminMenu_VoteKick(Handle:topmenu,
}
}
public MenuHandler_Kick(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_Kick(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -107,7 +107,7 @@ public MenuHandler_Kick(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32], String:name[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
menu.GetItem(param2, info, sizeof(info), _, name, sizeof(name));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)

View File

@ -31,7 +31,7 @@
* Version: $Id$
*/
new Handle:g_MapList = INVALID_HANDLE;
Menu g_MapList;
new g_mapCount;
new Handle:g_SelectedMaps;
@ -50,23 +50,23 @@ DisplayVoteMapMenu(client, mapCount, String:maps[5][])
{
strcopy(g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]), maps[0]);
SetMenuTitle(g_hVoteMenu, "Change Map To");
AddMenuItem(g_hVoteMenu, maps[0], "Yes");
AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
g_hVoteMenu.SetTitle("Change Map To");
g_hVoteMenu.AddItem(maps[0], "Yes");
g_hVoteMenu.AddItem(VOTE_NO, "No");
}
else
{
g_voteInfo[VOTE_NAME][0] = '\0';
SetMenuTitle(g_hVoteMenu, "Map Vote");
g_hVoteMenu.SetTitle("Map Vote");
for (new i = 0; i < mapCount; i++)
{
AddMenuItem(g_hVoteMenu, maps[i], maps[i]);
g_hVoteMenu.AddItem(maps[i], maps[i]);
}
}
SetMenuExitButton(g_hVoteMenu, false);
VoteMenuToAll(g_hVoteMenu, 20);
g_hVoteMenu.ExitButton = false;
g_hVoteMenu.DisplayVoteToAll(20);
}
ResetMenu()
@ -77,25 +77,25 @@ ResetMenu()
ConfirmVote(client)
{
new Handle:menu = CreateMenu(MenuHandler_Confirm);
Menu menu = CreateMenu(MenuHandler_Confirm);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Confirm Vote", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
decl String:itemtext[256];
Format(itemtext, sizeof(itemtext), "%T", "Start the Vote", client);
AddMenuItem(menu, "Confirm", itemtext);
menu.AddItem("Confirm", itemtext);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public MenuHandler_Confirm(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_Confirm(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
g_VoteMapInUse = false;
}
else if (action == MenuAction_Cancel)
@ -123,7 +123,7 @@ public MenuHandler_Confirm(Handle:menu, MenuAction:action, param1, param2)
}
}
public MenuHandler_Map(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_Map(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_Cancel)
{
@ -141,7 +141,7 @@ public MenuHandler_Map(Handle:menu, MenuAction:action, param1, param2)
{
decl String:info[32], String:name[32];
GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
menu.GetItem(param2, info, sizeof(info), _, name, sizeof(name));
if (FindStringInArray(g_SelectedMaps, info) != -1)
{
@ -156,14 +156,14 @@ public MenuHandler_Map(Handle:menu, MenuAction:action, param1, param2)
{
decl String:info[32], String:name[32];
GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
menu.GetItem(param2, info, sizeof(info), _, name, sizeof(name));
PushArrayString(g_SelectedMaps, info);
/* Redisplay the list */
if (GetArraySize(g_SelectedMaps) < 5)
{
DisplayMenu(g_MapList, param1, MENU_TIME_FOREVER);
g_MapList.Display(param1, MENU_TIME_FOREVER);
}
else
{
@ -197,7 +197,7 @@ public AdminMenu_VoteMap(Handle:topmenu,
{
ResetMenu();
g_VoteMapInUse = true;
DisplayMenu(g_MapList, param, MENU_TIME_FOREVER);
g_MapList.Display(param, MENU_TIME_FOREVER);
}
else
{
@ -260,10 +260,10 @@ public Action:Command_Votemap(client, args)
return Plugin_Handled;
}
new Handle:g_map_array = INVALID_HANDLE;
new Handle:g_map_array = null;
new g_map_serial = -1;
LoadMapList(Handle:menu)
int LoadMapList(Menu menu)
{
new Handle:map_array;
@ -271,25 +271,25 @@ LoadMapList(Handle:menu)
g_map_serial,
"sm_votemap menu",
MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_NO_DEFAULT|MAPLIST_FLAG_MAPSFOLDER))
!= INVALID_HANDLE)
!= null)
{
g_map_array = map_array;
}
if (g_map_array == INVALID_HANDLE)
if (g_map_array == null)
{
return 0;
}
RemoveAllMenuItems(menu);
decl String:map_name[64];
char map_name[64];
new map_count = GetArraySize(g_map_array);
for (new i = 0; i < map_count; i++)
{
GetArrayString(g_map_array, i, map_name, sizeof(map_name));
AddMenuItem(menu, map_name, map_name);
menu.AddItem(map_name, map_name);
}
return map_count;

View File

@ -86,7 +86,7 @@ public Action:Command_Cookie(client, args)
}
}
CloseHandle(iter);
delete iter;
return Plugin_Handled;
}
@ -102,7 +102,7 @@ public Action:Command_Cookie(client, args)
new Handle:cookie = FindClientCookie(name);
if (cookie == INVALID_HANDLE)
if (cookie == null)
{
ReplyToCommand(client, "[SM] %t", "Cookie not Found", name);
return Plugin_Handled;
@ -113,7 +113,7 @@ public Action:Command_Cookie(client, args)
if (access == CookieAccess_Private)
{
ReplyToCommand(client, "[SM] %t", "Cookie not Found", name);
CloseHandle(cookie);
delete cookie;
return Plugin_Handled;
}
@ -125,14 +125,14 @@ public Action:Command_Cookie(client, args)
GetClientCookie(client, cookie, value, sizeof(value));
ReplyToCommand(client, "[SM] %t", "Cookie Value", name, value);
CloseHandle(cookie);
delete cookie;
return Plugin_Handled;
}
if (access == CookieAccess_Protected)
{
ReplyToCommand(client, "[SM] %t", "Protected Cookie", name);
CloseHandle(cookie);
delete cookie;
return Plugin_Handled;
}
@ -141,7 +141,7 @@ public Action:Command_Cookie(client, args)
GetCmdArg(2, value, sizeof(value));
SetClientCookie(client, cookie, value);
CloseHandle(cookie);
delete cookie;
ReplyToCommand(client, "[SM] %t", "Cookie Changed Value", name, value);
return Plugin_Handled;

View File

@ -95,7 +95,7 @@ new EngineVersion:g_GameEngine = Engine_Unknown;
public OnPluginStart()
{
if (FindPluginByFile("basefuncommands.smx") != INVALID_HANDLE)
if (FindPluginByFile("basefuncommands.smx") != null)
{
ThrowError("This plugin replaces basefuncommands. You cannot run both at once.");
}
@ -180,7 +180,7 @@ HookEvents( )
public OnMapStart()
{
new Handle:gameConfig = LoadGameConfigFile("funcommands.games");
if (gameConfig == INVALID_HANDLE)
if (gameConfig == null)
{
SetFailState("Unable to load game config funcommands.games");
return;
@ -237,7 +237,7 @@ public OnMapStart()
g_HaloSprite = PrecacheModel(buffer);
}
CloseHandle(gameConfig);
delete gameConfig;
}
public OnMapEnd()
@ -289,10 +289,10 @@ public OnAdminMenuReady(Handle aTopMenu)
}
}
AddTranslatedMenuItem(Handle:menu, const String:opt[], const String:phrase[], client)
void AddTranslatedMenuItem(Menu menu, const char[] opt, const char[] phrase, int client)
{
decl String:buffer[128];
char buffer[128];
Format(buffer, sizeof(buffer), "%T", phrase, client);
AddMenuItem(menu, opt, buffer);
menu.AddItem(opt, buffer);
}

View File

@ -141,23 +141,23 @@ public AdminMenu_Beacon(Handle:topmenu,
DisplayBeaconMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_Beacon);
Menu menu = CreateMenu(MenuHandler_Beacon);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Beacon player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public MenuHandler_Beacon(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_Beacon(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -171,7 +171,7 @@ public MenuHandler_Beacon(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)

View File

@ -103,39 +103,39 @@ public AdminMenu_Blind(Handle:topmenu,
DisplayBlindMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_Blind);
Menu menu = CreateMenu(MenuHandler_Blind);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Blind player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
DisplayAmountMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_Amount);
Menu menu = CreateMenu(MenuHandler_Amount);
decl String:title[100];
Format(title, sizeof(title), "%T: %N", "Blind amount", client, GetClientOfUserId(g_BlindTarget[client]));
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTranslatedMenuItem(menu, "255", "Fully blind", client);
AddTranslatedMenuItem(menu, "240", "Half blind", client);
AddTranslatedMenuItem(menu, "0", "No blind", client);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public MenuHandler_Blind(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_Blind(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -149,7 +149,7 @@ public MenuHandler_Blind(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)
@ -177,11 +177,11 @@ public MenuHandler_Blind(Handle:menu, MenuAction:action, param1, param2)
return;
}
public MenuHandler_Amount(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_Amount(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -195,7 +195,7 @@ public MenuHandler_Amount(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32];
new amount, target;
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
amount = StringToInt(info);
if ((target = GetClientOfUserId(g_BlindTarget[param1])) == 0)

View File

@ -85,14 +85,14 @@ KillDrug(client)
KillDrugTimer(client)
{
KillTimer(g_DrugTimers[client]);
g_DrugTimers[client] = INVALID_HANDLE;
g_DrugTimers[client] = null;
}
KillAllDrugs()
{
for (new i = 1; i <= MaxClients; i++)
{
if (g_DrugTimers[i] != INVALID_HANDLE)
if (g_DrugTimers[i] != null)
{
if(IsClientInGame(i))
{
@ -112,7 +112,7 @@ PerformDrug(client, target, toggle)
{
case (2):
{
if (g_DrugTimers[target] == INVALID_HANDLE)
if (g_DrugTimers[target] == null)
{
CreateDrug(target);
LogAction(client, target, "\"%L\" drugged \"%L\"", client, target);
@ -126,7 +126,7 @@ PerformDrug(client, target, toggle)
case (1):
{
if (g_DrugTimers[target] == INVALID_HANDLE)
if (g_DrugTimers[target] == null)
{
CreateDrug(target);
LogAction(client, target, "\"%L\" drugged \"%L\"", client, target);
@ -135,7 +135,7 @@ PerformDrug(client, target, toggle)
case (0):
{
if (g_DrugTimers[target] != INVALID_HANDLE)
if (g_DrugTimers[target] != null)
{
KillDrug(target);
LogAction(client, target, "\"%L\" undrugged \"%L\"", client, target);
@ -222,23 +222,23 @@ public AdminMenu_Drug(Handle:topmenu,
DisplayDrugMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_Drug);
Menu menu = CreateMenu(MenuHandler_Drug);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Drug player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public MenuHandler_Drug(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_Drug(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -252,7 +252,7 @@ public MenuHandler_Drug(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)

View File

@ -247,37 +247,37 @@ public AdminMenu_FireBomb(Handle:topmenu,
DisplayBurnMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_Burn);
Menu menu = CreateMenu(MenuHandler_Burn);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Burn player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
DisplayFireBombMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_FireBomb);
Menu menu = CreateMenu(MenuHandler_FireBomb);
decl String:title[100];
Format(title, sizeof(title), "%T:", "FireBomb player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public MenuHandler_Burn(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_Burn(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -291,7 +291,7 @@ public MenuHandler_Burn(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)
@ -318,11 +318,11 @@ public MenuHandler_Burn(Handle:menu, MenuAction:action, param1, param2)
}
}
public MenuHandler_FireBomb(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_FireBomb(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -336,7 +336,7 @@ public MenuHandler_FireBomb(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)

View File

@ -58,26 +58,26 @@ public AdminMenu_Gravity(Handle:topmenu,
DisplayGravityMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_Gravity);
Menu menu = CreateMenu(MenuHandler_Gravity);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Gravity player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
DisplayGravityAmountMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_GravityAmount);
Menu menu = CreateMenu(MenuHandler_GravityAmount);
decl String:title[100];
Format(title, sizeof(title), "%T: %N", "Gravity amount", client, GetClientOfUserId(g_GravityTarget[client]));
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTranslatedMenuItem(menu, "4.0", "Gravity Very High", client);
AddTranslatedMenuItem(menu, "2.0", "Gravity High", client);
@ -85,14 +85,14 @@ DisplayGravityAmountMenu(client)
AddTranslatedMenuItem(menu, "0.5", "Gravity Low", client);
AddTranslatedMenuItem(menu, "0.1", "Gravity Very Low", client);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public MenuHandler_Gravity(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_Gravity(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -106,7 +106,7 @@ public MenuHandler_Gravity(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)
@ -134,11 +134,11 @@ public MenuHandler_Gravity(Handle:menu, MenuAction:action, param1, param2)
return;
}
public MenuHandler_GravityAmount(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_GravityAmount(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -152,7 +152,7 @@ public MenuHandler_GravityAmount(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32];
new Float:amount, target;
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
amount = StringToFloat(info);
if ((target = GetClientOfUserId(g_GravityTarget[param1])) == 0)

View File

@ -361,37 +361,37 @@ public AdminMenu_FreezeBomb(Handle:topmenu,
DisplayFreezeMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_Freeze);
Menu menu = CreateMenu(MenuHandler_Freeze);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Freeze player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
DisplayFreezeBombMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_FreezeBomb);
Menu menu = CreateMenu(MenuHandler_FreezeBomb);
decl String:title[100];
Format(title, sizeof(title), "%T:", "FreezeBomb player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public MenuHandler_Freeze(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_Freeze(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -405,7 +405,7 @@ public MenuHandler_Freeze(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)
@ -433,11 +433,11 @@ public MenuHandler_Freeze(Handle:menu, MenuAction:action, param1, param2)
}
}
public MenuHandler_FreezeBomb(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_FreezeBomb(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -451,7 +451,7 @@ public MenuHandler_FreezeBomb(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)

View File

@ -66,23 +66,23 @@ public AdminMenu_NoClip(Handle:topmenu,
DisplayNoClipMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_NoClip);
Menu menu = CreateMenu(MenuHandler_NoClip);
decl String:title[100];
Format(title, sizeof(title), "%T:", "NoClip player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public MenuHandler_NoClip(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_NoClip(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -96,7 +96,7 @@ public MenuHandler_NoClip(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)

View File

@ -232,23 +232,23 @@ public AdminMenu_TimeBomb(Handle:topmenu,
DisplayTimeBombMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_TimeBomb);
Menu menu = CreateMenu(MenuHandler_TimeBomb);
decl String:title[100];
Format(title, sizeof(title), "%T:", "TimeBomb player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public MenuHandler_TimeBomb(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_TimeBomb(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -262,7 +262,7 @@ public MenuHandler_TimeBomb(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)

View File

@ -51,14 +51,14 @@ public Plugin:myinfo =
#define VOTE_NO "###no###"
#define VOTE_YES "###yes###"
new Handle:g_hVoteMenu = INVALID_HANDLE;
Menu g_hVoteMenu = null;
ConVar g_Cvar_Limits[5] = {null, ...};
ConVar g_Cvar_Gravity;
ConVar g_Cvar_Alltalk;
ConVar g_Cvar_FF;
// new Handle:g_Cvar_Show = INVALID_HANDLE;
// new Handle:g_Cvar_Show = null;
enum voteType
{
@ -93,7 +93,7 @@ TopMenu hTopMenu;
public OnPluginStart()
{
if (FindPluginByFile("basefunvotes.smx") != INVALID_HANDLE)
if (FindPluginByFile("basefunvotes.smx") != null)
{
ThrowError("This plugin replaces basefuncommands. You cannot run both at once.");
}
@ -121,7 +121,7 @@ public OnPluginStart()
/*
g_Cvar_Show = FindConVar("sm_vote_show");
if (g_Cvar_Show == INVALID_HANDLE)
if (g_Cvar_Show == null)
{
g_Cvar_Show = CreateConVar("sm_vote_show", "1", "Show player's votes? Default on.", 0, true, 0.0, true, 1.0);
}
@ -161,7 +161,7 @@ public OnAdminMenuReady(Handle aTopMenu)
}
}
public Handler_VoteCallback(Handle:menu, MenuAction:action, param1, param2)
public Handler_VoteCallback(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
@ -169,23 +169,23 @@ public Handler_VoteCallback(Handle:menu, MenuAction:action, param1, param2)
}
else if (action == MenuAction_Display)
{
decl String:title[64];
GetMenuTitle(menu, title, sizeof(title));
char title[64];
menu.GetTitle(title, sizeof(title));
decl String:buffer[255];
char buffer[255];
Format(buffer, sizeof(buffer), "%T", title, param1, g_voteInfo[VOTE_NAME]);
new Handle:panel = Handle:param2;
SetPanelTitle(panel, buffer);
Panel panel = Panel:param2;
panel.SetTitle(buffer);
}
else if (action == MenuAction_DisplayItem)
{
decl String:display[64];
GetMenuItem(menu, param2, "", 0, _, display, sizeof(display));
char display[64];
menu.GetItem(param2, "", 0, _, display, sizeof(display));
if (strcmp(display, VOTE_NO) == 0 || strcmp(display, VOTE_YES) == 0)
{
decl String:buffer[255];
char buffer[255];
Format(buffer, sizeof(buffer), "%T", display, param1);
return RedrawMenuItem(buffer);
@ -206,7 +206,7 @@ public Handler_VoteCallback(Handle:menu, MenuAction:action, param1, param2)
int votes, totalVotes;
GetMenuVoteInfo(param2, votes, totalVotes);
GetMenuItem(menu, param1, item, sizeof(item));
menu.GetItem(param1, item, sizeof(item));
if (strcmp(item, VOTE_NO) == 0 && param1 == 1)
{
@ -285,7 +285,7 @@ VoteSelect(Handle:menu, param1, param2 = 0)
{
decl String:voter[64], String:junk[64], String:choice[64];
GetClientName(param1, voter, sizeof(voter));
GetMenuItem(menu, param2, junk, sizeof(junk), _, choice, sizeof(choice));
menu.GetItem(param2, junk, sizeof(junk), _, choice, sizeof(choice));
PrintToChatAll("[SM] %T", "Vote Select", LANG_SERVER, voter, choice);
}
}
@ -293,8 +293,8 @@ VoteSelect(Handle:menu, param1, param2 = 0)
VoteMenuClose()
{
CloseHandle(g_hVoteMenu);
g_hVoteMenu = INVALID_HANDLE;
delete g_hVoteMenu;
g_hVoteMenu = null;
}
Float:GetVotePercent(votes, totalVotes)

View File

@ -54,17 +54,17 @@ DisplayVoteAllTalkMenu(client)
if (g_Cvar_Alltalk.BoolValue)
{
SetMenuTitle(g_hVoteMenu, "Votealltalk Off");
g_hVoteMenu.SetTitle("Votealltalk Off");
}
else
{
SetMenuTitle(g_hVoteMenu, "Votealltalk On");
g_hVoteMenu.SetTitle("Votealltalk On");
}
AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
SetMenuExitButton(g_hVoteMenu, false);
VoteMenuToAll(g_hVoteMenu, 20);
g_hVoteMenu.AddItem(VOTE_YES, "Yes");
g_hVoteMenu.AddItem(VOTE_NO, "No");
g_hVoteMenu.ExitButton = false;
g_hVoteMenu.DisplayVoteToAll(20);
}

View File

@ -48,25 +48,25 @@ DisplayVoteBurnMenu(client, target, String:name[])
g_voteType = voteType:burn;
g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
SetMenuTitle(g_hVoteMenu, "Voteburn player");
AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
SetMenuExitButton(g_hVoteMenu, false);
VoteMenuToAll(g_hVoteMenu, 20);
g_hVoteMenu.SetTitle("Voteburn player");
g_hVoteMenu.AddItem(VOTE_YES, "Yes");
g_hVoteMenu.AddItem(VOTE_NO, "No");
g_hVoteMenu.ExitButton = false;
g_hVoteMenu.DisplayVoteToAll(20);
}
DisplayBurnTargetMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_Burn);
Menu menu = CreateMenu(MenuHandler_Burn);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Burn vote", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public AdminMenu_VoteBurn(Handle:topmenu,
@ -91,11 +91,11 @@ public AdminMenu_VoteBurn(Handle:topmenu,
}
}
public MenuHandler_Burn(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_Burn(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -109,7 +109,7 @@ public MenuHandler_Burn(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32], String:name[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
menu.GetItem(param2, info, sizeof(info), _, name, sizeof(name));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)

View File

@ -54,17 +54,17 @@ DisplayVoteFFMenu(client)
if (g_Cvar_FF.BoolValue)
{
SetMenuTitle(g_hVoteMenu, "Voteff Off");
g_hVoteMenu.SetTitle("Voteff Off");
}
else
{
SetMenuTitle(g_hVoteMenu, "Voteff On");
g_hVoteMenu.SetTitle("Voteff On");
}
AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
SetMenuExitButton(g_hVoteMenu, false);
VoteMenuToAll(g_hVoteMenu, 20);
g_hVoteMenu.AddItem(VOTE_YES, "Yes");
g_hVoteMenu.AddItem(VOTE_NO, "No");
g_hVoteMenu.ExitButton = false;
g_hVoteMenu.DisplayVoteToAll(20);
}
public AdminMenu_VoteFF(Handle:topmenu,

View File

@ -45,23 +45,23 @@ DisplayVoteGravityMenu(client,count,String:items[5][])
{
strcopy(g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]), items[0]);
SetMenuTitle(g_hVoteMenu, "Change Gravity To");
AddMenuItem(g_hVoteMenu, items[0], "Yes");
AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
g_hVoteMenu.SetTitle("Change Gravity To");
g_hVoteMenu.AddItem(items[0], "Yes");
g_hVoteMenu.AddItem(VOTE_NO, "No");
}
else
{
g_voteInfo[VOTE_NAME][0] = '\0';
SetMenuTitle(g_hVoteMenu, "Gravity Vote");
g_hVoteMenu.SetTitle("Gravity Vote");
for (new i = 0; i < count; i++)
{
AddMenuItem(g_hVoteMenu, items[i], items[i]);
g_hVoteMenu.AddItem(items[i], items[i]);
}
}
SetMenuExitButton(g_hVoteMenu, false);
VoteMenuToAll(g_hVoteMenu, 20);
g_hVoteMenu.ExitButton = false;
g_hVoteMenu.DisplayVoteToAll(20);
}
public AdminMenu_VoteGravity(Handle:topmenu,

View File

@ -49,25 +49,25 @@ DisplayVoteSlayMenu(client, target, String:name[])
g_voteType = voteType:slay;
g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
SetMenuTitle(g_hVoteMenu, "Voteslay Player");
AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
SetMenuExitButton(g_hVoteMenu, false);
VoteMenuToAll(g_hVoteMenu, 20);
g_hVoteMenu.SetTitle("Voteslay Player");
g_hVoteMenu.AddItem(VOTE_YES, "Yes");
g_hVoteMenu.AddItem(VOTE_NO, "No");
g_hVoteMenu.ExitButton = false;
g_hVoteMenu.DisplayVoteToAll(20);
}
DisplaySlayTargetMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_Slay);
Menu menu = CreateMenu(MenuHandler_Slay);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Slay vote", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public AdminMenu_VoteSlay(Handle:topmenu,
@ -92,11 +92,11 @@ public AdminMenu_VoteSlay(Handle:topmenu,
}
}
public MenuHandler_Slay(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_Slay(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -110,7 +110,7 @@ public MenuHandler_Slay(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32], String:name[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
menu.GetItem(param2, info, sizeof(info), _, name, sizeof(name));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)

View File

@ -73,12 +73,12 @@ new Handle:g_VoteTimer = INVALID_HANDLE;
new Handle:g_RetryTimer = INVALID_HANDLE;
/* Data Handles */
new Handle:g_MapList = INVALID_HANDLE;
new Handle:g_NominateList = INVALID_HANDLE;
new Handle:g_NominateOwners = INVALID_HANDLE;
new Handle:g_OldMapList = INVALID_HANDLE;
new Handle:g_NextMapList = INVALID_HANDLE;
new Handle:g_VoteMenu = INVALID_HANDLE;
new Handle:g_MapList = null;
new Handle:g_NominateList = null;
new Handle:g_NominateOwners = null;
new Handle:g_OldMapList = null;
new Handle:g_NextMapList = null;
Menu g_VoteMenu;
new g_Extends;
new g_TotalRounds;
@ -91,8 +91,8 @@ new g_mapFileSerial = -1;
new MapChange:g_ChangeTime;
new Handle:g_NominationsResetForward = INVALID_HANDLE;
new Handle:g_MapVoteStartedForward = INVALID_HANDLE;
new Handle:g_NominationsResetForward = null;
new Handle:g_MapVoteStartedForward = null;
/* Upper bound of how many team there could be */
#define MAXTEAMS 10
@ -200,7 +200,7 @@ public OnConfigsExecuted()
g_mapFileSerial,
"mapchooser",
MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_MAPSFOLDER)
!= INVALID_HANDLE)
!= null)
{
if (g_mapFileSerial == -1)
@ -244,8 +244,8 @@ public OnMapEnd()
g_ChangeMapAtRoundEnd = false;
g_ChangeMapInProgress = false;
g_VoteTimer = INVALID_HANDLE;
g_RetryTimer = INVALID_HANDLE;
g_VoteTimer = null;
g_RetryTimer = null;
decl String:map[PLATFORM_MAX_PATH];
GetCurrentMap(map, sizeof(map));
@ -319,14 +319,14 @@ SetupTimeleftTimer()
new startTime = g_Cvar_StartTime.IntValue * 60;
if (time - startTime < 0 && g_Cvar_EndOfMapVote.BoolValue && !g_MapVoteCompleted && !g_HasVoteStarted)
{
InitiateVote(MapChange_MapEnd, INVALID_HANDLE);
InitiateVote(MapChange_MapEnd, null);
}
else
{
if (g_VoteTimer != INVALID_HANDLE)
if (g_VoteTimer != null)
{
KillTimer(g_VoteTimer);
g_VoteTimer = INVALID_HANDLE;
g_VoteTimer = null;
}
//g_VoteTimer = CreateTimer(float(time - startTime), Timer_StartMapVote, _, TIMER_FLAG_NO_MAPCHANGE);
@ -344,11 +344,11 @@ public Action:Timer_StartMapVote(Handle:timer, Handle:data)
if (timer == g_RetryTimer)
{
g_WaitingForVote = false;
g_RetryTimer = INVALID_HANDLE;
g_RetryTimer = null;
}
else
{
g_VoteTimer = INVALID_HANDLE;
g_VoteTimer = null;
}
if (!GetArraySize(g_MapList) || !g_Cvar_EndOfMapVote.BoolValue || g_MapVoteCompleted || g_HasVoteStarted)
@ -464,7 +464,7 @@ public CheckWinLimit(winner_score)
{
if (winner_score >= (winlimit - g_Cvar_StartRounds.IntValue))
{
InitiateVote(MapChange_MapEnd, INVALID_HANDLE);
InitiateVote(MapChange_MapEnd, null);
}
}
}
@ -479,7 +479,7 @@ public CheckMaxRounds(roundcount)
{
if (roundcount >= (maxrounds - g_Cvar_StartRounds.IntValue))
{
InitiateVote(MapChange_MapEnd, INVALID_HANDLE);
InitiateVote(MapChange_MapEnd, null);
}
}
}
@ -511,13 +511,13 @@ public Event_PlayerDeath(Event event, const String:name[], bool:dontBroadcast)
if (GetClientFrags(fragger) >= (g_Cvar_Fraglimit.IntValue - g_Cvar_StartFrags.IntValue))
{
InitiateVote(MapChange_MapEnd, INVALID_HANDLE);
InitiateVote(MapChange_MapEnd, null);
}
}
public Action:Command_Mapvote(client, args)
{
InitiateVote(MapChange_MapEnd, INVALID_HANDLE);
InitiateVote(MapChange_MapEnd, null);
return Plugin_Handled;
}
@ -529,7 +529,7 @@ public Action:Command_Mapvote(client, args)
* @param inputlist Optional list of maps to use for the vote, otherwise an internal list of nominations + random maps will be used.
* @param noSpecials Block special vote options like extend/nochange (upgrade this to bitflags instead?)
*/
InitiateVote(MapChange:when, Handle:inputlist=INVALID_HANDLE)
InitiateVote(MapChange:when, Handle:inputlist=null)
{
g_WaitingForVote = true;
@ -557,9 +557,9 @@ InitiateVote(MapChange:when, Handle:inputlist=INVALID_HANDLE)
g_WaitingForVote = false;
g_HasVoteStarted = true;
g_VoteMenu = CreateMenu(Handler_MapVoteMenu, MenuAction:MENU_ACTIONS_ALL);
SetMenuTitle(g_VoteMenu, "Vote Nextmap");
SetVoteResultCallback(g_VoteMenu, Handler_MapVoteFinished);
g_VoteMenu = new Menu(Handler_MapVoteMenu, MenuAction:MENU_ACTIONS_ALL);
g_VoteMenu.SetTitle("Vote Nextmap");
g_VoteMenu.VoteResultCallback = Handler_MapVoteFinished;
/* Call OnMapVoteStarted() Forward */
Call_StartForward(g_MapVoteStartedForward);
@ -575,7 +575,7 @@ InitiateVote(MapChange:when, Handle:inputlist=INVALID_HANDLE)
char map[PLATFORM_MAX_PATH];
/* No input given - User our internal nominations and maplist */
if (inputlist == INVALID_HANDLE)
if (inputlist == null)
{
int nominateCount = GetArraySize(g_NominateList);
int voteSize = g_Cvar_IncludeMaps.IntValue;
@ -587,7 +587,7 @@ InitiateVote(MapChange:when, Handle:inputlist=INVALID_HANDLE)
for (new i=0; i<nominationsToAdd; i++)
{
GetArrayString(g_NominateList, i, map, sizeof(map));
AddMenuItem(g_VoteMenu, map, map);
g_VoteMenu.AddItem(map, map);
RemoveStringFromArray(g_NextMapList, map);
/* Notify Nominations that this map is now free */
@ -628,7 +628,7 @@ InitiateVote(MapChange:when, Handle:inputlist=INVALID_HANDLE)
count++;
/* Insert the map and increment our count */
AddMenuItem(g_VoteMenu, map, map);
g_VoteMenu.AddItem(map, map);
i++;
}
@ -646,7 +646,7 @@ InitiateVote(MapChange:when, Handle:inputlist=INVALID_HANDLE)
if (IsMapValid(map))
{
AddMenuItem(g_VoteMenu, map, map);
g_VoteMenu.AddItem(map, map);
}
}
}
@ -654,32 +654,32 @@ InitiateVote(MapChange:when, Handle:inputlist=INVALID_HANDLE)
/* Do we add any special items? */
if ((when == MapChange_Instant || when == MapChange_RoundEnd) && g_Cvar_DontChange.BoolValue)
{
AddMenuItem(g_VoteMenu, VOTE_DONTCHANGE, "Don't Change");
g_VoteMenu.AddItem(VOTE_DONTCHANGE, "Don't Change");
}
else if (g_Cvar_Extend.BoolValue && g_Extends < g_Cvar_Extend.IntValue)
{
AddMenuItem(g_VoteMenu, VOTE_EXTEND, "Extend Map");
g_VoteMenu.AddItem(VOTE_EXTEND, "Extend Map");
}
/* There are no maps we could vote for. Don't show anything. */
if (GetMenuItemCount(g_VoteMenu) == 0)
if (g_VoteMenu.ItemCount == 0)
{
g_HasVoteStarted = false;
CloseHandle(g_VoteMenu);
g_VoteMenu = INVALID_HANDLE;
delete g_VoteMenu;
g_VoteMenu = null;
return;
}
int voteDuration = g_Cvar_VoteDuration.IntValue;
SetMenuExitButton(g_VoteMenu, false);
VoteMenuToAll(g_VoteMenu, voteDuration);
g_VoteMenu.ExitButton = false;
g_VoteMenu.DisplayVoteToAll(voteDuration);
LogAction(-1, -1, "Voting for next map has started.");
PrintToChatAll("[SM] %t", "Nextmap Voting Started");
}
public Handler_VoteFinishedGeneric(Handle:menu,
public Handler_VoteFinishedGeneric(Menu menu,
num_votes,
num_clients,
const client_info[][2],
@ -687,7 +687,7 @@ public Handler_VoteFinishedGeneric(Handle:menu,
const item_info[][2])
{
char map[PLATFORM_MAX_PATH];
GetMenuItem(menu, item_info[0][VOTEINFO_ITEM_INDEX], map, sizeof(map));
menu.GetItem(item_info[0][VOTEINFO_ITEM_INDEX], map, sizeof(map));
if (strcmp(map, VOTE_EXTEND, false) == 0)
{
@ -774,11 +774,11 @@ public Handler_VoteFinishedGeneric(Handle:menu,
}
}
public Handler_MapVoteFinished(Handle:menu,
num_votes,
num_clients,
public Handler_MapVoteFinished(Menu menu,
int num_votes,
int num_clients,
const client_info[][2],
num_items,
int num_items,
const item_info[][2])
{
if (g_Cvar_RunOff.BoolValue && num_items > 1)
@ -790,25 +790,25 @@ public Handler_MapVoteFinished(Handle:menu,
{
/* Insufficient Winning margin - Lets do a runoff */
g_VoteMenu = CreateMenu(Handler_MapVoteMenu, MenuAction:MENU_ACTIONS_ALL);
SetMenuTitle(g_VoteMenu, "Runoff Vote Nextmap");
g_VoteMenu.SetTitle("Runoff Vote Nextmap");
SetVoteResultCallback(g_VoteMenu, Handler_VoteFinishedGeneric);
char map[PLATFORM_MAX_PATH];
char info1[PLATFORM_MAX_PATH];
char info2[PLATFORM_MAX_PATH];
GetMenuItem(menu, item_info[0][VOTEINFO_ITEM_INDEX], map, sizeof(map), _, info1, sizeof(info1));
AddMenuItem(g_VoteMenu, map, info1);
GetMenuItem(menu, item_info[1][VOTEINFO_ITEM_INDEX], map, sizeof(map), _, info2, sizeof(info2));
AddMenuItem(g_VoteMenu, map, info2);
menu.GetItem(item_info[0][VOTEINFO_ITEM_INDEX], map, sizeof(map), _, info1, sizeof(info1));
g_VoteMenu.AddItem(map, info1);
menu.GetItem(item_info[1][VOTEINFO_ITEM_INDEX], map, sizeof(map), _, info2, sizeof(info2));
g_VoteMenu.AddItem(map, info2);
int voteDuration = g_Cvar_VoteDuration.IntValue;
SetMenuExitButton(g_VoteMenu, false);
VoteMenuToAll(g_VoteMenu, voteDuration);
g_VoteMenu.ExitButton = false;
g_VoteMenu.DisplayVoteToAll(voteDuration);
/* Notify */
new Float:map1percent = float(item_info[0][VOTEINFO_ITEM_VOTES])/ float(num_votes) * 100;
new Float:map2percent = float(item_info[1][VOTEINFO_ITEM_VOTES])/ float(num_votes) * 100;
float map1percent = float(item_info[0][VOTEINFO_ITEM_VOTES])/ float(num_votes) * 100;
float map2percent = float(item_info[1][VOTEINFO_ITEM_VOTES])/ float(num_votes) * 100;
PrintToChatAll("[SM] %t", "Starting Runoff", g_Cvar_RunOffPercent.FloatValue, info1, map1percent, info2, map2percent);
@ -821,14 +821,14 @@ public Handler_MapVoteFinished(Handle:menu,
Handler_VoteFinishedGeneric(menu, num_votes, num_clients, client_info, num_items, item_info);
}
public Handler_MapVoteMenu(Handle:menu, MenuAction:action, param1, param2)
public Handler_MapVoteMenu(Menu menu, MenuAction action, int param1, int param2)
{
switch (action)
{
case MenuAction_End:
{
g_VoteMenu = INVALID_HANDLE;
CloseHandle(menu);
g_VoteMenu = null;
delete menu;
}
case MenuAction_Display:
@ -836,16 +836,16 @@ public Handler_MapVoteMenu(Handle:menu, MenuAction:action, param1, param2)
decl String:buffer[255];
Format(buffer, sizeof(buffer), "%T", "Vote Nextmap", param1);
new Handle:panel = Handle:param2;
SetPanelTitle(panel, buffer);
Panel panel = Panel:param2;
panel.SetTitle(buffer);
}
case MenuAction_DisplayItem:
{
if (GetMenuItemCount(menu) - 1 == param2)
if (menu.ItemCount - 1 == param2)
{
decl String:map[PLATFORM_MAX_PATH], String:buffer[255];
GetMenuItem(menu, param2, map, sizeof(map));
char map[PLATFORM_MAX_PATH], buffer[255];
menu.GetItem(param2, map, sizeof(map));
if (strcmp(map, VOTE_EXTEND, false) == 0)
{
Format(buffer, sizeof(buffer), "%T", "Extend Map", param1);
@ -864,9 +864,9 @@ public Handler_MapVoteMenu(Handle:menu, MenuAction:action, param1, param2)
// If we receive 0 votes, pick at random.
if (param1 == VoteCancel_NoVotes && g_Cvar_NoVoteMode.BoolValue)
{
new count = GetMenuItemCount(menu);
new count = menu.ItemCount;
decl String:map[PLATFORM_MAX_PATH];
GetMenuItem(menu, 0, map, sizeof(map));
menu.GetItem(0, map, sizeof(map));
// Make sure the first map in the menu isn't one of the special items.
// This would mean there are no real maps in the menu, because the special items are added after all maps. Don't do anything if that's the case.
@ -874,13 +874,13 @@ public Handler_MapVoteMenu(Handle:menu, MenuAction:action, param1, param2)
{
// Get a random map from the list.
new item = GetRandomInt(0, count - 1);
GetMenuItem(menu, item, map, sizeof(map));
menu.GetItem(item, map, sizeof(map));
// Make sure it's not one of the special items.
while (strcmp(map, VOTE_EXTEND, false) == 0 || strcmp(map, VOTE_DONTCHANGE, false) == 0)
{
item = GetRandomInt(0, count - 1);
GetMenuItem(menu, item, map, sizeof(map));
menu.GetItem(item, map, sizeof(map));
}
SetNextMap(map);
@ -905,7 +905,7 @@ public Action:Timer_ChangeMap(Handle:hTimer, Handle:dp)
new String:map[PLATFORM_MAX_PATH];
if (dp == INVALID_HANDLE)
if (dp == null)
{
if (!GetNextMap(map, sizeof(map)))
{
@ -964,7 +964,7 @@ CreateNextVote()
RemoveFromArray(tempMaps, b);
}
CloseHandle(tempMaps);
delete tempMaps;
}
bool:CanVoteStart()
@ -1149,7 +1149,7 @@ public Native_GetExcludeMapList(Handle:plugin, numParams)
{
new Handle:array = Handle:GetNativeCell(1);
if (array == INVALID_HANDLE)
if (array == null)
{
return;
}
@ -1170,7 +1170,7 @@ public Native_GetNominatedMapList(Handle:plugin, numParams)
new Handle:maparray = Handle:GetNativeCell(1);
new Handle:ownerarray = Handle:GetNativeCell(2);
if (maparray == INVALID_HANDLE)
if (maparray == null)
return;
decl String:map[PLATFORM_MAX_PATH];
@ -1181,7 +1181,7 @@ public Native_GetNominatedMapList(Handle:plugin, numParams)
PushArrayString(maparray, map);
// If the optional parameter for an owner list was passed, then we need to fill that out as well
if(ownerarray != INVALID_HANDLE)
if(ownerarray != null)
{
new index = GetArrayCell(g_NominateOwners, i);
PushArrayCell(ownerarray, index);

View File

@ -47,7 +47,7 @@ public Plugin myinfo =
};
int g_MapPos = -1;
Handle g_MapList = INVALID_HANDLE;
Handle g_MapList = null;
int g_MapListSerial = -1;
int g_CurrentMapStartTime;
@ -130,7 +130,7 @@ void FindAndSetNextMap()
g_MapListSerial,
"mapcyclefile",
MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_NO_DEFAULT)
== INVALID_HANDLE)
== null)
{
if (g_MapListSerial == -1)
{

View File

@ -85,7 +85,7 @@ public void OnConfigsExecuted()
g_mapFileSerial,
"nominations",
MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_MAPSFOLDER)
== INVALID_HANDLE)
== null)
{
if (g_mapFileSerial == -1)
{

View File

@ -73,25 +73,25 @@ public AdminMenu_Rename(Handle:topmenu,
}
}
DisplayRenameTargetMenu(client)
DisplayRenameTargetMenu(int client)
{
new Handle:menu = CreateMenu(MenuHandler_Rename);
Menu menu = CreateMenu(MenuHandler_Rename);
decl String:title[100];
char title[100];
Format(title, sizeof(title), "%T:", "Rename player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public MenuHandler_Rename(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_Rename(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -105,7 +105,7 @@ public MenuHandler_Rename(Handle:menu, MenuAction:action, param1, param2)
decl String:info[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)

View File

@ -41,36 +41,36 @@ PerformSlap(client, target, damage)
DisplaySlapDamageMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_SlapDamage);
Menu menu = CreateMenu(MenuHandler_SlapDamage);
decl String:title[100];
char title[100];
Format(title, sizeof(title), "%T:", "Slap damage", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddMenuItem(menu, "0", "0");
AddMenuItem(menu, "1", "1");
AddMenuItem(menu, "5", "5");
AddMenuItem(menu, "10", "10");
AddMenuItem(menu, "20", "20");
AddMenuItem(menu, "50", "50");
AddMenuItem(menu, "99", "99");
menu.AddItem("0", "0");
menu.AddItem("1", "1");
menu.AddItem("5", "5");
menu.AddItem("10", "10");
menu.AddItem("20", "20");
menu.AddItem("50", "50");
menu.AddItem("99", "99");
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
DisplaySlapTargetMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_Slap);
Menu menu = CreateMenu(MenuHandler_Slap);
decl String:title[100];
char title[100];
Format(title, sizeof(title), "%T: %d damage", "Slap player", client, g_SlapDamage[client]);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public AdminMenu_Slap(Handle:topmenu,
@ -90,11 +90,11 @@ public AdminMenu_Slap(Handle:topmenu,
}
}
public MenuHandler_SlapDamage(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_SlapDamage(Menu menu, MenuAction action, param1, param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -105,20 +105,20 @@ public MenuHandler_SlapDamage(Handle:menu, MenuAction:action, param1, param2)
}
else if (action == MenuAction_Select)
{
decl String:info[32];
char info[32];
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
g_SlapDamage[param1] = StringToInt(info);
DisplaySlapTargetMenu(param1);
}
}
public MenuHandler_Slap(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_Slap(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -129,10 +129,10 @@ public MenuHandler_Slap(Handle:menu, MenuAction:action, param1, param2)
}
else if (action == MenuAction_Select)
{
decl String:info[32];
char info[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)

View File

@ -39,16 +39,16 @@ PerformSlay(client, target)
DisplaySlayMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_Slay);
Menu menu = CreateMenu(MenuHandler_Slay);
decl String:title[100];
char title[100];
Format(title, sizeof(title), "%T:", "Slay player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
menu.Display(client, MENU_TIME_FOREVER);
}
public AdminMenu_Slay(Handle:topmenu,
@ -68,11 +68,11 @@ public AdminMenu_Slay(Handle:topmenu,
}
}
public MenuHandler_Slay(Handle:menu, MenuAction:action, param1, param2)
public MenuHandler_Slay(Menu menu, MenuAction action, param1, param2)
{
if (action == MenuAction_End)
{
CloseHandle(menu);
delete menu;
}
else if (action == MenuAction_Cancel)
{
@ -83,10 +83,10 @@ public MenuHandler_Slay(Handle:menu, MenuAction:action, param1, param2)
}
else if (action == MenuAction_Select)
{
decl String:info[32];
new userid, target;
char info[32];
int userid, target;
GetMenuItem(menu, param2, info, sizeof(info));
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)

View File

@ -45,8 +45,8 @@ public Plugin:myinfo =
ConVar g_Cvar_ExcludeMaps;
new Handle:g_MapList = INVALID_HANDLE;
new Handle:g_OldMapList = INVALID_HANDLE;
new Handle:g_MapList = null;
new Handle:g_OldMapList = null;
new g_mapListSerial = -1;
public OnPluginStart()
@ -66,7 +66,7 @@ public OnConfigsExecuted()
g_mapListSerial,
"randomcycle",
MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_MAPSFOLDER)
== INVALID_HANDLE)
== null)
{
if (g_mapListSerial == -1)
{

View File

@ -76,7 +76,7 @@ Handle:Connect()
db = SQL_Connect("default", true, error, sizeof(error));
}
if (db == INVALID_HANDLE)
if (db == null)
{
LogError("Could not connect to database: %s", error);
}
@ -159,7 +159,7 @@ public Action:Command_CreateTables(args)
{
new client = 0;
new Handle:db = Connect();
if (db == INVALID_HANDLE)
if (db == null)
{
ReplyToCommand(client, "[SM] %t", "Could not connect to database");
return Plugin_Handled;
@ -177,7 +177,7 @@ public Action:Command_CreateTables(args)
ReplyToCommand(client, "[SM] Unknown driver type '%s', cannot create tables.", ident);
}
CloseHandle(db);
delete db;
return Plugin_Handled;
}
@ -188,7 +188,7 @@ bool:GetUpdateVersion(client, Handle:db, versions[4])
new Handle:hQuery;
Format(query, sizeof(query), "SELECT cfg_value FROM sm_config WHERE cfg_key = 'admin_version'");
if ((hQuery = SQL_Query(db, query)) == INVALID_HANDLE)
if ((hQuery = SQL_Query(db, query)) == null)
{
DoError(client, db, query, "Version lookup query failed");
return false;
@ -208,7 +208,7 @@ bool:GetUpdateVersion(client, Handle:db, versions[4])
}
}
CloseHandle(hQuery);
delete hQuery;
if (current_version[3] < versions[3])
{
@ -232,7 +232,7 @@ UpdateSQLite(client, Handle:db)
new Handle:hQuery;
Format(query, sizeof(query), "SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'sm_config'");
if ((hQuery = SQL_Query(db, query)) == INVALID_HANDLE)
if ((hQuery = SQL_Query(db, query)) == null)
{
DoError(client, db, query, "Table lookup query failed");
return;
@ -240,7 +240,7 @@ UpdateSQLite(client, Handle:db)
new bool:found = SQL_FetchRow(hQuery);
CloseHandle(hQuery);
delete hQuery;
new versions[4];
if (found)
@ -298,7 +298,7 @@ UpdateMySQL(client, Handle:db)
new Handle:hQuery;
Format(query, sizeof(query), "SHOW TABLES");
if ((hQuery = SQL_Query(db, query)) == INVALID_HANDLE)
if ((hQuery = SQL_Query(db, query)) == null)
{
DoError(client, db, query, "Table lookup query failed");
return;
@ -314,7 +314,7 @@ UpdateMySQL(client, Handle:db)
found = true;
}
}
CloseHandle(hQuery);
delete hQuery;
new versions[4];
@ -365,7 +365,7 @@ public Action:Command_UpdateTables(args)
{
new client = 0;
new Handle:db = Connect();
if (db == INVALID_HANDLE)
if (db == null)
{
ReplyToCommand(client, "[SM] %t", "Could not connect to database");
return Plugin_Handled;
@ -383,7 +383,7 @@ public Action:Command_UpdateTables(args)
ReplyToCommand(client, "[SM] Unknown driver type, cannot upgrade.");
}
CloseHandle(db);
delete db;
return Plugin_Handled;
}
@ -408,7 +408,7 @@ public Action:Command_SetAdminGroups(client, args)
}
new Handle:db = Connect();
if (db == INVALID_HANDLE)
if (db == null)
{
ReplyToCommand(client, "[SM] %t", "Could not connect to database");
return Plugin_Handled;
@ -427,7 +427,7 @@ public Action:Command_SetAdminGroups(client, args)
safe_identity);
new Handle:hQuery;
if ((hQuery = SQL_Query(db, query)) == INVALID_HANDLE)
if ((hQuery = SQL_Query(db, query)) == null)
{
return DoError(client, db, query, "Admin lookup query failed");
}
@ -435,14 +435,14 @@ public Action:Command_SetAdminGroups(client, args)
if (!SQL_FetchRow(hQuery))
{
ReplyToCommand(client, "[SM] %t", "SQL Admin not found");
CloseHandle(hQuery);
CloseHandle(db);
delete hQuery;
delete db;
return Plugin_Handled;
}
new id = SQL_FetchInt(hQuery, 0);
CloseHandle(hQuery);
delete hQuery;
/**
* First delete all of the user's existing groups.
@ -456,7 +456,7 @@ public Action:Command_SetAdminGroups(client, args)
if (args < 3)
{
ReplyToCommand(client, "[SM] %t", "SQL Admin groups reset");
CloseHandle(db);
delete db;
return Plugin_Handled;
}
@ -464,7 +464,7 @@ public Action:Command_SetAdminGroups(client, args)
new Handle:hAddQuery, Handle:hFindQuery;
Format(query, sizeof(query), "SELECT id FROM sm_groups WHERE name = ?");
if ((hFindQuery = SQL_PrepareQuery(db, query, error, sizeof(error))) == INVALID_HANDLE)
if ((hFindQuery = SQL_PrepareQuery(db, query, error, sizeof(error))) == null)
{
return DoStmtError(client, db, query, error, "Group search prepare failed");
}
@ -473,9 +473,9 @@ public Action:Command_SetAdminGroups(client, args)
sizeof(query),
"INSERT INTO sm_admins_groups (admin_id, group_id, inherit_order) VALUES (%d, ?, ?)",
id);
if ((hAddQuery = SQL_PrepareQuery(db, query, error, sizeof(error))) == INVALID_HANDLE)
if ((hAddQuery = SQL_PrepareQuery(db, query, error, sizeof(error))) == null)
{
CloseHandle(hFindQuery);
delete hFindQuery;
return DoStmtError(client, db, query, error, "Add admin group prepare failed");
}
@ -502,9 +502,9 @@ public Action:Command_SetAdminGroups(client, args)
}
}
CloseHandle(hAddQuery);
CloseHandle(hFindQuery);
CloseHandle(db);
delete hAddQuery;
delete hFindQuery;
delete db;
if (inherit_order == 1)
{
@ -525,7 +525,7 @@ public Action:Command_DelGroup(client, args)
}
new Handle:db = Connect();
if (db == INVALID_HANDLE)
if (db == null)
{
ReplyToCommand(client, "[SM] %t", "Could not connect to database");
return Plugin_Handled;
@ -550,7 +550,7 @@ public Action:Command_DelGroup(client, args)
new Handle:hQuery;
Format(query, sizeof(query), "SELECT id FROM sm_groups WHERE name = '%s'", safe_name);
if ((hQuery = SQL_Query(db, query)) == INVALID_HANDLE)
if ((hQuery = SQL_Query(db, query)) == null)
{
return DoError(client, db, query, "Group retrieval query failed");
}
@ -558,14 +558,14 @@ public Action:Command_DelGroup(client, args)
if (!SQL_FetchRow(hQuery))
{
ReplyToCommand(client, "[SM] %t", "SQL Group not found");
CloseHandle(hQuery);
CloseHandle(db);
delete hQuery;
delete db;
return Plugin_Handled;
}
new id = SQL_FetchInt(hQuery, 0);
CloseHandle(hQuery);
delete hQuery;
/* Delete admin inheritance for this group */
Format(query, sizeof(query), "DELETE FROM sm_admins_groups WHERE group_id = %d", id);
@ -597,7 +597,7 @@ public Action:Command_DelGroup(client, args)
ReplyToCommand(client, "[SM] %t", "SQL Group deleted");
CloseHandle(db);
delete db;
return Plugin_Handled;
}
@ -623,7 +623,7 @@ public Action:Command_AddGroup(client, args)
}
new Handle:db = Connect();
if (db == INVALID_HANDLE)
if (db == null)
{
ReplyToCommand(client, "[SM] %t", "Could not connect to database");
return Plugin_Handled;
@ -637,7 +637,7 @@ public Action:Command_AddGroup(client, args)
new Handle:hQuery;
decl String:query[256];
Format(query, sizeof(query), "SELECT id FROM sm_groups WHERE name = '%s'", safe_name);
if ((hQuery = SQL_Query(db, query)) == INVALID_HANDLE)
if ((hQuery = SQL_Query(db, query)) == null)
{
return DoError(client, db, query, "Group retrieval query failed");
}
@ -645,12 +645,12 @@ public Action:Command_AddGroup(client, args)
if (SQL_GetRowCount(hQuery) > 0)
{
ReplyToCommand(client, "[SM] %t", "SQL Group already exists");
CloseHandle(hQuery);
CloseHandle(db);
delete hQuery;
delete db;
return Plugin_Handled;
}
CloseHandle(hQuery);
delete hQuery;
decl String:flags[30];
decl String:safe_flags[64];
@ -671,7 +671,7 @@ public Action:Command_AddGroup(client, args)
ReplyToCommand(client, "[SM] %t", "SQL Group added");
CloseHandle(db);
delete db;
return Plugin_Handled;
}
@ -697,7 +697,7 @@ public Action:Command_DelAdmin(client, args)
}
new Handle:db = Connect();
if (db == INVALID_HANDLE)
if (db == null)
{
ReplyToCommand(client, "[SM] %t", "Could not connect to database");
return Plugin_Handled;
@ -716,7 +716,7 @@ public Action:Command_DelAdmin(client, args)
safe_identity);
new Handle:hQuery;
if ((hQuery = SQL_Query(db, query)) == INVALID_HANDLE)
if ((hQuery = SQL_Query(db, query)) == null)
{
return DoError(client, db, query, "Admin lookup query failed");
}
@ -724,14 +724,14 @@ public Action:Command_DelAdmin(client, args)
if (!SQL_FetchRow(hQuery))
{
ReplyToCommand(client, "[SM] %t", "SQL Admin not found");
CloseHandle(hQuery);
CloseHandle(db);
delete hQuery;
delete db;
return Plugin_Handled;
}
new id = SQL_FetchInt(hQuery, 0);
CloseHandle(hQuery);
delete hQuery;
/* Delete group bindings */
Format(query, sizeof(query), "DELETE FROM sm_admins_groups WHERE admin_id = %d", id);
@ -746,7 +746,7 @@ public Action:Command_DelAdmin(client, args)
return DoError(client, db, query, "Admin deletion query failed");
}
CloseHandle(db);
delete db;
ReplyToCommand(client, "[SM] %t", "SQL Admin deleted");
@ -792,7 +792,7 @@ public Action:Command_AddAdmin(client, args)
decl String:query[256];
new Handle:hQuery;
new Handle:db = Connect();
if (db == INVALID_HANDLE)
if (db == null)
{
ReplyToCommand(client, "[SM] %t", "Could not connect to database");
return Plugin_Handled;
@ -801,7 +801,7 @@ public Action:Command_AddAdmin(client, args)
SQL_EscapeString(db, identity, safe_identity, sizeof(safe_identity));
Format(query, sizeof(query), "SELECT id FROM sm_admins WHERE authtype = '%s' AND identity = '%s'", authtype, identity);
if ((hQuery = SQL_Query(db, query)) == INVALID_HANDLE)
if ((hQuery = SQL_Query(db, query)) == null)
{
return DoError(client, db, query, "Admin retrieval query failed");
}
@ -809,12 +809,12 @@ public Action:Command_AddAdmin(client, args)
if (SQL_GetRowCount(hQuery) > 0)
{
ReplyToCommand(client, "[SM] %t", "SQL Admin already exists");
CloseHandle(hQuery);
CloseHandle(db);
delete hQuery;
delete db;
return Plugin_Handled;
}
CloseHandle(hQuery);
delete hQuery;
decl String:alias[64];
decl String:safe_alias[140];
@ -852,7 +852,7 @@ public Action:Command_AddAdmin(client, args)
ReplyToCommand(client, "[SM] %t", "SQL Admin added");
CloseHandle(db);
delete db;
return Plugin_Handled;
}
@ -878,7 +878,7 @@ stock Action:DoError(client, Handle:db, const String:query[], const String:msg[]
SQL_GetError(db, error, sizeof(error));
LogError("%s: %s", msg, error);
LogError("Query dump: %s", query);
CloseHandle(db);
delete db;
ReplyToCommand(client, "[SM] %t", "Failed to query database");
return Plugin_Handled;
}
@ -887,7 +887,7 @@ stock Action:DoStmtError(client, Handle:db, const String:query[], const String:e
{
LogError("%s: %s", msg, error);
LogError("Query dump: %s", query);
CloseHandle(db);
delete db;
ReplyToCommand(client, "[SM] %t", "Failed to query database");
return Plugin_Handled;
}

View File

@ -18,7 +18,7 @@ public Plugin:myinfo =
#define STRING_RPLC_LOOPS 2000
new Float:g_dict_time
new Handle:g_Prof = INVALID_HANDLE
new Handle:g_Prof = null
public OnPluginStart()
{

View File

@ -63,7 +63,7 @@ public OnReentrantCallReceived(num, String:str[])
PrintToServer("num = %d (expected: %d)", num, 7);
PrintToServer("str[] = \"%s\" (expected: \"%s\")", str, "nana");
new Function:func = GetFunctionByName(INVALID_HANDLE, "OnReentrantCallReceivedTwo");
new Function:func = GetFunctionByName(null, "OnReentrantCallReceivedTwo");
if (func == INVALID_FUNCTION)
{
@ -73,7 +73,7 @@ public OnReentrantCallReceived(num, String:str[])
PrintToServer("Calling OnReentrantCallReceivedTwo...");
Call_StartFunction(INVALID_HANDLE, func);
Call_StartFunction(null, func);
Call_PushFloat(8.0);
err = Call_Finish(ret);
@ -105,7 +105,7 @@ public Action:Command_CallFunc(args)
new err;
new ret;
new Function:func = GetFunctionByName(INVALID_HANDLE, "OnCallFuncReceived");
new Function:func = GetFunctionByName(null, "OnCallFuncReceived");
if (func == INVALID_FUNCTION)
{
@ -115,7 +115,7 @@ public Action:Command_CallFunc(args)
PrintToServer("Calling OnCallFuncReceived...");
Call_StartFunction(INVALID_HANDLE, func);
Call_StartFunction(null, func);
Call_PushCell(5);
Call_PushFloat(7.17);
Call_PushString(what);
@ -146,7 +146,7 @@ public Action:Command_CallFunc(args)
public Action:Command_ReentrantCallFunc(args)
{
new err, ret;
new Function:func = GetFunctionByName(INVALID_HANDLE, "OnReentrantCallReceived");
new Function:func = GetFunctionByName(null, "OnReentrantCallReceived");
if (func == INVALID_FUNCTION)
{
@ -156,7 +156,7 @@ public Action:Command_ReentrantCallFunc(args)
PrintToServer("Calling OnReentrantCallReceived...");
Call_StartFunction(INVALID_HANDLE, func);
Call_StartFunction(null, func);
Call_PushCell(7);
Call_PushString("nana");
err = Call_Finish(ret);

View File

@ -9,8 +9,8 @@ public Plugin:myinfo =
url = "http://www.sourcemod.net/"
};
new Handle:g_GlobalFwd = INVALID_HANDLE;
new Handle:g_PrivateFwd = INVALID_HANDLE;
new Handle:g_GlobalFwd = null;
new Handle:g_PrivateFwd = null;
public OnPluginStart()
{
@ -22,20 +22,20 @@ public OnPluginStart()
public OnPluginEnd()
{
CloseHandle(g_GlobalFwd);
CloseHandle(g_PrivateFwd);
delete g_GlobalFwd;
delete g_PrivateFwd;
}
public Action:Command_CreateGlobalForward(args)
{
if (g_GlobalFwd != INVALID_HANDLE)
if (g_GlobalFwd != null)
{
CloseHandle(g_GlobalFwd);
delete g_GlobalFwd;
}
g_GlobalFwd = CreateGlobalForward("OnGlobalForward", ET_Ignore, Param_Any, Param_Cell, Param_Float, Param_String, Param_Array, Param_CellByRef, Param_FloatByRef);
if (g_GlobalFwd == INVALID_HANDLE)
if (g_GlobalFwd == null)
{
PrintToServer("Failed to create global forward!");
}
@ -48,14 +48,14 @@ public Action:Command_CreatePrivateForward(args)
new Handle:pl;
new Function:func;
if (g_PrivateFwd != INVALID_HANDLE)
if (g_PrivateFwd != null)
{
CloseHandle(g_PrivateFwd);
delete g_PrivateFwd;
}
g_PrivateFwd = CreateForward(ET_Hook, Param_Cell, Param_String, Param_VarArgs);
if (g_PrivateFwd == INVALID_HANDLE)
if (g_PrivateFwd == null)
{
PrintToServer("Failed to create private forward!")
}
@ -92,7 +92,7 @@ public Action:Command_ExecGlobalForward(args)
new Float:b = 4.215;
new err, ret;
if (g_GlobalFwd == INVALID_HANDLE)
if (g_GlobalFwd == null)
{
PrintToServer("Failed to execute global forward. Create it first.");
return Plugin_Handled;
@ -124,7 +124,7 @@ public Action:Command_ExecPrivateForward(args)
{
new err, ret;
if (g_PrivateFwd == INVALID_HANDLE)
if (g_PrivateFwd == null)
{
PrintToServer("Failed to execute private forward. Create it first.");
return Plugin_Handled;

View File

@ -20,7 +20,7 @@ public OnPluginStart()
RegServerCmd("sql_test_txn", Command_TestTxn)
new Handle:hibernate = FindConVar("sv_hibernate_when_empty");
if (hibernate != INVALID_HANDLE) {
if (hibernate != null) {
ServerCommand("sv_hibernate_when_empty 0");
}
}
@ -63,23 +63,23 @@ public Action:Command_TestSql1(args)
{
new String:error[255]
new Handle:db = SQL_DefConnect(error, sizeof(error))
if (db == INVALID_HANDLE)
if (db == null)
{
PrintToServer("Failed to connect: %s", error)
return Plugin_Handled
}
new Handle:query = SQL_Query(db, "SELECT * FROM gab")
if (query == INVALID_HANDLE)
if (query == null)
{
SQL_GetError(db, error, sizeof(error))
PrintToServer("Failed to query: %s", error)
} else {
PrintQueryData(query)
CloseHandle(query)
delete query
}
CloseHandle(db)
delete db
return Plugin_Handled;
}
@ -88,14 +88,14 @@ public Action:Command_TestSql2(args)
{
new String:error[255]
new Handle:db = SQL_DefConnect(error, sizeof(error))
if (db == INVALID_HANDLE)
if (db == null)
{
PrintToServer("Failed to connect: %s", error)
return Plugin_Handled
}
new Handle:stmt = SQL_PrepareQuery(db, "SELECT * FROM gab WHERE gaben > ?", error, sizeof(error))
if (stmt == INVALID_HANDLE)
if (stmt == null)
{
PrintToServer("Failed to prepare query: %s", error)
} else {
@ -107,22 +107,22 @@ public Action:Command_TestSql2(args)
} else {
PrintQueryData(stmt)
}
CloseHandle(stmt)
delete stmt
}
CloseHandle(db)
delete db
return Plugin_Handled;
}
new Handle:g_ThreadedHandle = INVALID_HANDLE;
new Handle:g_ThreadedHandle = null;
public CallbackTest3(Handle:owner, Handle:hndl, const String:error[], any:data)
{
PrintToServer("CallbackTest1() (owner %x) (hndl %x) (error \"%s\") (data %d)", owner, hndl, error, data);
if (g_ThreadedHandle != INVALID_HANDLE && hndl != INVALID_HANDLE)
if (g_ThreadedHandle != null && hndl != null)
{
CloseHandle(hndl);
delete hndl;
} else {
g_ThreadedHandle = hndl;
}
@ -130,7 +130,7 @@ public CallbackTest3(Handle:owner, Handle:hndl, const String:error[], any:data)
public Action:Command_TestSql3(args)
{
if (g_ThreadedHandle != INVALID_HANDLE)
if (g_ThreadedHandle != null)
{
PrintToServer("A threaded connection already exists, run the next test");
return Plugin_Handled;
@ -149,14 +149,14 @@ public Action:Command_TestSql4(args)
{
SQL_LockDatabase(g_ThreadedHandle);
new Handle:query = SQL_Query(g_ThreadedHandle, "SELECT * FROM gab")
if (query == INVALID_HANDLE)
if (query == null)
{
new String:error[255];
SQL_GetError(g_ThreadedHandle, error, sizeof(error))
PrintToServer("Failed to query: %s", error)
} else {
PrintQueryData(query)
CloseHandle(query)
delete query
}
SQL_UnlockDatabase(g_ThreadedHandle);
@ -165,7 +165,7 @@ public Action:Command_TestSql4(args)
public CallbackTest5(Handle:owner, Handle:hndl, const String:error[], any:data)
{
if (hndl == INVALID_HANDLE)
if (hndl == null)
{
PrintToServer("Failed to query: %s", error)
} else {
@ -176,7 +176,7 @@ public CallbackTest5(Handle:owner, Handle:hndl, const String:error[], any:data)
public CallbackTest6(Handle:owner, Handle:hndl, const String:error[], any:data)
{
if (hndl == INVALID_HANDLE)
if (hndl == null)
{
PrintToServer("Failed to query: %s", error)
} else {
@ -187,7 +187,7 @@ public CallbackTest6(Handle:owner, Handle:hndl, const String:error[], any:data)
public CallbackTest7(Handle:owner, Handle:hndl, const String:error[], any:data)
{
if (hndl == INVALID_HANDLE)
if (hndl == null)
{
PrintToServer("Failed to query: %s", error)
} else {
@ -266,7 +266,7 @@ public Action:Command_TestTxn(args)
{
new String:error[256];
new Handle:db = SQL_Connect("storage-local", false, error, sizeof(error));
if (db == INVALID_HANDLE) {
if (db == null) {
ThrowError("ERROR: %s", error);
return Plugin_Handled;
}
@ -305,7 +305,7 @@ public Action:Command_TestTxn(args)
// Make sure the transaction was rolled back - COUNT should be 5.
txn = SQL_CreateTransaction();
AssertEq("CloneHandle", _:CloneHandle(txn), _:INVALID_HANDLE);
AssertEq("CloneHandle", _:CloneHandle(txn), _:null);
txn.AddQuery("SELECT COUNT(id) FROM egg");
SQL_ExecuteTransaction(
db,

View File

@ -40,7 +40,7 @@ public Action:Command_GetString(args)
LogMessage("Value of %s: %s", arg2, value);
CloseHandle(strct);
delete strct;
return Plugin_Handled;
}
@ -61,7 +61,7 @@ public Action:Command_SetString(args)
new Handle:strct = GetWeaponStruct(arg1);
SetStructString(strct, arg2, value);
CloseHandle(strct);
delete strct;
return Plugin_Handled;
@ -84,7 +84,7 @@ public Action:Command_GetInt(args)
LogMessage("Value of %s: %i", arg2, value);
CloseHandle(strct);
delete strct;
return Plugin_Handled;
}
@ -106,7 +106,7 @@ public Action:Command_SetInt(args)
SetStructInt(strct, arg2, StringToInt(value));
CloseHandle(strct);
delete strct;
return Plugin_Handled;
}
@ -128,7 +128,7 @@ public Action:Command_GetFloat(args)
LogMessage("Value of %s: %f", arg2, value);
CloseHandle(strct);
delete strct;
return Plugin_Handled;
}
@ -150,7 +150,7 @@ public Action:Command_SetFloat(args)
SetStructFloat(strct, arg2, StringToFloat(value));
CloseHandle(strct);
delete strct;
return Plugin_Handled;
}