Update fun plugins for transitional syntax (#508)

This commit is contained in:
ErikMinekus 2016-05-11 16:56:12 +02:00 committed by Nicholas Hastings
parent d9fb0ba64e
commit 6d9f46e983
15 changed files with 428 additions and 424 deletions

View File

@ -38,7 +38,9 @@
#undef REQUIRE_PLUGIN #undef REQUIRE_PLUGIN
#include <adminmenu> #include <adminmenu>
public Plugin:myinfo = #pragma newdecls required
public Plugin myinfo =
{ {
name = "Fun Commands", name = "Fun Commands",
author = "AlliedModders LLC", author = "AlliedModders LLC",
@ -51,34 +53,34 @@ public Plugin:myinfo =
TopMenu hTopMenu; TopMenu hTopMenu;
// Sounds // Sounds
new String:g_BlipSound[PLATFORM_MAX_PATH]; char g_BlipSound[PLATFORM_MAX_PATH];
new String:g_BeepSound[PLATFORM_MAX_PATH]; char g_BeepSound[PLATFORM_MAX_PATH];
new String:g_FinalSound[PLATFORM_MAX_PATH]; char g_FinalSound[PLATFORM_MAX_PATH];
new String:g_BoomSound[PLATFORM_MAX_PATH]; char g_BoomSound[PLATFORM_MAX_PATH];
new String:g_FreezeSound[PLATFORM_MAX_PATH]; char g_FreezeSound[PLATFORM_MAX_PATH];
// Following are model indexes for temp entities // Following are model indexes for temp entities
new g_BeamSprite = -1; int g_BeamSprite = -1;
new g_BeamSprite2 = -1; int g_BeamSprite2 = -1;
new g_HaloSprite = -1; int g_HaloSprite = -1;
new g_GlowSprite = -1; int g_GlowSprite = -1;
new g_ExplosionSprite = -1; int g_ExplosionSprite = -1;
// Basic color arrays for temp entities // Basic color arrays for temp entities
new redColor[4] = {255, 75, 75, 255}; int redColor[4] = {255, 75, 75, 255};
new orangeColor[4] = {255, 128, 0, 255}; int orangeColor[4] = {255, 128, 0, 255};
new greenColor[4] = {75, 255, 75, 255}; int greenColor[4] = {75, 255, 75, 255};
new blueColor[4] = {75, 75, 255, 255}; int blueColor[4] = {75, 75, 255, 255};
new whiteColor[4] = {255, 255, 255, 255}; int whiteColor[4] = {255, 255, 255, 255};
new greyColor[4] = {128, 128, 128, 255}; int greyColor[4] = {128, 128, 128, 255};
// UserMessageId for Fade. // UserMessageId for Fade.
new UserMsg:g_FadeUserMsgId; UserMsg g_FadeUserMsgId;
// Serial Generator for Timer Safety // Serial Generator for Timer Safety
new g_Serial_Gen = 0; int g_Serial_Gen = 0;
new EngineVersion:g_GameEngine = Engine_Unknown; EngineVersion g_GameEngine = Engine_Unknown;
// Flags used in various timers // Flags used in various timers
#define DEFAULT_TIMER_FLAGS TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE #define DEFAULT_TIMER_FLAGS TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE
@ -93,7 +95,7 @@ new EngineVersion:g_GameEngine = Engine_Unknown;
#include "funcommands/noclip.sp" #include "funcommands/noclip.sp"
#include "funcommands/drug.sp" #include "funcommands/drug.sp"
public OnPluginStart() public void OnPluginStart()
{ {
if (FindPluginByFile("basefuncommands.smx") != null) if (FindPluginByFile("basefuncommands.smx") != null)
{ {
@ -105,9 +107,9 @@ public OnPluginStart()
g_GameEngine = GetEngineVersion(); g_GameEngine = GetEngineVersion();
g_FadeUserMsgId = GetUserMessageId("Fade"); g_FadeUserMsgId = GetUserMessageId("Fade");
RegisterCvars( ); RegisterCvars();
RegisterCmds( ); RegisterCmds();
HookEvents( ); HookEvents();
/* Account for late loading */ /* Account for late loading */
TopMenu topmenu; TopMenu topmenu;
@ -117,7 +119,7 @@ public OnPluginStart()
} }
} }
RegisterCvars( ) void RegisterCvars()
{ {
// beacon // beacon
g_Cvar_BeaconRadius = CreateConVar("sm_beacon_radius", "375", "Sets the radius for beacon's light rings.", 0, true, 50.0, true, 1500.0); g_Cvar_BeaconRadius = CreateConVar("sm_beacon_radius", "375", "Sets the radius for beacon's light rings.", 0, true, 50.0, true, 1500.0);
@ -142,7 +144,7 @@ RegisterCvars( )
AutoExecConfig(true, "funcommands"); AutoExecConfig(true, "funcommands");
} }
RegisterCmds( ) void RegisterCmds()
{ {
RegAdminCmd("sm_beacon", Command_Beacon, ADMFLAG_SLAY, "sm_beacon <#userid|name> [0/1]"); RegAdminCmd("sm_beacon", Command_Beacon, ADMFLAG_SLAY, "sm_beacon <#userid|name> [0/1]");
RegAdminCmd("sm_timebomb", Command_TimeBomb, ADMFLAG_SLAY, "sm_timebomb <#userid|name> [0/1]"); RegAdminCmd("sm_timebomb", Command_TimeBomb, ADMFLAG_SLAY, "sm_timebomb <#userid|name> [0/1]");
@ -156,9 +158,9 @@ RegisterCmds( )
RegAdminCmd("sm_drug", Command_Drug, ADMFLAG_SLAY, "sm_drug <#userid|name> [0/1]"); RegAdminCmd("sm_drug", Command_Drug, ADMFLAG_SLAY, "sm_drug <#userid|name> [0/1]");
} }
HookEvents( ) void HookEvents()
{ {
decl String:folder[64]; char folder[64];
GetGameFolderName(folder, sizeof(folder)); GetGameFolderName(folder, sizeof(folder));
if (strcmp(folder, "tf") == 0) if (strcmp(folder, "tf") == 0)
@ -177,9 +179,9 @@ HookEvents( )
} }
} }
public OnMapStart() public void OnMapStart()
{ {
new Handle:gameConfig = LoadGameConfigFile("funcommands.games"); Handle gameConfig = LoadGameConfigFile("funcommands.games");
if (gameConfig == null) if (gameConfig == null)
{ {
SetFailState("Unable to load game config funcommands.games"); SetFailState("Unable to load game config funcommands.games");
@ -211,7 +213,7 @@ public OnMapStart()
PrecacheSound(g_FreezeSound, true); PrecacheSound(g_FreezeSound, true);
} }
new String:buffer[PLATFORM_MAX_PATH]; char buffer[PLATFORM_MAX_PATH];
if (GameConfGetKeyValue(gameConfig, "SpriteBeam", buffer, sizeof(buffer)) && buffer[0]) if (GameConfGetKeyValue(gameConfig, "SpriteBeam", buffer, sizeof(buffer)) && buffer[0])
{ {
g_BeamSprite = PrecacheModel(buffer); g_BeamSprite = PrecacheModel(buffer);
@ -240,25 +242,25 @@ public OnMapStart()
delete gameConfig; delete gameConfig;
} }
public OnMapEnd() public void OnMapEnd()
{ {
KillAllBeacons( ); KillAllBeacons();
KillAllTimeBombs(); KillAllTimeBombs();
KillAllFireBombs(); KillAllFireBombs();
KillAllFreezes(); KillAllFreezes();
KillAllDrugs(); KillAllDrugs();
} }
public Action:Event_RoundEnd(Handle:event,const String:name[],bool:dontBroadcast) public Action Event_RoundEnd(Event event, const char[] name, bool dontBroadcast)
{ {
KillAllBeacons( ); KillAllBeacons();
KillAllTimeBombs(); KillAllTimeBombs();
KillAllFireBombs(); KillAllFireBombs();
KillAllFreezes(); KillAllFreezes();
KillAllDrugs(); KillAllDrugs();
} }
public OnAdminMenuReady(Handle aTopMenu) public void OnAdminMenuReady(Handle aTopMenu)
{ {
TopMenu topmenu = TopMenu.FromHandle(aTopMenu); TopMenu topmenu = TopMenu.FromHandle(aTopMenu);
@ -295,4 +297,3 @@ void AddTranslatedMenuItem(Menu menu, const char[] opt, const char[] phrase, int
Format(buffer, sizeof(buffer), "%T", phrase, client); Format(buffer, sizeof(buffer), "%T", phrase, client);
menu.AddItem(opt, buffer); menu.AddItem(opt, buffer);
} }

View File

@ -31,17 +31,17 @@
* Version: $Id$ * Version: $Id$
*/ */
new g_BeaconSerial[MAXPLAYERS+1] = { 0, ... }; int g_BeaconSerial[MAXPLAYERS+1] = { 0, ... };
ConVar g_Cvar_BeaconRadius; ConVar g_Cvar_BeaconRadius;
CreateBeacon(client) void CreateBeacon(int client)
{ {
g_BeaconSerial[client] = ++g_Serial_Gen; g_BeaconSerial[client] = ++g_Serial_Gen;
CreateTimer(1.0, Timer_Beacon, client | (g_Serial_Gen << 7), DEFAULT_TIMER_FLAGS); CreateTimer(1.0, Timer_Beacon, client | (g_Serial_Gen << 7), DEFAULT_TIMER_FLAGS);
} }
KillBeacon(client) void KillBeacon(int client)
{ {
g_BeaconSerial[client] = 0; g_BeaconSerial[client] = 0;
@ -51,15 +51,15 @@ KillBeacon(client)
} }
} }
KillAllBeacons() void KillAllBeacons()
{ {
for (new i = 1; i <= MaxClients; i++) for (int i = 1; i <= MaxClients; i++)
{ {
KillBeacon(i); KillBeacon(i);
} }
} }
PerformBeacon(client, target) void PerformBeacon(int client, int target)
{ {
if (g_BeaconSerial[target] == 0) if (g_BeaconSerial[target] == 0)
{ {
@ -73,10 +73,10 @@ PerformBeacon(client, target)
} }
} }
public Action:Timer_Beacon(Handle:timer, any:value) public Action Timer_Beacon(Handle timer, any value)
{ {
new client = value & 0x7f; int client = value & 0x7f;
new serial = value >> 7; int serial = value >> 7;
if (!IsClientInGame(client) if (!IsClientInGame(client)
|| !IsPlayerAlive(client) || !IsPlayerAlive(client)
@ -122,12 +122,12 @@ public Action:Timer_Beacon(Handle:timer, any:value)
return Plugin_Continue; return Plugin_Continue;
} }
public AdminMenu_Beacon(Handle:topmenu, public void AdminMenu_Beacon(TopMenu topmenu,
TopMenuAction:action, TopMenuAction action,
TopMenuObject:object_id, TopMenuObject object_id,
param, int param,
String:buffer[], char[] buffer,
maxlength) int maxlength)
{ {
if (action == TopMenuAction_DisplayOption) if (action == TopMenuAction_DisplayOption)
{ {
@ -139,11 +139,11 @@ public AdminMenu_Beacon(Handle:topmenu,
} }
} }
DisplayBeaconMenu(client) void DisplayBeaconMenu(int client)
{ {
Menu menu = CreateMenu(MenuHandler_Beacon); Menu menu = new Menu(MenuHandler_Beacon);
decl String:title[100]; char title[100];
Format(title, sizeof(title), "%T:", "Beacon player", client); Format(title, sizeof(title), "%T:", "Beacon player", client);
menu.SetTitle(title); menu.SetTitle(title);
menu.ExitBackButton = true; menu.ExitBackButton = true;
@ -153,7 +153,7 @@ DisplayBeaconMenu(client)
menu.Display(client, MENU_TIME_FOREVER); menu.Display(client, MENU_TIME_FOREVER);
} }
public MenuHandler_Beacon(Menu menu, MenuAction action, int param1, int param2) public int MenuHandler_Beacon(Menu menu, MenuAction action, int param1, int param2)
{ {
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
@ -168,8 +168,8 @@ public MenuHandler_Beacon(Menu menu, MenuAction action, int param1, int param2)
} }
else if (action == MenuAction_Select) else if (action == MenuAction_Select)
{ {
decl String:info[32]; char info[32];
new userid, target; int userid, target;
menu.GetItem(param2, info, sizeof(info)); menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info); userid = StringToInt(info);
@ -184,7 +184,7 @@ public MenuHandler_Beacon(Menu menu, MenuAction action, int param1, int param2)
} }
else else
{ {
new String:name[MAX_NAME_LENGTH]; char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name)); GetClientName(target, name, sizeof(name));
PerformBeacon(param1, target); PerformBeacon(param1, target);
@ -199,7 +199,7 @@ public MenuHandler_Beacon(Menu menu, MenuAction action, int param1, int param2)
} }
} }
public Action:Command_Beacon(client, args) public Action Command_Beacon(int client, int args)
{ {
if (args < 1) if (args < 1)
{ {
@ -207,11 +207,12 @@ public Action:Command_Beacon(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
decl String:arg[65]; char arg[65];
GetCmdArg(1, arg, sizeof(arg)); GetCmdArg(1, arg, sizeof(arg));
decl String:target_name[MAX_TARGET_LENGTH]; char target_name[MAX_TARGET_LENGTH];
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString( if ((target_count = ProcessTargetString(
arg, arg,
@ -227,7 +228,7 @@ public Action:Command_Beacon(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
for (new i = 0; i < target_count; i++) for (int i = 0; i < target_count; i++)
{ {
PerformBeacon(client, target_list[i]); PerformBeacon(client, target_list[i]);
} }

View File

@ -31,16 +31,16 @@
* Version: $Id$ * Version: $Id$
*/ */
new g_BlindTarget[MAXPLAYERS+1]; int g_BlindTarget[MAXPLAYERS+1];
PerformBlind(client, target, amount) void PerformBlind(int client, int target, int amount)
{ {
new targets[2]; int targets[2];
targets[0] = target; targets[0] = target;
new duration = 1536; int duration = 1536;
new holdtime = 1536; int holdtime = 1536;
new flags; int flags;
if (amount == 0) if (amount == 0)
{ {
flags = (0x0001 | 0x0010); flags = (0x0001 | 0x0010);
@ -50,7 +50,7 @@ PerformBlind(client, target, amount)
flags = (0x0002 | 0x0008); flags = (0x0002 | 0x0008);
} }
new color[4] = { 0, 0, 0, 0 }; int color[4] = { 0, 0, 0, 0 };
color[3] = amount; color[3] = amount;
Handle message = StartMessageEx(g_FadeUserMsgId, targets, 1); Handle message = StartMessageEx(g_FadeUserMsgId, targets, 1);
@ -79,12 +79,12 @@ PerformBlind(client, target, amount)
LogAction(client, target, "\"%L\" set blind on \"%L\", amount %d.", client, target, amount); LogAction(client, target, "\"%L\" set blind on \"%L\", amount %d.", client, target, amount);
} }
public AdminMenu_Blind(Handle:topmenu, public void AdminMenu_Blind(TopMenu topmenu,
TopMenuAction:action, TopMenuAction action,
TopMenuObject:object_id, TopMenuObject object_id,
param, int param,
String:buffer[], char[] buffer,
maxlength) int maxlength)
{ {
if (action == TopMenuAction_DisplayOption) if (action == TopMenuAction_DisplayOption)
{ {
@ -101,11 +101,11 @@ public AdminMenu_Blind(Handle:topmenu,
} }
} }
DisplayBlindMenu(client) void DisplayBlindMenu(int client)
{ {
Menu menu = CreateMenu(MenuHandler_Blind); Menu menu = new Menu(MenuHandler_Blind);
decl String:title[100]; char title[100];
Format(title, sizeof(title), "%T:", "Blind player", client); Format(title, sizeof(title), "%T:", "Blind player", client);
menu.SetTitle(title); menu.SetTitle(title);
menu.ExitBackButton = true; menu.ExitBackButton = true;
@ -115,11 +115,11 @@ DisplayBlindMenu(client)
menu.Display(client, MENU_TIME_FOREVER); menu.Display(client, MENU_TIME_FOREVER);
} }
DisplayAmountMenu(client) void DisplayAmountMenu(int client)
{ {
Menu menu = CreateMenu(MenuHandler_Amount); Menu menu = new Menu(MenuHandler_Amount);
decl String:title[100]; char title[100];
Format(title, sizeof(title), "%T: %N", "Blind amount", client, GetClientOfUserId(g_BlindTarget[client])); Format(title, sizeof(title), "%T: %N", "Blind amount", client, GetClientOfUserId(g_BlindTarget[client]));
menu.SetTitle(title); menu.SetTitle(title);
menu.ExitBackButton = true; menu.ExitBackButton = true;
@ -131,7 +131,7 @@ DisplayAmountMenu(client)
menu.Display(client, MENU_TIME_FOREVER); menu.Display(client, MENU_TIME_FOREVER);
} }
public MenuHandler_Blind(Menu menu, MenuAction action, int param1, int param2) public int MenuHandler_Blind(Menu menu, MenuAction action, int param1, int param2)
{ {
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
@ -146,8 +146,8 @@ public MenuHandler_Blind(Menu menu, MenuAction action, int param1, int param2)
} }
else if (action == MenuAction_Select) else if (action == MenuAction_Select)
{ {
decl String:info[32]; char info[32];
new userid, target; int userid, target;
menu.GetItem(param2, info, sizeof(info)); menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info); userid = StringToInt(info);
@ -177,7 +177,7 @@ public MenuHandler_Blind(Menu menu, MenuAction action, int param1, int param2)
return; return;
} }
public MenuHandler_Amount(Menu menu, MenuAction action, int param1, int param2) public int MenuHandler_Amount(Menu menu, MenuAction action, int param1, int param2)
{ {
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
@ -192,8 +192,8 @@ public MenuHandler_Amount(Menu menu, MenuAction action, int param1, int param2)
} }
else if (action == MenuAction_Select) else if (action == MenuAction_Select)
{ {
decl String:info[32]; char info[32];
new amount, target; int amount, target;
menu.GetItem(param2, info, sizeof(info)); menu.GetItem(param2, info, sizeof(info));
amount = StringToInt(info); amount = StringToInt(info);
@ -208,7 +208,7 @@ public MenuHandler_Amount(Menu menu, MenuAction action, int param1, int param2)
} }
else else
{ {
new String:name[MAX_NAME_LENGTH]; char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name)); GetClientName(target, name, sizeof(name));
PerformBlind(param1, target, amount); PerformBlind(param1, target, amount);
@ -223,8 +223,7 @@ public MenuHandler_Amount(Menu menu, MenuAction action, int param1, int param2)
} }
} }
public Action Command_Blind(int client, int args)
public Action:Command_Blind(client, args)
{ {
if (args < 1) if (args < 1)
{ {
@ -232,13 +231,13 @@ public Action:Command_Blind(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
decl String:arg[65]; char arg[65];
GetCmdArg(1, arg, sizeof(arg)); GetCmdArg(1, arg, sizeof(arg));
new amount = 0; int amount = 0;
if (args > 1) if (args > 1)
{ {
decl String:arg2[20]; char arg2[20];
GetCmdArg(2, arg2, sizeof(arg2)); GetCmdArg(2, arg2, sizeof(arg2));
if (StringToIntEx(arg2, amount) == 0) if (StringToIntEx(arg2, amount) == 0)
{ {
@ -257,8 +256,9 @@ public Action:Command_Blind(client, args)
} }
} }
decl String:target_name[MAX_TARGET_LENGTH]; char target_name[MAX_TARGET_LENGTH];
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString( if ((target_count = ProcessTargetString(
arg, arg,
@ -274,7 +274,7 @@ public Action:Command_Blind(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
for (new i = 0; i < target_count; i++) for (int i = 0; i < target_count; i++)
{ {
PerformBlind(client, target_list[i], amount); PerformBlind(client, target_list[i], amount);
} }

View File

@ -31,32 +31,32 @@
* Version: $Id$ * Version: $Id$
*/ */
new Handle:g_DrugTimers[MAXPLAYERS+1]; Handle g_DrugTimers[MAXPLAYERS+1];
new Float:g_DrugAngles[20] = {0.0, 5.0, 10.0, 15.0, 20.0, 25.0, 20.0, 15.0, 10.0, 5.0, 0.0, -5.0, -10.0, -15.0, -20.0, -25.0, -20.0, -15.0, -10.0, -5.0}; float g_DrugAngles[20] = {0.0, 5.0, 10.0, 15.0, 20.0, 25.0, 20.0, 15.0, 10.0, 5.0, 0.0, -5.0, -10.0, -15.0, -20.0, -25.0, -20.0, -15.0, -10.0, -5.0};
CreateDrug(client) void CreateDrug(int client)
{ {
g_DrugTimers[client] = CreateTimer(1.0, Timer_Drug, client, TIMER_REPEAT); g_DrugTimers[client] = CreateTimer(1.0, Timer_Drug, client, TIMER_REPEAT);
} }
KillDrug(client) void KillDrug(int client)
{ {
KillDrugTimer(client); KillDrugTimer(client);
new Float:angs[3]; float angs[3];
GetClientEyeAngles(client, angs); GetClientEyeAngles(client, angs);
angs[2] = 0.0; angs[2] = 0.0;
TeleportEntity(client, NULL_VECTOR, angs, NULL_VECTOR); TeleportEntity(client, NULL_VECTOR, angs, NULL_VECTOR);
new clients[2]; int clients[2];
clients[0] = client; clients[0] = client;
new duration = 1536; int duration = 1536;
new holdtime = 1536; int holdtime = 1536;
new flags = (0x0001 | 0x0010); int flags = (0x0001 | 0x0010);
new color[4] = { 0, 0, 0, 0 }; int color[4] = { 0, 0, 0, 0 };
Handle message = StartMessageEx(g_FadeUserMsgId, clients, 1); Handle message = StartMessageEx(g_FadeUserMsgId, clients, 1);
if (GetUserMessageType() == UM_Protobuf) if (GetUserMessageType() == UM_Protobuf)
@ -82,15 +82,15 @@ KillDrug(client)
EndMessage(); EndMessage();
} }
KillDrugTimer(client) void KillDrugTimer(int client)
{ {
KillTimer(g_DrugTimers[client]); KillTimer(g_DrugTimers[client]);
g_DrugTimers[client] = null; g_DrugTimers[client] = null;
} }
KillAllDrugs() void KillAllDrugs()
{ {
for (new i = 1; i <= MaxClients; i++) for (int i = 1; i <= MaxClients; i++)
{ {
if (g_DrugTimers[i] != null) if (g_DrugTimers[i] != null)
{ {
@ -106,7 +106,7 @@ KillAllDrugs()
} }
} }
PerformDrug(client, target, toggle) void PerformDrug(int client, int target, int toggle)
{ {
switch (toggle) switch (toggle)
{ {
@ -144,7 +144,7 @@ PerformDrug(client, target, toggle)
} }
} }
public Action:Timer_Drug(Handle:timer, any:client) public Action Timer_Drug(Handle timer, any client)
{ {
if (!IsClientInGame(client)) if (!IsClientInGame(client))
{ {
@ -160,20 +160,20 @@ public Action:Timer_Drug(Handle:timer, any:client)
return Plugin_Handled; return Plugin_Handled;
} }
new Float:angs[3]; float angs[3];
GetClientEyeAngles(client, angs); GetClientEyeAngles(client, angs);
angs[2] = g_DrugAngles[GetRandomInt(0,100) % 20]; angs[2] = g_DrugAngles[GetRandomInt(0,100) % 20];
TeleportEntity(client, NULL_VECTOR, angs, NULL_VECTOR); TeleportEntity(client, NULL_VECTOR, angs, NULL_VECTOR);
new clients[2]; int clients[2];
clients[0] = client; clients[0] = client;
new duration = 255; int duration = 255;
new holdtime = 255; int holdtime = 255;
new flags = 0x0002; int flags = 0x0002;
new color[4] = { 0, 0, 0, 128 }; int color[4] = { 0, 0, 0, 128 };
color[0] = GetRandomInt(0,255); color[0] = GetRandomInt(0,255);
color[1] = GetRandomInt(0,255); color[1] = GetRandomInt(0,255);
color[2] = GetRandomInt(0,255); color[2] = GetRandomInt(0,255);
@ -203,12 +203,12 @@ public Action:Timer_Drug(Handle:timer, any:client)
return Plugin_Handled; return Plugin_Handled;
} }
public AdminMenu_Drug(Handle:topmenu, public void AdminMenu_Drug(TopMenu topmenu,
TopMenuAction:action, TopMenuAction action,
TopMenuObject:object_id, TopMenuObject object_id,
param, int param,
String:buffer[], char[] buffer,
maxlength) int maxlength)
{ {
if (action == TopMenuAction_DisplayOption) if (action == TopMenuAction_DisplayOption)
{ {
@ -220,11 +220,11 @@ public AdminMenu_Drug(Handle:topmenu,
} }
} }
DisplayDrugMenu(client) void DisplayDrugMenu(int client)
{ {
Menu menu = CreateMenu(MenuHandler_Drug); Menu menu = new Menu(MenuHandler_Drug);
decl String:title[100]; char title[100];
Format(title, sizeof(title), "%T:", "Drug player", client); Format(title, sizeof(title), "%T:", "Drug player", client);
menu.SetTitle(title); menu.SetTitle(title);
menu.ExitBackButton = true; menu.ExitBackButton = true;
@ -234,7 +234,7 @@ DisplayDrugMenu(client)
menu.Display(client, MENU_TIME_FOREVER); menu.Display(client, MENU_TIME_FOREVER);
} }
public MenuHandler_Drug(Menu menu, MenuAction action, int param1, int param2) public int MenuHandler_Drug(Menu menu, MenuAction action, int param1, int param2)
{ {
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
@ -249,8 +249,8 @@ public MenuHandler_Drug(Menu menu, MenuAction action, int param1, int param2)
} }
else if (action == MenuAction_Select) else if (action == MenuAction_Select)
{ {
decl String:info[32]; char info[32];
new userid, target; int userid, target;
menu.GetItem(param2, info, sizeof(info)); menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info); userid = StringToInt(info);
@ -265,7 +265,7 @@ public MenuHandler_Drug(Menu menu, MenuAction action, int param1, int param2)
} }
else else
{ {
new String:name[MAX_NAME_LENGTH]; char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name)); GetClientName(target, name, sizeof(name));
PerformDrug(param1, target, 2); PerformDrug(param1, target, 2);
@ -280,7 +280,7 @@ public MenuHandler_Drug(Menu menu, MenuAction action, int param1, int param2)
} }
} }
public Action:Command_Drug(client, args) public Action Command_Drug(int client, int args)
{ {
if (args < 1) if (args < 1)
{ {
@ -288,13 +288,13 @@ public Action:Command_Drug(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
decl String:arg[65]; char arg[65];
GetCmdArg(1, arg, sizeof(arg)); GetCmdArg(1, arg, sizeof(arg));
new toggle = 2; int toggle = 2;
if (args > 1) if (args > 1)
{ {
decl String:arg2[2]; char arg2[2];
GetCmdArg(2, arg2, sizeof(arg2)); GetCmdArg(2, arg2, sizeof(arg2));
if (StringToInt(arg2)) if (StringToInt(arg2))
{ {
@ -306,8 +306,9 @@ public Action:Command_Drug(client, args)
} }
} }
decl String:target_name[MAX_TARGET_LENGTH]; char target_name[MAX_TARGET_LENGTH];
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString( if ((target_count = ProcessTargetString(
arg, arg,
@ -323,7 +324,7 @@ public Action:Command_Drug(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
for (new i = 0; i < target_count; i++) for (int i = 0; i < target_count; i++)
{ {
PerformDrug(client, target_list[i], toggle); PerformDrug(client, target_list[i], toggle);
} }

View File

@ -31,22 +31,22 @@
* Version: $Id$ * Version: $Id$
*/ */
new g_FireBombSerial[MAXPLAYERS+1] = { 0, ... }; int g_FireBombSerial[MAXPLAYERS+1] = { 0, ... };
new g_FireBombTime[MAXPLAYERS+1] = { 0, ... }; int g_FireBombTime[MAXPLAYERS+1] = { 0, ... };
ConVar g_Cvar_BurnDuration; ConVar g_Cvar_BurnDuration;
ConVar g_Cvar_FireBombTicks; ConVar g_Cvar_FireBombTicks;
ConVar g_Cvar_FireBombRadius; ConVar g_Cvar_FireBombRadius;
ConVar g_Cvar_FireBombMode; ConVar g_Cvar_FireBombMode;
CreateFireBomb(client) void CreateFireBomb(int client)
{ {
g_FireBombSerial[client] = ++g_Serial_Gen; g_FireBombSerial[client] = ++g_Serial_Gen;
CreateTimer(1.0, Timer_FireBomb, client | (g_Serial_Gen << 7), DEFAULT_TIMER_FLAGS); CreateTimer(1.0, Timer_FireBomb, client | (g_Serial_Gen << 7), DEFAULT_TIMER_FLAGS);
g_FireBombTime[client] = g_Cvar_FireBombTicks.IntValue; g_FireBombTime[client] = g_Cvar_FireBombTicks.IntValue;
} }
KillFireBomb(client) void KillFireBomb(int client)
{ {
g_FireBombSerial[client] = 0; g_FireBombSerial[client] = 0;
@ -56,21 +56,21 @@ KillFireBomb(client)
} }
} }
KillAllFireBombs() void KillAllFireBombs()
{ {
for (new i = 1; i <= MaxClients; i++) for (int i = 1; i <= MaxClients; i++)
{ {
KillFireBomb(i); KillFireBomb(i);
} }
} }
PerformBurn(client, target, Float:seconds) void PerformBurn(int client, int target, float seconds)
{ {
IgniteEntity(target, seconds); IgniteEntity(target, seconds);
LogAction(client, target, "\"%L\" ignited \"%L\" (seconds \"%f\")", client, target, seconds); LogAction(client, target, "\"%L\" ignited \"%L\" (seconds \"%f\")", client, target, seconds);
} }
PerformFireBomb(client, target) void PerformFireBomb(int client, int target)
{ {
if (g_FireBombSerial[client] == 0) if (g_FireBombSerial[client] == 0)
{ {
@ -85,10 +85,10 @@ PerformFireBomb(client, target)
} }
} }
public Action:Timer_FireBomb(Handle:timer, any:value) public Action Timer_FireBomb(Handle timer, any value)
{ {
new client = value & 0x7f; int client = value & 0x7f;
new serial = value >> 7; int serial = value >> 7;
if (!IsClientInGame(client) if (!IsClientInGame(client)
|| !IsPlayerAlive(client) || !IsPlayerAlive(client)
@ -179,7 +179,7 @@ public Action:Timer_FireBomb(Handle:timer, any:value)
{ {
int teamOnly = ((g_Cvar_FireBombMode.IntValue == 1) ? true : false); int teamOnly = ((g_Cvar_FireBombMode.IntValue == 1) ? true : false);
for (new i = 1; i <= MaxClients; i++) for (int i = 1; i <= MaxClients; i++)
{ {
if (!IsClientInGame(i) || !IsPlayerAlive(i) || i == client) if (!IsClientInGame(i) || !IsPlayerAlive(i) || i == client)
{ {
@ -211,12 +211,12 @@ public Action:Timer_FireBomb(Handle:timer, any:value)
} }
} }
public AdminMenu_Burn(Handle:topmenu, public void AdminMenu_Burn(TopMenu topmenu,
TopMenuAction:action, TopMenuAction action,
TopMenuObject:object_id, TopMenuObject object_id,
param, int param,
String:buffer[], char[] buffer,
maxlength) int maxlength)
{ {
if (action == TopMenuAction_DisplayOption) if (action == TopMenuAction_DisplayOption)
{ {
@ -228,12 +228,12 @@ public AdminMenu_Burn(Handle:topmenu,
} }
} }
public AdminMenu_FireBomb(Handle:topmenu, public void AdminMenu_FireBomb(TopMenu topmenu,
TopMenuAction:action, TopMenuAction action,
TopMenuObject:object_id, TopMenuObject object_id,
param, int param,
String:buffer[], char[] buffer,
maxlength) int maxlength)
{ {
if (action == TopMenuAction_DisplayOption) if (action == TopMenuAction_DisplayOption)
{ {
@ -245,11 +245,11 @@ public AdminMenu_FireBomb(Handle:topmenu,
} }
} }
DisplayBurnMenu(client) void DisplayBurnMenu(int client)
{ {
Menu menu = CreateMenu(MenuHandler_Burn); Menu menu = new Menu(MenuHandler_Burn);
decl String:title[100]; char title[100];
Format(title, sizeof(title), "%T:", "Burn player", client); Format(title, sizeof(title), "%T:", "Burn player", client);
menu.SetTitle(title); menu.SetTitle(title);
menu.ExitBackButton = true; menu.ExitBackButton = true;
@ -259,11 +259,11 @@ DisplayBurnMenu(client)
menu.Display(client, MENU_TIME_FOREVER); menu.Display(client, MENU_TIME_FOREVER);
} }
DisplayFireBombMenu(client) void DisplayFireBombMenu(int client)
{ {
Menu menu = CreateMenu(MenuHandler_FireBomb); Menu menu = new Menu(MenuHandler_FireBomb);
decl String:title[100]; char title[100];
Format(title, sizeof(title), "%T:", "FireBomb player", client); Format(title, sizeof(title), "%T:", "FireBomb player", client);
menu.SetTitle(title); menu.SetTitle(title);
menu.ExitBackButton = true; menu.ExitBackButton = true;
@ -273,7 +273,7 @@ DisplayFireBombMenu(client)
menu.Display(client, MENU_TIME_FOREVER); menu.Display(client, MENU_TIME_FOREVER);
} }
public MenuHandler_Burn(Menu menu, MenuAction action, int param1, int param2) public int MenuHandler_Burn(Menu menu, MenuAction action, int param1, int param2)
{ {
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
@ -288,8 +288,8 @@ public MenuHandler_Burn(Menu menu, MenuAction action, int param1, int param2)
} }
else if (action == MenuAction_Select) else if (action == MenuAction_Select)
{ {
decl String:info[32]; char info[32];
new userid, target; int userid, target;
menu.GetItem(param2, info, sizeof(info)); menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info); userid = StringToInt(info);
@ -304,7 +304,7 @@ public MenuHandler_Burn(Menu menu, MenuAction action, int param1, int param2)
} }
else else
{ {
new String:name[MAX_NAME_LENGTH]; char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name)); GetClientName(target, name, sizeof(name));
PerformBurn(param1, target, 20.0); PerformBurn(param1, target, 20.0);
ShowActivity2(param1, "[SM] ", "%t", "Set target on fire", "_s", name); ShowActivity2(param1, "[SM] ", "%t", "Set target on fire", "_s", name);
@ -318,7 +318,7 @@ public MenuHandler_Burn(Menu menu, MenuAction action, int param1, int param2)
} }
} }
public MenuHandler_FireBomb(Menu menu, MenuAction action, int param1, int param2) public int MenuHandler_FireBomb(Menu menu, MenuAction action, int param1, int param2)
{ {
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
@ -333,8 +333,8 @@ public MenuHandler_FireBomb(Menu menu, MenuAction action, int param1, int param2
} }
else if (action == MenuAction_Select) else if (action == MenuAction_Select)
{ {
decl String:info[32]; char info[32];
new userid, target; int userid, target;
menu.GetItem(param2, info, sizeof(info)); menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info); userid = StringToInt(info);
@ -349,7 +349,7 @@ public MenuHandler_FireBomb(Menu menu, MenuAction action, int param1, int param2
} }
else else
{ {
new String:name[MAX_NAME_LENGTH]; char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name)); GetClientName(target, name, sizeof(name));
PerformFireBomb(param1, target); PerformFireBomb(param1, target);
@ -364,7 +364,7 @@ public MenuHandler_FireBomb(Menu menu, MenuAction action, int param1, int param2
} }
} }
public Action:Command_Burn(client, args) public Action Command_Burn(int client, int args)
{ {
if (args < 1) if (args < 1)
{ {
@ -406,7 +406,7 @@ public Action:Command_Burn(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
for (new i = 0; i < target_count; i++) for (int i = 0; i < target_count; i++)
{ {
PerformBurn(client, target_list[i], seconds); PerformBurn(client, target_list[i], seconds);
} }
@ -423,7 +423,7 @@ public Action:Command_Burn(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
public Action:Command_FireBomb(client, args) public Action Command_FireBomb(int client, int args)
{ {
if (args < 1) if (args < 1)
{ {
@ -452,7 +452,7 @@ public Action:Command_FireBomb(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
for (new i = 0; i < target_count; i++) for (int i = 0; i < target_count; i++)
{ {
PerformFireBomb(client, target_list[i]); PerformFireBomb(client, target_list[i]);
} }
@ -467,9 +467,3 @@ public Action:Command_FireBomb(client, args)
} }
return Plugin_Handled; return Plugin_Handled;
} }

View File

@ -31,20 +31,20 @@
* Version: $Id$ * Version: $Id$
*/ */
new g_GravityTarget[MAXPLAYERS+1]; int g_GravityTarget[MAXPLAYERS+1];
PerformGravity(client, target, Float:amount) void PerformGravity(int client, int target, float amount)
{ {
SetEntityGravity(target, amount); SetEntityGravity(target, amount);
LogAction(client, target, "\"%L\" set gravity on \"%L\" to %f.", client, target, amount); LogAction(client, target, "\"%L\" set gravity on \"%L\" to %f.", client, target, amount);
} }
public AdminMenu_Gravity(Handle:topmenu, public void AdminMenu_Gravity(TopMenu topmenu,
TopMenuAction:action, TopMenuAction action,
TopMenuObject:object_id, TopMenuObject object_id,
param, int param,
String:buffer[], char[] buffer,
maxlength) int maxlength)
{ {
if (action == TopMenuAction_DisplayOption) if (action == TopMenuAction_DisplayOption)
{ {
@ -56,11 +56,11 @@ public AdminMenu_Gravity(Handle:topmenu,
} }
} }
DisplayGravityMenu(client) void DisplayGravityMenu(int client)
{ {
Menu menu = CreateMenu(MenuHandler_Gravity); Menu menu = new Menu(MenuHandler_Gravity);
decl String:title[100]; char title[100];
Format(title, sizeof(title), "%T:", "Gravity player", client); Format(title, sizeof(title), "%T:", "Gravity player", client);
menu.SetTitle(title); menu.SetTitle(title);
menu.ExitBackButton = true; menu.ExitBackButton = true;
@ -70,11 +70,11 @@ DisplayGravityMenu(client)
menu.Display(client, MENU_TIME_FOREVER); menu.Display(client, MENU_TIME_FOREVER);
} }
DisplayGravityAmountMenu(client) void DisplayGravityAmountMenu(int client)
{ {
Menu menu = CreateMenu(MenuHandler_GravityAmount); Menu menu = new Menu(MenuHandler_GravityAmount);
decl String:title[100]; char title[100];
Format(title, sizeof(title), "%T: %N", "Gravity amount", client, GetClientOfUserId(g_GravityTarget[client])); Format(title, sizeof(title), "%T: %N", "Gravity amount", client, GetClientOfUserId(g_GravityTarget[client]));
menu.SetTitle(title); menu.SetTitle(title);
menu.ExitBackButton = true; menu.ExitBackButton = true;
@ -88,7 +88,7 @@ DisplayGravityAmountMenu(client)
menu.Display(client, MENU_TIME_FOREVER); menu.Display(client, MENU_TIME_FOREVER);
} }
public MenuHandler_Gravity(Menu menu, MenuAction action, int param1, int param2) public int MenuHandler_Gravity(Menu menu, MenuAction action, int param1, int param2)
{ {
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
@ -103,8 +103,8 @@ public MenuHandler_Gravity(Menu menu, MenuAction action, int param1, int param2)
} }
else if (action == MenuAction_Select) else if (action == MenuAction_Select)
{ {
decl String:info[32]; char info[32];
new userid, target; int userid, target;
menu.GetItem(param2, info, sizeof(info)); menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info); userid = StringToInt(info);
@ -134,7 +134,7 @@ public MenuHandler_Gravity(Menu menu, MenuAction action, int param1, int param2)
return; return;
} }
public MenuHandler_GravityAmount(Menu menu, MenuAction action, int param1, int param2) public int MenuHandler_GravityAmount(Menu menu, MenuAction action, int param1, int param2)
{ {
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
@ -149,8 +149,9 @@ public MenuHandler_GravityAmount(Menu menu, MenuAction action, int param1, int p
} }
else if (action == MenuAction_Select) else if (action == MenuAction_Select)
{ {
decl String:info[32]; char info[32];
new Float:amount, target; float amount;
int target;
menu.GetItem(param2, info, sizeof(info)); menu.GetItem(param2, info, sizeof(info));
amount = StringToFloat(info); amount = StringToFloat(info);
@ -165,7 +166,7 @@ public MenuHandler_GravityAmount(Menu menu, MenuAction action, int param1, int p
} }
else else
{ {
new String:name[MAX_NAME_LENGTH]; char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name)); GetClientName(target, name, sizeof(name));
PerformGravity(param1, target, amount); PerformGravity(param1, target, amount);
@ -180,7 +181,7 @@ public MenuHandler_GravityAmount(Menu menu, MenuAction action, int param1, int p
} }
} }
public Action:Command_Gravity(client, args) public Action Command_Gravity(int client, int args)
{ {
if (args < 1) if (args < 1)
{ {
@ -188,13 +189,13 @@ public Action:Command_Gravity(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
decl String:arg[65]; char arg[65];
GetCmdArg(1, arg, sizeof(arg)); GetCmdArg(1, arg, sizeof(arg));
new Float:amount = 1.0; float amount = 1.0;
if (args > 1) if (args > 1)
{ {
decl String:arg2[20]; char arg2[20];
GetCmdArg(2, arg2, sizeof(arg2)); GetCmdArg(2, arg2, sizeof(arg2));
if (StringToFloatEx(arg2, amount) == 0) if (StringToFloatEx(arg2, amount) == 0)
{ {
@ -208,8 +209,9 @@ public Action:Command_Gravity(client, args)
} }
} }
decl String:target_name[MAX_TARGET_LENGTH]; char target_name[MAX_TARGET_LENGTH];
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString( if ((target_count = ProcessTargetString(
arg, arg,
@ -225,7 +227,7 @@ public Action:Command_Gravity(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
for (new i = 0; i < target_count; i++) for (int i = 0; i < target_count; i++)
{ {
PerformGravity(client, target_list[i], amount); PerformGravity(client, target_list[i], amount);
} }

View File

@ -31,17 +31,17 @@
* Version: $Id$ * Version: $Id$
*/ */
new g_FreezeSerial[MAXPLAYERS+1] = { 0, ... }; int g_FreezeSerial[MAXPLAYERS+1] = { 0, ... };
new g_FreezeBombSerial[MAXPLAYERS+1] = { 0, ... }; int g_FreezeBombSerial[MAXPLAYERS+1] = { 0, ... };
new g_FreezeTime[MAXPLAYERS+1] = { 0, ... }; int g_FreezeTime[MAXPLAYERS+1] = { 0, ... };
new g_FreezeBombTime[MAXPLAYERS+1] = { 0, ... }; int g_FreezeBombTime[MAXPLAYERS+1] = { 0, ... };
ConVar g_Cvar_FreezeDuration; ConVar g_Cvar_FreezeDuration;
ConVar g_Cvar_FreezeBombTicks; ConVar g_Cvar_FreezeBombTicks;
ConVar g_Cvar_FreezeBombRadius; ConVar g_Cvar_FreezeBombRadius;
ConVar g_Cvar_FreezeBombMode; ConVar g_Cvar_FreezeBombMode;
FreezeClient(client, time) void FreezeClient(int client, int time)
{ {
if (g_FreezeSerial[client] != 0) if (g_FreezeSerial[client] != 0)
{ {
@ -53,7 +53,7 @@ FreezeClient(client, time)
if (g_FreezeSound[0]) if (g_FreezeSound[0])
{ {
new Float:vec[3]; float vec[3];
GetClientEyePosition(client, vec); GetClientEyePosition(client, vec);
EmitAmbientSound(g_FreezeSound, vec, client, SNDLEVEL_RAIDSIREN); EmitAmbientSound(g_FreezeSound, vec, client, SNDLEVEL_RAIDSIREN);
} }
@ -63,7 +63,7 @@ FreezeClient(client, time)
CreateTimer(1.0, Timer_Freeze, client | (g_Serial_Gen << 7), DEFAULT_TIMER_FLAGS); CreateTimer(1.0, Timer_Freeze, client | (g_Serial_Gen << 7), DEFAULT_TIMER_FLAGS);
} }
UnfreezeClient(client) void UnfreezeClient(int client)
{ {
g_FreezeSerial[client] = 0; g_FreezeSerial[client] = 0;
g_FreezeTime[client] = 0; g_FreezeTime[client] = 0;
@ -72,7 +72,7 @@ UnfreezeClient(client)
{ {
if (g_FreezeSound[0]) if (g_FreezeSound[0])
{ {
new Float:vec[3]; float vec[3];
GetClientAbsOrigin(client, vec); GetClientAbsOrigin(client, vec);
vec[2] += 10; vec[2] += 10;
@ -86,7 +86,7 @@ UnfreezeClient(client)
} }
} }
CreateFreezeBomb(client) void CreateFreezeBomb(int client)
{ {
if (g_FreezeBombSerial[client] != 0) if (g_FreezeBombSerial[client] != 0)
{ {
@ -98,7 +98,7 @@ CreateFreezeBomb(client)
CreateTimer(1.0, Timer_FreezeBomb, client | (g_Serial_Gen << 7), DEFAULT_TIMER_FLAGS); CreateTimer(1.0, Timer_FreezeBomb, client | (g_Serial_Gen << 7), DEFAULT_TIMER_FLAGS);
} }
KillFreezeBomb(client) void KillFreezeBomb(int client)
{ {
g_FreezeBombSerial[client] = 0; g_FreezeBombSerial[client] = 0;
g_FreezeBombTime[client] = 0; g_FreezeBombTime[client] = 0;
@ -109,9 +109,9 @@ KillFreezeBomb(client)
} }
} }
KillAllFreezes( ) void KillAllFreezes()
{ {
for(new i = 1; i <= MaxClients; i++) for(int i = 1; i <= MaxClients; i++)
{ {
if (g_FreezeSerial[i] != 0) if (g_FreezeSerial[i] != 0)
{ {
@ -125,13 +125,13 @@ KillAllFreezes( )
} }
} }
PerformFreeze(client, target, time) void PerformFreeze(int client, int target, int time)
{ {
FreezeClient(target, time); FreezeClient(target, time);
LogAction(client, target, "\"%L\" froze \"%L\"", client, target); LogAction(client, target, "\"%L\" froze \"%L\"", client, target);
} }
PerformFreezeBomb(client, target) void PerformFreezeBomb(int client, int target)
{ {
if (g_FreezeBombSerial[target] != 0) if (g_FreezeBombSerial[target] != 0)
{ {
@ -145,10 +145,10 @@ PerformFreezeBomb(client, target)
} }
} }
public Action:Timer_Freeze(Handle:timer, any:value) public Action Timer_Freeze(Handle timer, any value)
{ {
new client = value & 0x7f; int client = value & 0x7f;
new serial = value >> 7; int serial = value >> 7;
if (!IsClientInGame(client) if (!IsClientInGame(client)
|| !IsPlayerAlive(client) || !IsPlayerAlive(client)
@ -188,7 +188,7 @@ public Action:Timer_Freeze(Handle:timer, any:value)
SetEntityMoveType(client, MOVETYPE_NONE); SetEntityMoveType(client, MOVETYPE_NONE);
SetEntityRenderColor(client, 0, 128, 255, 135); SetEntityRenderColor(client, 0, 128, 255, 135);
new Float:vec[3]; float vec[3];
GetClientAbsOrigin(client, vec); GetClientAbsOrigin(client, vec);
vec[2] += 10; vec[2] += 10;
@ -206,10 +206,10 @@ public Action:Timer_Freeze(Handle:timer, any:value)
return Plugin_Continue; return Plugin_Continue;
} }
public Action:Timer_FreezeBomb(Handle:timer, any:value) public Action Timer_FreezeBomb(Handle timer, any value)
{ {
new client = value & 0x7f; int client = value & 0x7f;
new serial = value >> 7; int serial = value >> 7;
if (!IsClientInGame(client) if (!IsClientInGame(client)
|| !IsPlayerAlive(client) || !IsPlayerAlive(client)
@ -219,13 +219,13 @@ public Action:Timer_FreezeBomb(Handle:timer, any:value)
return Plugin_Stop; return Plugin_Stop;
} }
new Float:vec[3]; float vec[3];
GetClientEyePosition(client, vec); GetClientEyePosition(client, vec);
g_FreezeBombTime[client]--; g_FreezeBombTime[client]--;
if (g_FreezeBombTime[client] > 0) if (g_FreezeBombTime[client] > 0)
{ {
new color; int color;
if (g_FreezeBombTime[client] > 1) if (g_FreezeBombTime[client] > 1)
{ {
@ -325,12 +325,12 @@ public Action:Timer_FreezeBomb(Handle:timer, any:value)
} }
} }
public AdminMenu_Freeze(Handle:topmenu, public void AdminMenu_Freeze(TopMenu topmenu,
TopMenuAction:action, TopMenuAction action,
TopMenuObject:object_id, TopMenuObject object_id,
param, int param,
String:buffer[], char[] buffer,
maxlength) int maxlength)
{ {
if (action == TopMenuAction_DisplayOption) if (action == TopMenuAction_DisplayOption)
{ {
@ -342,12 +342,12 @@ public AdminMenu_Freeze(Handle:topmenu,
} }
} }
public AdminMenu_FreezeBomb(Handle:topmenu, public void AdminMenu_FreezeBomb(TopMenu topmenu,
TopMenuAction:action, TopMenuAction action,
TopMenuObject:object_id, TopMenuObject object_id,
param, int param,
String:buffer[], char[] buffer,
maxlength) int maxlength)
{ {
if (action == TopMenuAction_DisplayOption) if (action == TopMenuAction_DisplayOption)
{ {
@ -359,11 +359,11 @@ public AdminMenu_FreezeBomb(Handle:topmenu,
} }
} }
DisplayFreezeMenu(client) void DisplayFreezeMenu(int client)
{ {
Menu menu = CreateMenu(MenuHandler_Freeze); Menu menu = new Menu(MenuHandler_Freeze);
decl String:title[100]; char title[100];
Format(title, sizeof(title), "%T:", "Freeze player", client); Format(title, sizeof(title), "%T:", "Freeze player", client);
menu.SetTitle(title); menu.SetTitle(title);
menu.ExitBackButton = true; menu.ExitBackButton = true;
@ -373,11 +373,11 @@ DisplayFreezeMenu(client)
menu.Display(client, MENU_TIME_FOREVER); menu.Display(client, MENU_TIME_FOREVER);
} }
DisplayFreezeBombMenu(client) void DisplayFreezeBombMenu(int client)
{ {
Menu menu = CreateMenu(MenuHandler_FreezeBomb); Menu menu = new Menu(MenuHandler_FreezeBomb);
decl String:title[100]; char title[100];
Format(title, sizeof(title), "%T:", "FreezeBomb player", client); Format(title, sizeof(title), "%T:", "FreezeBomb player", client);
menu.SetTitle(title); menu.SetTitle(title);
menu.ExitBackButton = true; menu.ExitBackButton = true;
@ -387,7 +387,7 @@ DisplayFreezeBombMenu(client)
menu.Display(client, MENU_TIME_FOREVER); menu.Display(client, MENU_TIME_FOREVER);
} }
public MenuHandler_Freeze(Menu menu, MenuAction action, int param1, int param2) public int MenuHandler_Freeze(Menu menu, MenuAction action, int param1, int param2)
{ {
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
@ -402,8 +402,8 @@ public MenuHandler_Freeze(Menu menu, MenuAction action, int param1, int param2)
} }
else if (action == MenuAction_Select) else if (action == MenuAction_Select)
{ {
decl String:info[32]; char info[32];
new userid, target; int userid, target;
menu.GetItem(param2, info, sizeof(info)); menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info); userid = StringToInt(info);
@ -418,7 +418,7 @@ public MenuHandler_Freeze(Menu menu, MenuAction action, int param1, int param2)
} }
else else
{ {
new String:name[MAX_NAME_LENGTH]; char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name)); GetClientName(target, name, sizeof(name));
PerformFreeze(param1, target, g_Cvar_FreezeDuration.IntValue); PerformFreeze(param1, target, g_Cvar_FreezeDuration.IntValue);
@ -433,7 +433,7 @@ public MenuHandler_Freeze(Menu menu, MenuAction action, int param1, int param2)
} }
} }
public MenuHandler_FreezeBomb(Menu menu, MenuAction action, int param1, int param2) public int MenuHandler_FreezeBomb(Menu menu, MenuAction action, int param1, int param2)
{ {
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
@ -448,8 +448,8 @@ public MenuHandler_FreezeBomb(Menu menu, MenuAction action, int param1, int para
} }
else if (action == MenuAction_Select) else if (action == MenuAction_Select)
{ {
decl String:info[32]; char info[32];
new userid, target; int userid, target;
menu.GetItem(param2, info, sizeof(info)); menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info); userid = StringToInt(info);
@ -464,7 +464,7 @@ public MenuHandler_FreezeBomb(Menu menu, MenuAction action, int param1, int para
} }
else else
{ {
new String:name[MAX_NAME_LENGTH]; char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name)); GetClientName(target, name, sizeof(name));
PerformFreezeBomb(param1, target); PerformFreezeBomb(param1, target);
@ -494,7 +494,7 @@ public Action Command_Freeze(int client, int args)
if (args > 1) if (args > 1)
{ {
decl String:time[20]; char time[20];
GetCmdArg(2, time, sizeof(time)); GetCmdArg(2, time, sizeof(time));
if (StringToIntEx(time, seconds) == 0) if (StringToIntEx(time, seconds) == 0)
{ {
@ -503,8 +503,9 @@ public Action Command_Freeze(int client, int args)
} }
} }
decl String:target_name[MAX_TARGET_LENGTH]; char target_name[MAX_TARGET_LENGTH];
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString( if ((target_count = ProcessTargetString(
arg, arg,
@ -520,7 +521,7 @@ public Action Command_Freeze(int client, int args)
return Plugin_Handled; return Plugin_Handled;
} }
for (new i = 0; i < target_count; i++) for (int i = 0; i < target_count; i++)
{ {
PerformFreeze(client, target_list[i], seconds); PerformFreeze(client, target_list[i], seconds);
} }
@ -537,7 +538,7 @@ public Action Command_Freeze(int client, int args)
return Plugin_Handled; return Plugin_Handled;
} }
public Action:Command_FreezeBomb(client, args) public Action Command_FreezeBomb(int client, int args)
{ {
if (args < 1) if (args < 1)
{ {
@ -545,11 +546,12 @@ public Action:Command_FreezeBomb(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
decl String:arg[65]; char arg[65];
GetCmdArg(1, arg, sizeof(arg)); GetCmdArg(1, arg, sizeof(arg));
decl String:target_name[MAX_TARGET_LENGTH]; char target_name[MAX_TARGET_LENGTH];
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString( if ((target_count = ProcessTargetString(
arg, arg,
@ -565,7 +567,7 @@ public Action:Command_FreezeBomb(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
for (new i = 0; i < target_count; i++) for (int i = 0; i < target_count; i++)
{ {
PerformFreezeBomb(client, target_list[i]); PerformFreezeBomb(client, target_list[i]);
} }

View File

@ -31,9 +31,9 @@
* Version: $Id$ * Version: $Id$
*/ */
PerformNoClip(client, target) void PerformNoClip(int client, int target)
{ {
new MoveType:movetype = GetEntityMoveType(target); MoveType movetype = GetEntityMoveType(target);
if (movetype != MOVETYPE_NOCLIP) if (movetype != MOVETYPE_NOCLIP)
{ {
@ -47,12 +47,12 @@ PerformNoClip(client, target)
LogAction(client, target, "\"%L\" toggled noclip on \"%L\"", client, target); LogAction(client, target, "\"%L\" toggled noclip on \"%L\"", client, target);
} }
public AdminMenu_NoClip(Handle:topmenu, public void AdminMenu_NoClip(TopMenu topmenu,
TopMenuAction:action, TopMenuAction action,
TopMenuObject:object_id, TopMenuObject object_id,
param, int param,
String:buffer[], char[] buffer,
maxlength) int maxlength)
{ {
if (action == TopMenuAction_DisplayOption) if (action == TopMenuAction_DisplayOption)
{ {
@ -64,11 +64,11 @@ public AdminMenu_NoClip(Handle:topmenu,
} }
} }
DisplayNoClipMenu(client) void DisplayNoClipMenu(int client)
{ {
Menu menu = CreateMenu(MenuHandler_NoClip); Menu menu = new Menu(MenuHandler_NoClip);
decl String:title[100]; char title[100];
Format(title, sizeof(title), "%T:", "NoClip player", client); Format(title, sizeof(title), "%T:", "NoClip player", client);
menu.SetTitle(title); menu.SetTitle(title);
menu.ExitBackButton = true; menu.ExitBackButton = true;
@ -78,7 +78,7 @@ DisplayNoClipMenu(client)
menu.Display(client, MENU_TIME_FOREVER); menu.Display(client, MENU_TIME_FOREVER);
} }
public MenuHandler_NoClip(Menu menu, MenuAction action, int param1, int param2) public int MenuHandler_NoClip(Menu menu, MenuAction action, int param1, int param2)
{ {
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
@ -93,8 +93,8 @@ public MenuHandler_NoClip(Menu menu, MenuAction action, int param1, int param2)
} }
else if (action == MenuAction_Select) else if (action == MenuAction_Select)
{ {
decl String:info[32]; char info[32];
new userid, target; int userid, target;
menu.GetItem(param2, info, sizeof(info)); menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info); userid = StringToInt(info);
@ -109,7 +109,7 @@ public MenuHandler_NoClip(Menu menu, MenuAction action, int param1, int param2)
} }
else else
{ {
new String:name[MAX_NAME_LENGTH]; char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name)); GetClientName(target, name, sizeof(name));
PerformNoClip(param1, target); PerformNoClip(param1, target);
@ -124,7 +124,7 @@ public MenuHandler_NoClip(Menu menu, MenuAction action, int param1, int param2)
} }
} }
public Action:Command_NoClip(client, args) public Action Command_NoClip(int client, int args)
{ {
if (args < 1) if (args < 1)
{ {
@ -132,11 +132,12 @@ public Action:Command_NoClip(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
decl String:arg[65]; char arg[65];
GetCmdArg(1, arg, sizeof(arg)); GetCmdArg(1, arg, sizeof(arg));
decl String:target_name[MAX_TARGET_LENGTH]; char target_name[MAX_TARGET_LENGTH];
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString( if ((target_count = ProcessTargetString(
arg, arg,
@ -152,7 +153,7 @@ public Action:Command_NoClip(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
for (new i = 0; i < target_count; i++) for (int i = 0; i < target_count; i++)
{ {
PerformNoClip(client, target_list[i]); PerformNoClip(client, target_list[i]);
} }

View File

@ -31,21 +31,21 @@
* Version: $Id$ * Version: $Id$
*/ */
new g_TimeBombSerial[MAXPLAYERS+1] = { 0, ... }; int g_TimeBombSerial[MAXPLAYERS+1] = { 0, ... };
new g_TimeBombTime[MAXPLAYERS+1] = { 0, ... }; int g_TimeBombTime[MAXPLAYERS+1] = { 0, ... };
ConVar g_Cvar_TimeBombTicks; ConVar g_Cvar_TimeBombTicks;
ConVar g_Cvar_TimeBombRadius; ConVar g_Cvar_TimeBombRadius;
ConVar g_Cvar_TimeBombMode; ConVar g_Cvar_TimeBombMode;
CreateTimeBomb(client) void CreateTimeBomb(int client)
{ {
g_TimeBombSerial[client] = ++g_Serial_Gen; g_TimeBombSerial[client] = ++g_Serial_Gen;
CreateTimer(1.0, Timer_TimeBomb, client | (g_Serial_Gen << 7), DEFAULT_TIMER_FLAGS); CreateTimer(1.0, Timer_TimeBomb, client | (g_Serial_Gen << 7), DEFAULT_TIMER_FLAGS);
g_TimeBombTime[client] = g_Cvar_TimeBombTicks.IntValue; g_TimeBombTime[client] = g_Cvar_TimeBombTicks.IntValue;
} }
KillTimeBomb(client) void KillTimeBomb(int client)
{ {
g_TimeBombSerial[client] = 0; g_TimeBombSerial[client] = 0;
@ -55,15 +55,15 @@ KillTimeBomb(client)
} }
} }
KillAllTimeBombs() void KillAllTimeBombs()
{ {
for (new i = 1; i <= MaxClients; i++) for (int i = 1; i <= MaxClients; i++)
{ {
KillTimeBomb(i); KillTimeBomb(i);
} }
} }
PerformTimeBomb(client, target) void PerformTimeBomb(int client, int target)
{ {
if (g_TimeBombSerial[target] == 0) if (g_TimeBombSerial[target] == 0)
{ {
@ -78,7 +78,7 @@ PerformTimeBomb(client, target)
} }
} }
public Action:Timer_TimeBomb(Handle:timer, any:value) public Action Timer_TimeBomb(Handle timer, any value)
{ {
int client = value & 0x7f; int client = value & 0x7f;
int serial = value >> 7; int serial = value >> 7;
@ -155,7 +155,7 @@ public Action:Timer_TimeBomb(Handle:timer, any:value)
{ {
int teamOnly = ((g_Cvar_TimeBombMode.IntValue == 1) ? true : false); int teamOnly = ((g_Cvar_TimeBombMode.IntValue == 1) ? true : false);
for (new i = 1; i <= MaxClients; i++) for (int i = 1; i <= MaxClients; i++)
{ {
if (!IsClientInGame(i) || !IsPlayerAlive(i) || i == client) if (!IsClientInGame(i) || !IsPlayerAlive(i) || i == client)
{ {
@ -177,7 +177,7 @@ public Action:Timer_TimeBomb(Handle:timer, any:value)
continue; continue;
} }
new damage = 220; int damage = 220;
damage = RoundToFloor(damage * ((g_Cvar_TimeBombRadius.FloatValue - distance) / g_Cvar_TimeBombRadius.FloatValue)); damage = RoundToFloor(damage * ((g_Cvar_TimeBombRadius.FloatValue - distance) / g_Cvar_TimeBombRadius.FloatValue));
SlapPlayer(i, damage, false); SlapPlayer(i, damage, false);
@ -195,8 +195,8 @@ public Action:Timer_TimeBomb(Handle:timer, any:value)
if (i == TR_GetEntityIndex()) if (i == TR_GetEntityIndex())
{ {
new damage = 100; int damage = 100;
new radius = g_Cvar_TimeBombRadius.IntValue / 2; int radius = g_Cvar_TimeBombRadius.IntValue / 2;
if (distance > radius) if (distance > radius)
{ {
@ -213,12 +213,12 @@ public Action:Timer_TimeBomb(Handle:timer, any:value)
} }
} }
public AdminMenu_TimeBomb(Handle:topmenu, public void AdminMenu_TimeBomb(TopMenu topmenu,
TopMenuAction:action, TopMenuAction action,
TopMenuObject:object_id, TopMenuObject object_id,
param, int param,
String:buffer[], char[] buffer,
maxlength) int maxlength)
{ {
if (action == TopMenuAction_DisplayOption) if (action == TopMenuAction_DisplayOption)
{ {
@ -230,11 +230,11 @@ public AdminMenu_TimeBomb(Handle:topmenu,
} }
} }
DisplayTimeBombMenu(client) void DisplayTimeBombMenu(int client)
{ {
Menu menu = CreateMenu(MenuHandler_TimeBomb); Menu menu = new Menu(MenuHandler_TimeBomb);
decl String:title[100]; char title[100];
Format(title, sizeof(title), "%T:", "TimeBomb player", client); Format(title, sizeof(title), "%T:", "TimeBomb player", client);
menu.SetTitle(title); menu.SetTitle(title);
menu.ExitBackButton = true; menu.ExitBackButton = true;
@ -244,7 +244,7 @@ DisplayTimeBombMenu(client)
menu.Display(client, MENU_TIME_FOREVER); menu.Display(client, MENU_TIME_FOREVER);
} }
public MenuHandler_TimeBomb(Menu menu, MenuAction action, int param1, int param2) public int MenuHandler_TimeBomb(Menu menu, MenuAction action, int param1, int param2)
{ {
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
@ -259,8 +259,8 @@ public MenuHandler_TimeBomb(Menu menu, MenuAction action, int param1, int param2
} }
else if (action == MenuAction_Select) else if (action == MenuAction_Select)
{ {
decl String:info[32]; char info[32];
new userid, target; int userid, target;
menu.GetItem(param2, info, sizeof(info)); menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info); userid = StringToInt(info);
@ -275,7 +275,7 @@ public MenuHandler_TimeBomb(Menu menu, MenuAction action, int param1, int param2
} }
else else
{ {
new String:name[MAX_NAME_LENGTH]; char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name)); GetClientName(target, name, sizeof(name));
PerformTimeBomb(param1, target); PerformTimeBomb(param1, target);
@ -290,7 +290,7 @@ public MenuHandler_TimeBomb(Menu menu, MenuAction action, int param1, int param2
} }
} }
public Action:Command_TimeBomb(client, args) public Action Command_TimeBomb(int client, int args)
{ {
if (args < 1) if (args < 1)
{ {
@ -298,11 +298,12 @@ public Action:Command_TimeBomb(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
decl String:arg[65]; char arg[65];
GetCmdArg(1, arg, sizeof(arg)); GetCmdArg(1, arg, sizeof(arg));
decl String:target_name[MAX_TARGET_LENGTH]; char target_name[MAX_TARGET_LENGTH];
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString( if ((target_count = ProcessTargetString(
arg, arg,
@ -318,7 +319,7 @@ public Action:Command_TimeBomb(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
for (new i = 0; i < target_count; i++) for (int i = 0; i < target_count; i++)
{ {
PerformTimeBomb(client, target_list[i]); PerformTimeBomb(client, target_list[i]);
} }

View File

@ -39,7 +39,9 @@
#undef REQUIRE_PLUGIN #undef REQUIRE_PLUGIN
#include <adminmenu> #include <adminmenu>
public Plugin:myinfo = #pragma newdecls required
public Plugin myinfo =
{ {
name = "Fun Votes", name = "Fun Votes",
author = "AlliedModders LLC", author = "AlliedModders LLC",
@ -58,7 +60,7 @@ ConVar g_Cvar_Gravity;
ConVar g_Cvar_Alltalk; ConVar g_Cvar_Alltalk;
ConVar g_Cvar_FF; ConVar g_Cvar_FF;
// new Handle:g_Cvar_Show = null; // ConVar g_Cvar_Show = null;
enum voteType enum voteType
{ {
@ -69,19 +71,19 @@ enum voteType
ff ff
}; };
new voteType:g_voteType = voteType:gravity; voteType g_voteType = gravity;
// Menu API does not provide us with a way to pass multiple peices of data with a single // Menu API does not provide us with a way to pass multiple peices of data with a single
// choice, so some globals are used to hold stuff. // choice, so some globals are used to hold stuff.
// //
#define VOTE_CLIENTID 0 #define VOTE_CLIENTID 0
#define VOTE_USERID 1 #define VOTE_USERID 1
new g_voteClient[2]; /* Holds the target's client id and user id */ int g_voteClient[2]; /* Holds the target's client id and user id */
#define VOTE_NAME 0 #define VOTE_NAME 0
#define VOTE_AUTHID 1 #define VOTE_AUTHID 1
#define VOTE_IP 2 #define VOTE_IP 2
new String:g_voteInfo[3][65]; /* Holds the target's name, authid, and IP */ char g_voteInfo[3][65]; /* Holds the target's name, authid, and IP */
TopMenu hTopMenu; TopMenu hTopMenu;
@ -91,7 +93,7 @@ TopMenu hTopMenu;
#include "funvotes/votealltalk.sp" #include "funvotes/votealltalk.sp"
#include "funvotes/voteff.sp" #include "funvotes/voteff.sp"
public OnPluginStart() public void OnPluginStart()
{ {
if (FindPluginByFile("basefunvotes.smx") != null) if (FindPluginByFile("basefunvotes.smx") != null)
{ {
@ -135,7 +137,7 @@ public OnPluginStart()
} }
} }
public OnAdminMenuReady(Handle aTopMenu) public void OnAdminMenuReady(Handle aTopMenu)
{ {
TopMenu topmenu = TopMenu.FromHandle(aTopMenu); TopMenu topmenu = TopMenu.FromHandle(aTopMenu);
@ -149,7 +151,7 @@ public OnAdminMenuReady(Handle aTopMenu)
hTopMenu = topmenu; hTopMenu = topmenu;
/* Build the "Voting Commands" category */ /* Build the "Voting Commands" category */
new TopMenuObject:voting_commands = hTopMenu.FindCategory(ADMINMENU_VOTINGCOMMANDS); TopMenuObject voting_commands = hTopMenu.FindCategory(ADMINMENU_VOTINGCOMMANDS);
if (voting_commands != INVALID_TOPMENUOBJECT) if (voting_commands != INVALID_TOPMENUOBJECT)
{ {
@ -161,7 +163,7 @@ public OnAdminMenuReady(Handle aTopMenu)
} }
} }
public Handler_VoteCallback(Menu menu, MenuAction action, int param1, int param2) public int Handler_VoteCallback(Menu menu, MenuAction action, int param1, int param2)
{ {
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
@ -175,7 +177,7 @@ public Handler_VoteCallback(Menu menu, MenuAction action, int param1, int param2
char buffer[255]; char buffer[255];
Format(buffer, sizeof(buffer), "%T", title, param1, g_voteInfo[VOTE_NAME]); Format(buffer, sizeof(buffer), "%T", title, param1, g_voteInfo[VOTE_NAME]);
Panel panel = Panel:param2; Panel panel = view_as<Panel>(param2);
panel.SetTitle(buffer); panel.SetTitle(buffer);
} }
else if (action == MenuAction_DisplayItem) else if (action == MenuAction_DisplayItem)
@ -234,14 +236,14 @@ public Handler_VoteCallback(Menu menu, MenuAction action, int param1, int param2
switch (g_voteType) switch (g_voteType)
{ {
case (voteType:gravity): case (gravity):
{ {
PrintToChatAll("[SM] %t", "Cvar changed", "sv_gravity", item); PrintToChatAll("[SM] %t", "Cvar changed", "sv_gravity", item);
LogAction(-1, -1, "Changing gravity to %s due to vote.", item); LogAction(-1, -1, "Changing gravity to %s due to vote.", item);
g_Cvar_Gravity.IntValue = StringToInt(item); g_Cvar_Gravity.IntValue = StringToInt(item);
} }
case (voteType:burn): case (burn):
{ {
PrintToChatAll("[SM] %t", "Set target on fire", "_s", g_voteInfo[VOTE_NAME]); PrintToChatAll("[SM] %t", "Set target on fire", "_s", g_voteInfo[VOTE_NAME]);
LogAction(-1, g_voteClient[VOTE_CLIENTID], "Vote burn successful, igniting \"%L\"", g_voteClient[VOTE_CLIENTID]); LogAction(-1, g_voteClient[VOTE_CLIENTID], "Vote burn successful, igniting \"%L\"", g_voteClient[VOTE_CLIENTID]);
@ -249,7 +251,7 @@ public Handler_VoteCallback(Menu menu, MenuAction action, int param1, int param2
IgniteEntity(g_voteClient[VOTE_CLIENTID], 19.8); IgniteEntity(g_voteClient[VOTE_CLIENTID], 19.8);
} }
case (voteType:slay): case (slay):
{ {
PrintToChatAll("[SM] %t", "Slayed player", g_voteInfo[VOTE_NAME]); PrintToChatAll("[SM] %t", "Slayed player", g_voteInfo[VOTE_NAME]);
LogAction(-1, g_voteClient[VOTE_CLIENTID], "Vote slay successful, slaying \"%L\"", g_voteClient[VOTE_CLIENTID]); LogAction(-1, g_voteClient[VOTE_CLIENTID], "Vote slay successful, slaying \"%L\"", g_voteClient[VOTE_CLIENTID]);
@ -258,14 +260,14 @@ public Handler_VoteCallback(Menu menu, MenuAction action, int param1, int param2
ForcePlayerSuicide(g_voteClient[VOTE_CLIENTID]); ForcePlayerSuicide(g_voteClient[VOTE_CLIENTID]);
} }
case (voteType:alltalk): case (alltalk):
{ {
PrintToChatAll("[SM] %t", "Cvar changed", "sv_alltalk", (g_Cvar_Alltalk.BoolValue ? "0" : "1")); PrintToChatAll("[SM] %t", "Cvar changed", "sv_alltalk", (g_Cvar_Alltalk.BoolValue ? "0" : "1"));
LogAction(-1, -1, "Changing alltalk to %s due to vote.", (g_Cvar_Alltalk.BoolValue ? "0" : "1")); LogAction(-1, -1, "Changing alltalk to %s due to vote.", (g_Cvar_Alltalk.BoolValue ? "0" : "1"));
g_Cvar_Alltalk.BoolValue = !g_Cvar_Alltalk.BoolValue; g_Cvar_Alltalk.BoolValue = !g_Cvar_Alltalk.BoolValue;
} }
case (voteType:ff): case (ff):
{ {
PrintToChatAll("[SM] %t", "Cvar changed", "mp_friendlyfire", (g_Cvar_FF.BoolValue ? "0" : "1")); PrintToChatAll("[SM] %t", "Cvar changed", "mp_friendlyfire", (g_Cvar_FF.BoolValue ? "0" : "1"));
LogAction(-1, -1, "Changing friendly fire to %s due to vote.", (g_Cvar_FF.BoolValue ? "0" : "1")); LogAction(-1, -1, "Changing friendly fire to %s due to vote.", (g_Cvar_FF.BoolValue ? "0" : "1"));
@ -279,11 +281,11 @@ public Handler_VoteCallback(Menu menu, MenuAction action, int param1, int param2
} }
/* /*
VoteSelect(Handle:menu, param1, param2 = 0) void VoteSelect(Menu menu, int param1, int param2 = 0)
{ {
if (GetConVarInt(g_Cvar_VoteShow) == 1) if (g_Cvar_VoteShow.IntValue == 1)
{ {
decl String:voter[MAX_NAME_LENGTH], String:junk[64], String:choice[64]; char voter[MAX_NAME_LENGTH], junk[64], choice[64];
GetClientName(param1, voter, sizeof(voter)); GetClientName(param1, voter, sizeof(voter));
menu.GetItem(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); PrintToChatAll("[SM] %T", "Vote Select", LANG_SERVER, voter, choice);
@ -291,20 +293,20 @@ VoteSelect(Handle:menu, param1, param2 = 0)
} }
*/ */
VoteMenuClose() void VoteMenuClose()
{ {
delete g_hVoteMenu; delete g_hVoteMenu;
g_hVoteMenu = null; g_hVoteMenu = null;
} }
Float:GetVotePercent(votes, totalVotes) float GetVotePercent(int votes, int totalVotes)
{ {
return FloatDiv(float(votes),float(totalVotes)); return FloatDiv(float(votes),float(totalVotes));
} }
bool:TestVoteDelay(client) bool TestVoteDelay(int client)
{ {
new delay = CheckVoteDelay(); int delay = CheckVoteDelay();
if (delay > 0) if (delay > 0)
{ {

View File

@ -31,7 +31,7 @@
* Version: $Id$ * Version: $Id$
*/ */
DisplayVoteAllTalkMenu(client) void DisplayVoteAllTalkMenu(int client)
{ {
if (IsVoteInProgress()) if (IsVoteInProgress())
{ {
@ -47,10 +47,10 @@ DisplayVoteAllTalkMenu(client)
LogAction(client, -1, "\"%L\" initiated an alltalk vote.", client); LogAction(client, -1, "\"%L\" initiated an alltalk vote.", client);
ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Alltalk"); ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Alltalk");
g_voteType = voteType:alltalk; g_voteType = alltalk;
g_voteInfo[VOTE_NAME][0] = '\0'; g_voteInfo[VOTE_NAME][0] = '\0';
g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL); g_hVoteMenu = new Menu(Handler_VoteCallback, MENU_ACTIONS_ALL);
if (g_Cvar_Alltalk.BoolValue) if (g_Cvar_Alltalk.BoolValue)
{ {
@ -67,13 +67,12 @@ DisplayVoteAllTalkMenu(client)
g_hVoteMenu.DisplayVoteToAll(20); g_hVoteMenu.DisplayVoteToAll(20);
} }
public void AdminMenu_VoteAllTalk(TopMenu topmenu,
public AdminMenu_VoteAllTalk(Handle:topmenu, TopMenuAction action,
TopMenuAction:action, TopMenuObject object_id,
TopMenuObject:object_id, int param,
param, char[] buffer,
String:buffer[], int maxlength)
maxlength)
{ {
if (action == TopMenuAction_DisplayOption) if (action == TopMenuAction_DisplayOption)
{ {
@ -90,7 +89,7 @@ public AdminMenu_VoteAllTalk(Handle:topmenu,
} }
} }
public Action:Command_VoteAlltalk(client, args) public Action Command_VoteAlltalk(int client, int args)
{ {
if (args > 0) if (args > 0)
{ {

View File

@ -31,7 +31,7 @@
* Version: $Id$ * Version: $Id$
*/ */
DisplayVoteBurnMenu(client, target, String:name[]) void DisplayVoteBurnMenu(int client, int target, char[] name)
{ {
if (!IsPlayerAlive(target)) if (!IsPlayerAlive(target))
{ {
@ -45,9 +45,9 @@ DisplayVoteBurnMenu(client, target, String:name[])
LogAction(client, target, "\"%L\" initiated a burn vote against \"%L\"", client, target); LogAction(client, target, "\"%L\" initiated a burn vote against \"%L\"", client, target);
ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Burn", g_voteInfo[VOTE_NAME]); ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Burn", g_voteInfo[VOTE_NAME]);
g_voteType = voteType:burn; g_voteType = burn;
g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL); g_hVoteMenu = new Menu(Handler_VoteCallback, MENU_ACTIONS_ALL);
g_hVoteMenu.SetTitle("Voteburn player"); g_hVoteMenu.SetTitle("Voteburn player");
g_hVoteMenu.AddItem(VOTE_YES, "Yes"); g_hVoteMenu.AddItem(VOTE_YES, "Yes");
g_hVoteMenu.AddItem(VOTE_NO, "No"); g_hVoteMenu.AddItem(VOTE_NO, "No");
@ -55,11 +55,11 @@ DisplayVoteBurnMenu(client, target, String:name[])
g_hVoteMenu.DisplayVoteToAll(20); g_hVoteMenu.DisplayVoteToAll(20);
} }
DisplayBurnTargetMenu(client) void DisplayBurnTargetMenu(int client)
{ {
Menu menu = CreateMenu(MenuHandler_Burn); Menu menu = new Menu(MenuHandler_Burn);
decl String:title[100]; char title[100];
Format(title, sizeof(title), "%T:", "Burn vote", client); Format(title, sizeof(title), "%T:", "Burn vote", client);
menu.SetTitle(title); menu.SetTitle(title);
menu.ExitBackButton = true; menu.ExitBackButton = true;
@ -69,12 +69,12 @@ DisplayBurnTargetMenu(client)
menu.Display(client, MENU_TIME_FOREVER); menu.Display(client, MENU_TIME_FOREVER);
} }
public AdminMenu_VoteBurn(Handle:topmenu, public void AdminMenu_VoteBurn(TopMenu topmenu,
TopMenuAction:action, TopMenuAction action,
TopMenuObject:object_id, TopMenuObject object_id,
param, int param,
String:buffer[], char[] buffer,
maxlength) int maxlength)
{ {
if (action == TopMenuAction_DisplayOption) if (action == TopMenuAction_DisplayOption)
{ {
@ -91,7 +91,7 @@ public AdminMenu_VoteBurn(Handle:topmenu,
} }
} }
public MenuHandler_Burn(Menu menu, MenuAction action, int param1, int param2) public int MenuHandler_Burn(Menu menu, MenuAction action, int param1, int param2)
{ {
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
@ -106,8 +106,8 @@ public MenuHandler_Burn(Menu menu, MenuAction action, int param1, int param2)
} }
else if (action == MenuAction_Select) else if (action == MenuAction_Select)
{ {
decl String:info[32], String:name[32]; char info[32], name[32];
new userid, target; int userid, target;
menu.GetItem(param2, info, sizeof(info), _, name, sizeof(name)); menu.GetItem(param2, info, sizeof(info), _, name, sizeof(name));
userid = StringToInt(info); userid = StringToInt(info);
@ -131,7 +131,7 @@ public MenuHandler_Burn(Menu menu, MenuAction action, int param1, int param2)
} }
} }
public Action:Command_VoteBurn(client, args) public Action Command_VoteBurn(int client, int args)
{ {
if (args < 1) if (args < 1)
{ {
@ -150,13 +150,14 @@ public Action:Command_VoteBurn(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
decl String:text[256], String:arg[64]; char text[256], arg[64];
GetCmdArgString(text, sizeof(text)); GetCmdArgString(text, sizeof(text));
BreakString(text, arg, sizeof(arg)); BreakString(text, arg, sizeof(arg));
decl String:target_name[MAX_TARGET_LENGTH]; char target_name[MAX_TARGET_LENGTH];
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString( if ((target_count = ProcessTargetString(
arg, arg,

View File

@ -31,7 +31,7 @@
* Version: $Id$ * Version: $Id$
*/ */
DisplayVoteFFMenu(client) void DisplayVoteFFMenu(int client)
{ {
if (IsVoteInProgress()) if (IsVoteInProgress())
{ {
@ -47,10 +47,10 @@ DisplayVoteFFMenu(client)
LogAction(client, -1, "\"%L\" initiated a friendly fire vote.", client); LogAction(client, -1, "\"%L\" initiated a friendly fire vote.", client);
ShowActivity2(client, "[SM] ", "%t", "Initiated Vote FF"); ShowActivity2(client, "[SM] ", "%t", "Initiated Vote FF");
g_voteType = voteType:ff; g_voteType = ff;
g_voteInfo[VOTE_NAME][0] = '\0'; g_voteInfo[VOTE_NAME][0] = '\0';
g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL); g_hVoteMenu = new Menu(Handler_VoteCallback, MENU_ACTIONS_ALL);
if (g_Cvar_FF.BoolValue) if (g_Cvar_FF.BoolValue)
{ {
@ -67,12 +67,12 @@ DisplayVoteFFMenu(client)
g_hVoteMenu.DisplayVoteToAll(20); g_hVoteMenu.DisplayVoteToAll(20);
} }
public AdminMenu_VoteFF(Handle:topmenu, public void AdminMenu_VoteFF(TopMenu topmenu,
TopMenuAction:action, TopMenuAction action,
TopMenuObject:object_id, TopMenuObject object_id,
param, int param,
String:buffer[], char[] buffer,
maxlength) int maxlength)
{ {
if (action == TopMenuAction_DisplayOption) if (action == TopMenuAction_DisplayOption)
{ {
@ -89,7 +89,7 @@ public AdminMenu_VoteFF(Handle:topmenu,
} }
} }
public Action:Command_VoteFF(client, args) public Action Command_VoteFF(int client, int args)
{ {
if (args > 0) if (args > 0)
{ {

View File

@ -31,15 +31,14 @@
* Version: $Id$ * Version: $Id$
*/ */
void DisplayVoteGravityMenu(int client, int count, char[][] items)
DisplayVoteGravityMenu(client,count,String:items[5][])
{ {
LogAction(client, -1, "\"%L\" initiated a gravity vote.", client); LogAction(client, -1, "\"%L\" initiated a gravity vote.", client);
ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Gravity"); ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Gravity");
g_voteType = voteType:gravity; g_voteType = gravity;
g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL); g_hVoteMenu = new Menu(Handler_VoteCallback, MENU_ACTIONS_ALL);
if (count == 1) if (count == 1)
{ {
@ -54,7 +53,7 @@ DisplayVoteGravityMenu(client,count,String:items[5][])
g_voteInfo[VOTE_NAME][0] = '\0'; g_voteInfo[VOTE_NAME][0] = '\0';
g_hVoteMenu.SetTitle("Gravity Vote"); g_hVoteMenu.SetTitle("Gravity Vote");
for (new i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
g_hVoteMenu.AddItem(items[i], items[i]); g_hVoteMenu.AddItem(items[i], items[i]);
} }
@ -64,12 +63,12 @@ DisplayVoteGravityMenu(client,count,String:items[5][])
g_hVoteMenu.DisplayVoteToAll(20); g_hVoteMenu.DisplayVoteToAll(20);
} }
public AdminMenu_VoteGravity(Handle:topmenu, public void AdminMenu_VoteGravity(TopMenu topmenu,
TopMenuAction:action, TopMenuAction action,
TopMenuObject:object_id, TopMenuObject object_id,
param, int param,
String:buffer[], char[] buffer,
maxlength) int maxlength)
{ {
if (action == TopMenuAction_DisplayOption) if (action == TopMenuAction_DisplayOption)
{ {
@ -78,7 +77,7 @@ public AdminMenu_VoteGravity(Handle:topmenu,
else if (action == TopMenuAction_SelectOption) else if (action == TopMenuAction_SelectOption)
{ {
/* Might need a better way of selecting the list of pre-defined gravity choices */ /* Might need a better way of selecting the list of pre-defined gravity choices */
new String:items[5][5] ={"200","400","800","1600","3200"}; char items[5][5] ={"200","400","800","1600","3200"};
DisplayVoteGravityMenu(param,5, items); DisplayVoteGravityMenu(param,5, items);
} }
else if (action == TopMenuAction_DrawOption) else if (action == TopMenuAction_DrawOption)
@ -88,7 +87,7 @@ public AdminMenu_VoteGravity(Handle:topmenu,
} }
} }
public Action:Command_VoteGravity(client, args) public Action Command_VoteGravity(int client, int args)
{ {
if (args < 1) if (args < 1)
{ {
@ -107,18 +106,18 @@ public Action:Command_VoteGravity(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
decl String:text[256]; char text[256];
GetCmdArgString(text, sizeof(text)); GetCmdArgString(text, sizeof(text));
decl String:items[5][64]; char items[5][64];
new count; int count;
new len, pos; int len, pos;
while (pos != -1 && count < 5) while (pos != -1 && count < 5)
{ {
pos = BreakString(text[len], items[count], sizeof(items[])); pos = BreakString(text[len], items[count], sizeof(items[]));
decl Float:temp; float temp;
if (StringToFloatEx(items[count], temp) == 0) if (StringToFloatEx(items[count], temp) == 0)
{ {
ReplyToCommand(client, "[SM] %t", "Invalid Amount"); ReplyToCommand(client, "[SM] %t", "Invalid Amount");

View File

@ -31,8 +31,7 @@
* Version: $Id$ * Version: $Id$
*/ */
void DisplayVoteSlayMenu(int client, int target, char[] name)
DisplayVoteSlayMenu(client, target, String:name[])
{ {
if (!IsPlayerAlive(target)) if (!IsPlayerAlive(target))
{ {
@ -46,9 +45,9 @@ DisplayVoteSlayMenu(client, target, String:name[])
LogAction(client, target, "\"%L\" initiated a slay vote against \"%L\"", client, target); LogAction(client, target, "\"%L\" initiated a slay vote against \"%L\"", client, target);
ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Slay", g_voteInfo[VOTE_NAME]); ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Slay", g_voteInfo[VOTE_NAME]);
g_voteType = voteType:slay; g_voteType = slay;
g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL); g_hVoteMenu = new Menu(Handler_VoteCallback, MENU_ACTIONS_ALL);
g_hVoteMenu.SetTitle("Voteslay Player"); g_hVoteMenu.SetTitle("Voteslay Player");
g_hVoteMenu.AddItem(VOTE_YES, "Yes"); g_hVoteMenu.AddItem(VOTE_YES, "Yes");
g_hVoteMenu.AddItem(VOTE_NO, "No"); g_hVoteMenu.AddItem(VOTE_NO, "No");
@ -56,11 +55,11 @@ DisplayVoteSlayMenu(client, target, String:name[])
g_hVoteMenu.DisplayVoteToAll(20); g_hVoteMenu.DisplayVoteToAll(20);
} }
DisplaySlayTargetMenu(client) void DisplaySlayTargetMenu(int client)
{ {
Menu menu = CreateMenu(MenuHandler_Slay); Menu menu = new Menu(MenuHandler_Slay);
decl String:title[100]; char title[100];
Format(title, sizeof(title), "%T:", "Slay vote", client); Format(title, sizeof(title), "%T:", "Slay vote", client);
menu.SetTitle(title); menu.SetTitle(title);
menu.ExitBackButton = true; menu.ExitBackButton = true;
@ -70,12 +69,12 @@ DisplaySlayTargetMenu(client)
menu.Display(client, MENU_TIME_FOREVER); menu.Display(client, MENU_TIME_FOREVER);
} }
public AdminMenu_VoteSlay(Handle:topmenu, public void AdminMenu_VoteSlay(TopMenu topmenu,
TopMenuAction:action, TopMenuAction action,
TopMenuObject:object_id, TopMenuObject object_id,
param, int param,
String:buffer[], char[] buffer,
maxlength) int maxlength)
{ {
if (action == TopMenuAction_DisplayOption) if (action == TopMenuAction_DisplayOption)
{ {
@ -92,7 +91,7 @@ public AdminMenu_VoteSlay(Handle:topmenu,
} }
} }
public MenuHandler_Slay(Menu menu, MenuAction action, int param1, int param2) public int MenuHandler_Slay(Menu menu, MenuAction action, int param1, int param2)
{ {
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
@ -107,8 +106,8 @@ public MenuHandler_Slay(Menu menu, MenuAction action, int param1, int param2)
} }
else if (action == MenuAction_Select) else if (action == MenuAction_Select)
{ {
decl String:info[32], String:name[32]; char info[32], name[32];
new userid, target; int userid, target;
menu.GetItem(param2, info, sizeof(info), _, name, sizeof(name)); menu.GetItem(param2, info, sizeof(info), _, name, sizeof(name));
userid = StringToInt(info); userid = StringToInt(info);
@ -132,7 +131,7 @@ public MenuHandler_Slay(Menu menu, MenuAction action, int param1, int param2)
} }
} }
public Action:Command_VoteSlay(client, args) public Action Command_VoteSlay(int client, int args)
{ {
if (args < 1) if (args < 1)
{ {
@ -151,13 +150,14 @@ public Action:Command_VoteSlay(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
decl String:text[256], String:arg[64]; char text[256], arg[64];
GetCmdArgString(text, sizeof(text)); GetCmdArgString(text, sizeof(text));
BreakString(text, arg, sizeof(arg)); BreakString(text, arg, sizeof(arg));
decl String:target_name[MAX_TARGET_LENGTH]; char target_name[MAX_TARGET_LENGTH];
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString( if ((target_count = ProcessTargetString(
arg, arg,