From a41fb5c04e5d71fa1cfcd5184a3530825a3410ea Mon Sep 17 00:00:00 2001 From: naydef Date: Mon, 2 Oct 2017 14:55:31 +0300 Subject: [PATCH 01/12] Convert include file and fix translation --- .../scripting/include/freak_fortress_2.inc | 138 +++++++++--------- .../translations/freak_fortress_2.phrases.txt | 2 +- 2 files changed, 70 insertions(+), 70 deletions(-) diff --git a/addons/sourcemod/scripting/include/freak_fortress_2.inc b/addons/sourcemod/scripting/include/freak_fortress_2.inc index 632f50aa..243639c9 100644 --- a/addons/sourcemod/scripting/include/freak_fortress_2.inc +++ b/addons/sourcemod/scripting/include/freak_fortress_2.inc @@ -34,7 +34,7 @@ * @return False if FF2 is disabled * True if FF2 is enabled */ -native bool:FF2_IsFF2Enabled(); +native bool FF2_IsFF2Enabled(); /** * Register a subplugin with FF2 @@ -43,7 +43,7 @@ native bool:FF2_IsFF2Enabled(); * * @noreturn */ -native FF2_RegisterSubplugin(String:pluginName[]); +native void FF2_RegisterSubplugin(char[] pluginName); /** * Unregister a subplugin with FF2 @@ -52,7 +52,7 @@ native FF2_RegisterSubplugin(String:pluginName[]); * * @noreturn */ -native FF2_UnregisterSubplugin(String:pluginName[]); +native void FF2_UnregisterSubplugin(char[] pluginName); /** * Gets the version of FF2 running on the server @@ -60,7 +60,7 @@ native FF2_UnregisterSubplugin(String:pluginName[]); * @param version An array of size 3 that will contain the major, minor, and stable version numbers respectively * @return True if the server is running a dev version of FF2, false otherwise */ -native FF2_GetFF2Version(version[]=0); +native void FF2_GetFF2Version(int version[]=0); /** * Gets current round state @@ -70,7 +70,7 @@ native FF2_GetFF2Version(version[]=0); * 1 - round is in progress (due to a bug in arena mode, stalemate will also return 1) * 2 - someone wins */ -native FF2_GetRoundState(); +native int FF2_GetRoundState(); /** * Gets the userid of the boss @@ -78,7 +78,7 @@ native FF2_GetRoundState(); * @param boss Boss's index * @return Userid of boss (-1 if Boss does not exist) */ -native FF2_GetBossUserId(boss=0); +native int FF2_GetBossUserId(int boss=0); /** * Gets the boss index of a client @@ -86,13 +86,13 @@ native FF2_GetBossUserId(boss=0); * @param client The client used to search for the boss index * @return Boss index of that client. If client is not boss, returns -1 */ -native FF2_GetBossIndex(client); +native int FF2_GetBossIndex(int client); /** * Gets the boss's team * @return Boss's team */ -native TFTeam:FF2_GetBossTeam(); +native TFTeam FF2_GetBossTeam(); /** * Gets the character name of the boss @@ -102,7 +102,7 @@ native TFTeam:FF2_GetBossTeam(); * @param length Length of buffer string * @return True if boss exists, false if not */ -native bool:FF2_GetBossName(boss=0, String:bossName[], length); +native bool FF2_GetBossName(int boss=0, char[] bossName, int length); /** * Gets a Boss's KV handle @@ -110,7 +110,7 @@ native bool:FF2_GetBossName(boss=0, String:bossName[], length); * @param boss Boss's index * @return Boss's KV handle or INVALID_HANDLE if boss index is invalid */ -native Handle:FF2_GetBossKV(boss=0); +native Handle FF2_GetBossKV(int boss=0); /** * Gets the current health value of the Boss @@ -118,7 +118,7 @@ native Handle:FF2_GetBossKV(boss=0); * @param boss Boss's index * @return Current health of the Boss */ -native FF2_GetBossHealth(boss=0); +native int FF2_GetBossHealth(int boss=0); /** * Sets the health of the Boss @@ -127,7 +127,7 @@ native FF2_GetBossHealth(boss=0); * @param health New health value * @noreturn */ -native FF2_SetBossHealth(boss, health); +native void FF2_SetBossHealth(int boss, int health); /** * Gets the max health of the Boss @@ -135,7 +135,7 @@ native FF2_SetBossHealth(boss, health); * @param boss Boss's index * @return Max health of the Boss */ -native FF2_GetBossMaxHealth(boss=0); +native int FF2_GetBossMaxHealth(int boss=0); /** * Sets the max health of the Boss @@ -144,7 +144,7 @@ native FF2_GetBossMaxHealth(boss=0); * @param health New max health value * @noreturn */ -native FF2_SetBossMaxHealth(boss, health); +native void FF2_SetBossMaxHealth(int boss, int health); /** * Gets the current number of lives of the Boss @@ -152,7 +152,7 @@ native FF2_SetBossMaxHealth(boss, health); * @param boss Boss's index * @return Number of lives the boss has remaining */ -native FF2_GetBossLives(boss=0); +native int FF2_GetBossLives(int boss=0); /** * Sets the current number of lives of the Boss @@ -161,7 +161,7 @@ native FF2_GetBossLives(boss=0); * @param lives New number of lives * @noreturn */ -native FF2_SetBossLives(boss, lives); +native void FF2_SetBossLives(int boss, int lives); /** * Gets the max number of lives of the Boss @@ -169,7 +169,7 @@ native FF2_SetBossLives(boss, lives); * @param boss Boss's index * @return Max number of lives of the Boss */ -native FF2_GetBossMaxLives(boss=0); +native int FF2_GetBossMaxLives(int boss=0); /** * Sets the max number of lives of the Boss @@ -178,7 +178,7 @@ native FF2_GetBossMaxLives(boss=0); * @param lives New max number of lives * @noreturn */ -native FF2_SetBossMaxLives(boss, lives); +native void FF2_SetBossMaxLives(int boss, int lives); /** * Gets the charge meter value of the Boss @@ -190,7 +190,7 @@ native FF2_SetBossMaxLives(boss, lives); * 2 - other charged abilities * @return Charge value of the Boss */ -native Float:FF2_GetBossCharge(boss, slot); +native float FF2_GetBossCharge(int boss, int slot); /** * Sets the charge meter value of the Boss @@ -203,7 +203,7 @@ native Float:FF2_GetBossCharge(boss, slot); * @param value New value of charge * @noreturn */ -native FF2_SetBossCharge(boss, slot, Float:value); +native void FF2_SetBossCharge(int boss, int slot, float value); /** * Gets how much damage is needed in order to activate the rage of the current boss @@ -211,7 +211,7 @@ native FF2_SetBossCharge(boss, slot, Float:value); * @param boss Boss index * @return Total damage needed */ -native FF2_GetBossRageDamage(boss); +native int FF2_GetBossRageDamage(int boss); /** * Sets how much damage is needed in order to activate the rage of the current boss @@ -220,7 +220,7 @@ native FF2_GetBossRageDamage(boss); * @param damage New damage value * @noreturn */ -native FF2_SetBossRageDamage(boss, damage); +native void FF2_SetBossRageDamage(int boss, int damage); /** * Gets an ability's rage distance @@ -230,7 +230,7 @@ native FF2_SetBossRageDamage(boss, damage); * @param abilityName Name of ability (use an empty string if you want get the boss's global "rage distance" value) * @return Ability's rage distance */ -native FF2_GetBossRageDistance(boss=0, const String:pluginName[]="", const String:abilityName[]=""); +native int FF2_GetBossRageDistance(int boss=0, const char[] pluginName="", const char[] abilityName=""); /** * Gets damage dealt by this client @@ -238,7 +238,7 @@ native FF2_GetBossRageDistance(boss=0, const String:pluginName[]="", const Strin * @param client Client's index * @return Damage dealt */ -native FF2_GetClientDamage(client); +native int FF2_GetClientDamage(int client); /** * Sets damage dealt by this client @@ -247,7 +247,7 @@ native FF2_GetClientDamage(client); * @param damage New damage dealt * @noreturn */ -native FF2_SetClientDamage(client, damage); +native void FF2_SetClientDamage(int lient, int damage); /** * Finds if a Boss has a certain ability @@ -257,7 +257,7 @@ native FF2_SetClientDamage(client, damage); * @param abilityName Name of ability * @return True if the boss has this ability, false if it doesn't */ -native bool:FF2_HasAbility(boss, const String:pluginName[], const String:abilityName[]); +native bool FF2_HasAbility(int boss, const char[] pluginName, char[] abilityName); /** * Gets the integer value of an ability argument @@ -269,7 +269,7 @@ native bool:FF2_HasAbility(boss, const String:pluginName[], const String:ability * @param defaultValue Value to return if argument does not exist * @return Value of argument */ -native FF2_GetAbilityArgument(boss, const String:pluginName[], const String:abilityName[], const String:argument[], defaultValue=0); +native int FF2_GetAbilityArgument(int boss, const char[] pluginName, const char[] abilityName, char[] argument, int defaultValue=0); /** * Gets the float value of an ability argument @@ -281,7 +281,7 @@ native FF2_GetAbilityArgument(boss, const String:pluginName[], const String:abil * @param defaultValue Value to return if argument does not exist * @return Value of argument */ -native Float:FF2_GetAbilityArgumentFloat(boss, const String:pluginName[], const String:abilityName[], const String:argument[], Float:defaultValue=0.0); +native float FF2_GetAbilityArgumentFloat(int boss, const char[] pluginName, const char[] abilityName, const char[] argument, float defaultValue=0.0); /** * Gets the string value of an ability argument @@ -295,7 +295,7 @@ native Float:FF2_GetAbilityArgumentFloat(boss, const String:pluginName[], const * @param defaultValue Value to return if argument does not exist * @noreturn */ -native FF2_GetAbilityArgumentString(boss, const String:pluginName[], const String:abilityName[], const String:argument[], String:buffer[], bufferLength, String:defaultValue[]=""); +native void FF2_GetAbilityArgumentString(int boss, const char[] pluginName, const char[] abilityName, const char[] argument , char[] buffer, int bufferLength, char[] defaultValue=""); /** * Determines how the Boss should use a certain ability @@ -313,7 +313,7 @@ native FF2_GetAbilityArgumentString(boss, const String:pluginName[], const Strin * 2 - by reload button * @noreturn */ -native FF2_UseAbility(boss, const String:pluginName[], const String:abilityName[], slot, buttonMode=0); +native void FF2_UseAbility(int boss, const char[] pluginName, const char[] abilityName, int slot, int buttonMode=0); /** * Gets a client's FF2 flags @@ -321,7 +321,7 @@ native FF2_UseAbility(boss, const String:pluginName[], const String:abilityName[ * @param client Client's index * @return Client's FF2 flags */ -native FF2_GetFF2Flags(client); +native int FF2_GetFF2Flags(int client); /** * Sets a client's FF2 flags @@ -330,7 +330,7 @@ native FF2_GetFF2Flags(client); * @param flags New flag values * @noreturn */ -native FF2_SetFF2Flags(client, flags); +native void FF2_SetFF2Flags(int client, int flags); /** * Gets a client's queue points @@ -338,7 +338,7 @@ native FF2_SetFF2Flags(client, flags); * @param client Client's index * @return Client's queue points */ -native FF2_GetQueuePoints(client); +native int FF2_GetQueuePoints(int client); /** * Sets a client's queue points @@ -347,7 +347,7 @@ native FF2_GetQueuePoints(client); * @param value New value of client's queue points * @noreturn */ -native FF2_SetQueuePoints(client, value); +native void FF2_SetQueuePoints(int client, int value); /** * Starts the Boss's music for the specified clients @@ -355,7 +355,7 @@ native FF2_SetQueuePoints(client, value); * @param client Client's index (0 for all clients) * @noreturn */ -native FF2_StartMusic(client=0); +native void FF2_StartMusic(int client=0); /** * Stops the Boss's music for the specified clients @@ -363,7 +363,7 @@ native FF2_StartMusic(client=0); * @param client Client's index (0 for all clients) * @noreturn */ -native FF2_StopMusic(client=0); +native void FF2_StopMusic(int client=0); /** * Finds a random Boss sound from its config file @@ -376,7 +376,7 @@ native FF2_StopMusic(client=0); * @param slot Slot of ability - only checked if 'ability' is true * @return True if a sound was found, false otherwise */ -native bool:FF2_FindSound(const String:sound[], String:file[], length, boss=0, bool:ability=false, slot=0); +native bool FF2_FindSound(const char[] sound, char[] file, int length, int boss=0, bool ability=false, int slot=0); /** * Gets a client's glow timer @@ -384,7 +384,7 @@ native bool:FF2_FindSound(const String:sound[], String:file[], length, boss=0, b * @param client Client's index * @return Number of seconds left until client glow disappears (-1 if invalid client) */ -native Float:FF2_GetClientGlow(client); +native float FF2_GetClientGlow(int client); /** * Sets a client's glow timer @@ -394,13 +394,13 @@ native Float:FF2_GetClientGlow(client); * @param time2 New value of glow timer * @noreturn */ -native FF2_SetClientGlow(client, Float:time1, Float:time2=-1.0); +native float FF2_SetClientGlow(int client, float time1, float time2=-1.0); /** * Returns whether or not debug is enabled * @return True if enabled, false otherwise */ -native bool:FF2_Debug(); +native bool FF2_Debug(); /** * Set sound flags for specified client @@ -409,7 +409,7 @@ native bool:FF2_Debug(); * @param flags Flags which to set * @noreturn */ -native FF2_SetSoundFlags(client, flags); +native void FF2_SetSoundFlags(int client, int flags); /** * Clear sound flags for specified client @@ -418,7 +418,7 @@ native FF2_SetSoundFlags(client, flags); * @param flags Flags which to clear * @noreturn */ -native FF2_ClearSoundFlags(client, flags); +native void FF2_ClearSoundFlags(int client, int flags); /** * Check sound flags for specified client @@ -427,7 +427,7 @@ native FF2_ClearSoundFlags(client, flags); * @param flags Flags which to check * @return True if the client does _not_ have the given flags, false otherwise */ -native bool:FF2_CheckSoundFlags(client, flags); +native bool FF2_CheckSoundFlags(int client, int flags); /** * Called whenever a boss uses an ability (Rage, jump, teleport, etc) @@ -448,8 +448,8 @@ native bool:FF2_CheckSoundFlags(client, flags); * 3 - In use * @return Plugin_Handled or Plugin_Stop for FF2_PreAbility to prevent FF2_OnAbility */ -forward Action:FF2_PreAbility(boss, const String:pluginName[], const String:abilityName[], slot); -forward FF2_OnAbility(boss, const String:pluginName[], const String:abilityName[], slot, status); +forward Action FF2_PreAbility(int boss, const char[] pluginName, const char[] abilityName, int slot); +forward void FF2_OnAbility(int boss, const char[] pluginName, const char[] abilityName, int slot, int status); /** * Called when a boss rages @@ -458,7 +458,7 @@ forward FF2_OnAbility(boss, const String:pluginName[], const String:abilityName[ * @param distance Rage distance * @return Plugin_Changed to change rage distance, Plugin_Handled or Plugin_Stop to prevent rage */ -forward Action:FF2_OnRage(boss, &distance); +forward Action FF2_OnRage(int boss, int& distance); /** * Called when a boss super jumps (this includes teleports) @@ -467,7 +467,7 @@ forward Action:FF2_OnRage(boss, &distance); * @param superDuperJump Whether or not super duper jump is enabled * @return Plugin_Changed to change super duper jump status, Plugin_Handled or Plugin_Stop to prevent super jump */ -forward Action:FF2_OnSuperJump(boss, &bool:superDuperJump); +forward Action FF2_OnSuperJump(int boss, bool& superDuperJump); /** * Called when a boss uses weighdown @@ -475,7 +475,7 @@ forward Action:FF2_OnSuperJump(boss, &bool:superDuperJump); * @param boss Boss's index * @return Plugin_Handled or Plugin_Stop to prevent weighdown */ -forward Action:FF2_OnWeighdown(boss); +forward Action FF2_OnWeighdown(int boss); /** * Called when a Boss gets hurt by environmental damage @@ -485,7 +485,7 @@ forward Action:FF2_OnWeighdown(boss); * @param damage Damage by "trigger_hurt". Cutomizable. * @return Plugin_Stop will prevent damage, Plugin_Changed will change damage. */ -forward Action:FF2_OnTriggerHurt(boss, triggerHurt, &Float:damage); +forward Action FF2_OnTriggerHurt(int boss, int triggerHurt, float& damage); /** * Called when a Boss's music begins for a client @@ -495,7 +495,7 @@ forward Action:FF2_OnTriggerHurt(boss, triggerHurt, &Float:damage); * @param time Music length * @return Plugin_Stop will prevent music, Plugin_Changed will change it. */ -forward Action:FF2_OnMusic(client, String:path[], &time); +forward Action FF2_OnMusic(int client, char[] path, int& time); /** * Called when FF2 picks a boss @@ -506,7 +506,7 @@ forward Action:FF2_OnMusic(client, String:path[], &time); * @param preset True if the boss was set using a command such as ff2_special * @return You can NOT use Plugin_Stop to prevent this, but you can change characterName and use Plugin_Changed to change the boss. If you want to change 'character', then make 'characterName' null. */ -forward Action:FF2_OnBossSelected(boss, &character, String:characterName[], bool:preset); +forward Action FF2_OnBossSelected(int boss, int& character, char[] characterName, bool preset); /** * Called when FF2 adds queue points @@ -515,7 +515,7 @@ forward Action:FF2_OnBossSelected(boss, &character, String:characterName[], bool * * @return Plugin_Stop will prevent this, Plugin_Changed will change it. */ -forward Action:FF2_OnAddQueuePoints(add_points[MAXPLAYERS+1]); +forward Action FF2_OnAddQueuePoints(int add_points[MAXPLAYERS+1]); /** * Called when FF2 picks a character set for the map @@ -523,7 +523,7 @@ forward Action:FF2_OnAddQueuePoints(add_points[MAXPLAYERS+1]); * @param characterSet Name of character set * @return You can NOT use Plugin_Stop to prevent this, but you can change characterSet and return Plugin_Changed to change the character set. */ -forward Action:FF2_OnLoadCharacterSet(String:characterSet[]); +forward Action FF2_OnLoadCharacterSet(char[] characterSet); /** * Called when a boss loses a life @@ -533,7 +533,7 @@ forward Action:FF2_OnLoadCharacterSet(String:characterSet[]); * @param maxLives Max number of lives * @return Plugin_Stop or Plugin_Handled to prevent damage that would remove a life, Plugin_Changed if you want to change the number of lives left. Setting lives to a value greater than maxLives will also set maxLives to that value. */ -forward Action:FF2_OnLoseLife(boss, &lives, maxLives); +forward Action FF2_OnLoseLife(int boss, int& lives, int maxLives); /** * Called when the number of alive players changes. Note that this will never be 0 as FF2 does not re-calculate the number of players once the round ends. @@ -542,7 +542,7 @@ forward Action:FF2_OnLoseLife(boss, &lives, maxLives); * @param bosses Number of alive players left on the boss team (this includes minions as well) * @noreturn */ -forward Action:FF2_OnAlivePlayersChanged(players, bosses); +forward Action FF2_OnAlivePlayersChanged(int players, int bosses); /** * Called when an unknown variable is encountered while parsing a formula @@ -551,7 +551,7 @@ forward Action:FF2_OnAlivePlayersChanged(players, bosses); * @param variableValue Value of the variable * @return Plugin_Changed to allocate variableValue to the unknown variable */ -forward Action:FF2_OnParseUnknownVariable(String:variable[], &Float:variableValue); +forward Action FF2_OnParseUnknownVariable(char[] variable, float& variableValue); /** * Gives ammo to a weapon @@ -562,7 +562,7 @@ forward Action:FF2_OnParseUnknownVariable(String:variable[], &Float:variableValu * @param clip Clip * @noreturn */ -stock FF2_SetAmmo(client, weapon, ammo=-1, clip=-1) +stock void FF2_SetAmmo(int client, int weapon, int ammo=-1, int clip=-1) { if(IsValidEntity(weapon)) { @@ -571,14 +571,14 @@ stock FF2_SetAmmo(client, weapon, ammo=-1, clip=-1) SetEntProp(weapon, Prop_Data, "m_iClip1", clip); } - new ammoType=(ammo>-1 ? GetEntProp(weapon, Prop_Send, "m_iPrimaryAmmoType") : -1); + int ammoType=(ammo>-1 ? GetEntProp(weapon, Prop_Send, "m_iPrimaryAmmoType") : -1); if(ammoType!=-1) { SetEntProp(client, Prop_Data, "m_iAmmo", ammo, _, ammoType); } else if(ammo>-1) //Only complain if we're trying to set ammo { - decl String:classname[64], String:bossName[32]; + char classname[64], bossName[32]; GetEdictClassname(weapon, classname, sizeof(classname)); FF2_GetBossName(FF2_GetBossIndex(client), bossName, sizeof(bossName)); LogError("[FF2] Cannot give ammo to weapon %s (boss %s)-check your config!", classname, bossName); @@ -592,11 +592,11 @@ stock FF2_SetAmmo(client, weapon, ammo=-1, clip=-1) * * Uses the same params and return values as ShowSyncHudText */ -stock FF2_ShowSyncHudText(client, Handle:sync, const String:buffer[], any:...) +stock void FF2_ShowSyncHudText(int client, Handle sync, const char[] buffer, any...) { if(!(FF2_GetFF2Flags(client) & FF2FLAG_HUDDISABLED) && !(GetClientButtons(client) & IN_SCORE)) { - decl String:message[256]; + char message[256]; VFormat(message, sizeof(message), buffer, 4); ShowSyncHudText(client, sync, message); } @@ -608,11 +608,11 @@ stock FF2_ShowSyncHudText(client, Handle:sync, const String:buffer[], any:...) * * Uses the same params and return values as ShowHudText */ -stock FF2_ShowHudText(client, channel, const String:buffer[], any:...) +stock void FF2_ShowHudText(int client, int channel, const char[] buffer, any...) { if(!(FF2_GetFF2Flags(client) & FF2FLAG_HUDDISABLED) && !(GetClientButtons(client) & IN_SCORE)) { - decl String:message[256]; + char message[256]; VFormat(message, sizeof(message), buffer, 4); ShowHudText(client, channel, message); } @@ -628,10 +628,10 @@ stock FF2_ShowHudText(client, channel, const String:buffer[], any:...) * @param maxStringLength Maximum length of each string buffer. * @return Number of strings retrieved. */ -stock int ExplodeStringIntoArrayList(const String:text[], const String:split[], Handle:list, maxStringLength) +stock int ExplodeStringIntoArrayList(const char[] text, const char[] split, Handle list, int maxStringLength) { - new reloc_idx, index, total; - new String:temp[maxStringLength]; + int reloc_idx, index, total; + char[] temp=new char[maxStringLength]; if(!split[0]) { @@ -658,18 +658,18 @@ stock int ExplodeStringIntoArrayList(const String:text[], const String:split[], * @param any:... Formatting rules * @noreturn */ -stock Debug(String:buffer[], any:...) +stock void Debug(char[] buffer, any...) { if(FF2_Debug()) { - decl String:message[192]; + char message[192]; VFormat(message, sizeof(message), buffer, 2); CPrintToChatAll("{olive}[FF2 {darkorange}DEBUG{olive}]{default} %s", message); PrintToServer("[FF2 DEBUG] %s", message); } } -public SharedPlugin:__pl_FF2= +public SharedPlugin __pl_FF2= { name="freak_fortress_2", file="freak_fortress_2.smx", diff --git a/addons/sourcemod/translations/freak_fortress_2.phrases.txt b/addons/sourcemod/translations/freak_fortress_2.phrases.txt index e7ddbe01..a593c6dc 100644 --- a/addons/sourcemod/translations/freak_fortress_2.phrases.txt +++ b/addons/sourcemod/translations/freak_fortress_2.phrases.txt @@ -127,7 +127,7 @@ } "What's New in FF2" { - "en" "What's new? (/ff2_new)." + "en" "What's new? (/ff2_changelog)." } "View Queue Points" { From bd1506db3c70da789881a64f55d45af524470a8b Mon Sep 17 00:00:00 2001 From: naydef Date: Tue, 3 Oct 2017 17:27:03 +0300 Subject: [PATCH 02/12] Update README.MD --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ad690f5..44229eaa 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ if(markdownIsStupid) { while(!someOtherBoolean) { - for(new i=0; i<=someOtherNumber; i+=3) + for(int i=0; i<=someOtherNumber; i+=3) { if(i==someNumber && moreVariableNames!=42) { From 672baeb617b06e110aa991bd30711c1c9e711e17 Mon Sep 17 00:00:00 2001 From: naydef Date: Tue, 3 Oct 2017 22:09:04 +0300 Subject: [PATCH 03/12] Convert freak_fortress_2.sp to new syntax --- .../sourcemod/scripting/freak_fortress_2.sp | 1999 +++++++++-------- 1 file changed, 1003 insertions(+), 996 deletions(-) diff --git a/addons/sourcemod/scripting/freak_fortress_2.sp b/addons/sourcemod/scripting/freak_fortress_2.sp index 2cac0616..89af1547 100644 --- a/addons/sourcemod/scripting/freak_fortress_2.sp +++ b/addons/sourcemod/scripting/freak_fortress_2.sp @@ -32,6 +32,8 @@ Updated by Wliu, Chris, Lawd, and Carge after Powerlord quit FF2 #tryinclude #define REQUIRE_PLUGIN +#pragma newdecls required + #define MAJOR_REVISION "2" #define MINOR_REVISION "0" #define STABLE_REVISION "0" @@ -60,154 +62,154 @@ Updated by Wliu, Chris, Lawd, and Carge after Powerlord quit FF2 #define CHANGELOG "changelog.txt" #if defined _steamtools_included -new bool:steamtools; +bool steamtools; #endif -new TFTeam:OtherTeam=TFTeam_Red; -new TFTeam:BossTeam=TFTeam_Blue; -new playing; -new healthcheckused; -new RedAlivePlayers; -new BlueAlivePlayers; -new RoundCount; -new character[MAXPLAYERS+1]; -new Incoming[MAXPLAYERS+1]; - -new Damage[MAXPLAYERS+1]; -new uberTarget[MAXPLAYERS+1]; -new shield[MAXPLAYERS+1]; -new detonations[MAXPLAYERS+1]; -new bool:playBGM[MAXPLAYERS+1]=true; -new queuePoints[MAXPLAYERS+1]; -new muteSound[MAXPLAYERS+1]; -new bool:displayInfo[MAXPLAYERS+1]; - -new String:currentBGM[MAXPLAYERS+1][PLATFORM_MAX_PATH]; - -new FF2Flags[MAXPLAYERS+1]; - -new Boss[MAXPLAYERS+1]; -new BossHealthMax[MAXPLAYERS+1]; -new BossHealth[MAXPLAYERS+1]; -new BossHealthLast[MAXPLAYERS+1]; -new BossLives[MAXPLAYERS+1]; -new BossLivesMax[MAXPLAYERS+1]; -new BossRageDamage[MAXPLAYERS+1]; -new Float:BossSpeed[MAXPLAYERS+1]; -new Float:BossCharge[MAXPLAYERS+1][8]; -new Float:Stabbed[MAXPLAYERS+1]; -new Float:Marketed[MAXPLAYERS+1]; -new Float:KSpreeTimer[MAXPLAYERS+1]; -new KSpreeCount[MAXPLAYERS+1]; -new Float:GlowTimer[MAXPLAYERS+1]; -new shortname[MAXPLAYERS+1]; -new bool:emitRageSound[MAXPLAYERS+1]; -new bool:bossHasReloadAbility[MAXPLAYERS+1]; -new bool:bossHasRightMouseAbility[MAXPLAYERS+1]; - -new timeleft; - -new Handle:cvarVersion; -new Handle:cvarPointDelay; -new Handle:cvarAnnounce; -new Handle:cvarEnabled; -new Handle:cvarAliveToEnable; -new Handle:cvarPointType; -new Handle:cvarCrits; -new Handle:cvarArenaRounds; -new Handle:cvarCircuitStun; -new Handle:cvarSpecForceBoss; -new Handle:cvarCountdownPlayers; -new Handle:cvarCountdownTime; -new Handle:cvarCountdownHealth; -new Handle:cvarCountdownResult; -new Handle:cvarEnableEurekaEffect; -new Handle:cvarForceBossTeam; -new Handle:cvarHealthBar; -new Handle:cvarLastPlayerGlow; -new Handle:cvarBossTeleporter; -new Handle:cvarBossSuicide; -new Handle:cvarShieldCrits; -new Handle:cvarCaberDetonations; -new Handle:cvarUpdater; -new Handle:cvarDebug; -new Handle:cvarPreroundBossDisconnect; - -new Handle:bossesArray; -new Handle:bossesArrayShadow; // FIXME: ULTRA HACKY HACK -new Handle:voicesArray; // TODO: Rename this or remove it in favor of something else -new Handle:subpluginArray; -new Handle:chancesArray; - -new Handle:FF2Cookie_QueuePoints; -new Handle:FF2Cookie_MuteSound; -new Handle:FF2Cookie_DisplayInfo; - -new Handle:changelogMenu; - -new Handle:jumpHUD; -new Handle:rageHUD; -new Handle:livesHUD; -new Handle:timeleftHUD; -new Handle:abilitiesHUD; -new Handle:infoHUD; - -new bool:Enabled=true; -new bool:Enabled2=true; -new PointDelay=6; -new Float:Announce=120.0; -new AliveToEnable=5; -new PointType; -new bool:BossCrits=true; -new arenaRounds; -new Float:circuitStun; -new countdownPlayers=1; -new countdownTime=120; -new countdownHealth=2000; -new bool:SpecForceBoss; -new bool:lastPlayerGlow=true; -new bool:bossTeleportation=true; -new shieldCrits; -new allowedDetonations; - -new Handle:MusicTimer[MAXPLAYERS+1]; -new Handle:BossInfoTimer[MAXPLAYERS+1][2]; -new Handle:DrawGameTimer; -new Handle:doorCheckTimer; - -new botqueuepoints; -new Float:HPTime; -new String:currentmap[99]; -new bool:checkDoors; -new bool:bMedieval; -new bool:firstBlood; - -new tf_arena_use_queue; -new mp_teams_unbalance_limit; -new tf_arena_first_blood; -new mp_forcecamera; -new tf_dropped_weapon_lifetime; -new Float:tf_feign_death_activate_damage_scale; -new Float:tf_feign_death_damage_scale; -new String:mp_humans_must_join_team[16]; - -new Handle:cvarNextmap; - -new FF2CharSet; -new validCharsets[64]; -new String:FF2CharSetString[42]; -new bool:isCharSetSelected; - -new healthBar=-1; -new g_Monoculus=-1; - -static bool:executed; -static bool:executed2; - -new changeGamemode; - -//new Handle:kvWeaponSpecials; -new Handle:kvWeaponMods; +TFTeam OtherTeam=TFTeam_Red; +TFTeam BossTeam=TFTeam_Blue; +int playing; +int healthcheckused; +int RedAlivePlayers; +int BlueAlivePlayers; +int RoundCount; +int character[MAXPLAYERS+1]; +int Incoming[MAXPLAYERS+1]; + +int Damage[MAXPLAYERS+1]; +int uberTarget[MAXPLAYERS+1]; +int shield[MAXPLAYERS+1]; +int detonations[MAXPLAYERS+1]; +bool playBGM[MAXPLAYERS+1]=true; +int queuePoints[MAXPLAYERS+1]; +int muteSound[MAXPLAYERS+1]; +bool displayInfo[MAXPLAYERS+1]; + +char currentBGM[MAXPLAYERS+1][PLATFORM_MAX_PATH]; + +int FF2Flags[MAXPLAYERS+1]; + +int Boss[MAXPLAYERS+1]; +int BossHealthMax[MAXPLAYERS+1]; +int BossHealth[MAXPLAYERS+1]; +int BossHealthLast[MAXPLAYERS+1]; +int BossLives[MAXPLAYERS+1]; +int BossLivesMax[MAXPLAYERS+1]; +int BossRageDamage[MAXPLAYERS+1]; +float BossSpeed[MAXPLAYERS+1]; +float BossCharge[MAXPLAYERS+1][8]; +float Stabbed[MAXPLAYERS+1]; +float Marketed[MAXPLAYERS+1]; +float KSpreeTimer[MAXPLAYERS+1]; +int KSpreeCount[MAXPLAYERS+1]; +float GlowTimer[MAXPLAYERS+1]; +int shortname[MAXPLAYERS+1]; +bool emitRageSound[MAXPLAYERS+1]; +bool bossHasReloadAbility[MAXPLAYERS+1]; +bool bossHasRightMouseAbility[MAXPLAYERS+1]; + +int timeleft; + +Handle cvarVersion; +Handle cvarPointDelay; +Handle cvarAnnounce; +Handle cvarEnabled; +Handle cvarAliveToEnable; +Handle cvarPointType; +Handle cvarCrits; +Handle cvarArenaRounds; +Handle cvarCircuitStun; +Handle cvarSpecForceBoss; +Handle cvarCountdownPlayers; +Handle cvarCountdownTime; +Handle cvarCountdownHealth; +Handle cvarCountdownResult; +Handle cvarEnableEurekaEffect; +Handle cvarForceBossTeam; +Handle cvarHealthBar; +Handle cvarLastPlayerGlow; +Handle cvarBossTeleporter; +Handle cvarBossSuicide; +Handle cvarShieldCrits; +Handle cvarCaberDetonations; +Handle cvarUpdater; +Handle cvarDebug; +Handle cvarPreroundBossDisconnect; + +Handle bossesArray; +Handle bossesArrayShadow; // FIXME: ULTRA HACKY HACK +Handle voicesArray; // TODO: Rename this or remove it in favor of something else +Handle subpluginArray; +Handle chancesArray; + +Handle FF2Cookie_QueuePoints; +Handle FF2Cookie_MuteSound; +Handle FF2Cookie_DisplayInfo; + +Handle changelogMenu; + +Handle jumpHUD; +Handle rageHUD; +Handle livesHUD; +Handle timeleftHUD; +Handle abilitiesHUD; +Handle infoHUD; + +bool Enabled=true; +bool Enabled2=true; +int PointDelay=6; +float Announce=120.0; +int AliveToEnable=5; +int PointType; +bool BossCrits=true; +int arenaRounds; +float circuitStun; +int countdownPlayers=1; +int countdownTime=120; +int countdownHealth=2000; +bool SpecForceBoss; +bool lastPlayerGlow=true; +bool bossTeleportation=true; +int shieldCrits; +int allowedDetonations; + +Handle MusicTimer[MAXPLAYERS+1]; +Handle BossInfoTimer[MAXPLAYERS+1][2]; +Handle DrawGameTimer; +Handle doorCheckTimer; + +int botqueuepoints; +float HPTime; +char currentmap[99]; +bool checkDoors; +bool bMedieval; +bool firstBlood; + +int tf_arena_use_queue; +int mp_teams_unbalance_limit; +int tf_arena_first_blood; +int mp_forcecamera; +int tf_dropped_weapon_lifetime; +float tf_feign_death_activate_damage_scale; +float tf_feign_death_damage_scale; +char mp_humans_must_join_team[16]; + +Handle cvarNextmap; + +int FF2CharSet; +int validCharsets[64]; +char FF2CharSetString[42]; +bool isCharSetSelected; + +int healthBar=-1; +int g_Monoculus=-1; + +static bool executed; +static bool executed2; + +int changeGamemode; + +//Handle kvWeaponSpecials; +Handle kvWeaponMods; enum FF2RoundState { @@ -233,7 +235,7 @@ enum FF2WeaponModType FF2WeaponMod_OnTakeDamage, } -/*new String:WeaponSpecials[][]= +/*char WeaponSpecials[][]= { "drop health pack on kill", "glow on scoped hit", @@ -252,18 +254,18 @@ enum Operators Operator_Exponent, }; -new Handle:PreAbility; -new Handle:OnAbility; -new Handle:OnMusic; -new Handle:OnTriggerHurt; -new Handle:OnBossSelected; -new Handle:OnAddQueuePoints; -new Handle:OnLoadCharacterSet; -new Handle:OnLoseLife; -new Handle:OnAlivePlayersChanged; -new Handle:OnParseUnknownVariable; +Handle PreAbility; +Handle OnAbility; +Handle OnMusic; +Handle OnTriggerHurt; +Handle OnBossSelected; +Handle OnAddQueuePoints; +Handle OnLoadCharacterSet; +Handle OnLoseLife; +Handle OnAlivePlayersChanged; +Handle OnParseUnknownVariable; -public Plugin:myinfo= +public Plugin myinfo= { name="Freak Fortress 2", author="Rainbolt Dash, FlaminSarge, Powerlord, the 50DKP team", @@ -271,9 +273,9 @@ public Plugin:myinfo= version=PLUGIN_VERSION, }; -public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max) +public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) { - decl String:plugin[PLATFORM_MAX_PATH]; + char plugin[PLATFORM_MAX_PATH]; GetPluginFilename(myself, plugin, sizeof(plugin)); if(!StrContains(plugin, "freak_fortress_2/")) //Prevent plugins/freak_fortress_2/freak_fortress_2.smx from loading if it exists -.- { @@ -346,7 +348,7 @@ public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max) return APLRes_Success; } -public OnPluginStart() +public void OnPluginStart() { LogMessage("===Freak Fortress 2 Initializing-v%s===", PLUGIN_VERSION); @@ -459,7 +461,7 @@ public OnPluginStart() bossesArrayShadow=CreateArray(); voicesArray=CreateArray(); - decl String:oldVersion[64]; + char oldVersion[64]; GetConVarString(cvarVersion, oldVersion, sizeof(oldVersion)); if(!StrEqual(oldVersion, PLUGIN_VERSION, false)) { @@ -481,10 +483,10 @@ public OnPluginStart() #endif } -public bool:BossTargetFilter(const String:pattern[], Handle:clients) +public bool BossTargetFilter(const char[] pattern, Handle clients) { - new bool:non=StrContains(pattern, "!", false)!=-1; - for(new client=1; client<=MaxClients; client++) + bool non=StrContains(pattern, "!", false)!=-1; + for(int client=1; client<=MaxClients; client++) { if(IsValidClient(client) && FindValueInArray(clients, client)==-1) { @@ -504,7 +506,7 @@ public bool:BossTargetFilter(const String:pattern[], Handle:clients) return true; } -public OnLibraryAdded(const String:name[]) +public void OnLibraryAdded(const char[] name) { #if defined _steamtools_included if(StrEqual(name, "SteamTools", false)) @@ -521,7 +523,7 @@ public OnLibraryAdded(const String:name[]) #endif } -public OnLibraryRemoved(const String:name[]) +public void OnLibraryRemoved(const char[] name) { #if defined _steamtools_included if(StrEqual(name, "SteamTools", false)) @@ -538,13 +540,13 @@ public OnLibraryRemoved(const String:name[]) #endif } -public OnConfigsExecuted() +public void OnConfigsExecuted() { tf_arena_use_queue=GetConVarInt(FindConVar("tf_arena_use_queue")); mp_teams_unbalance_limit=GetConVarInt(FindConVar("mp_teams_unbalance_limit")); tf_arena_first_blood=GetConVarInt(FindConVar("tf_arena_first_blood")); mp_forcecamera=GetConVarInt(FindConVar("mp_forcecamera")); - tf_dropped_weapon_lifetime=bool:GetConVarInt(FindConVar("tf_dropped_weapon_lifetime")); + tf_dropped_weapon_lifetime=view_as(GetConVarInt(FindConVar("tf_dropped_weapon_lifetime"))); tf_feign_death_activate_damage_scale=GetConVarFloat(FindConVar("tf_feign_death_activate_damage_scale")); tf_feign_death_damage_scale=GetConVarFloat(FindConVar("tf_feign_death_damage_scale")); GetConVarString(FindConVar("mp_humans_must_join_team"), mp_humans_must_join_team, sizeof(mp_humans_must_join_team)); @@ -566,12 +568,12 @@ public OnConfigsExecuted() #endif } -public OnMapStart() +public void OnMapStart() { HPTime=0.0; doorCheckTimer=INVALID_HANDLE; RoundCount=0; - for(new client; client<=MaxClients; client++) + for(int client; client<=MaxClients; client++) { KSpreeTimer[client]=0.0; FF2Flags[client]=0; @@ -579,7 +581,7 @@ public OnMapStart() MusicTimer[client]=INVALID_HANDLE; } - for(new index; index1.0) { CreateTimer(time, Timer_Announce, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); @@ -669,7 +671,7 @@ public EnableFF2() FindCharacters(); strcopy(FF2CharSetString, 2, ""); - bMedieval=FindEntityByClassname(-1, "tf_logic_medieval")!=-1 || bool:GetConVarInt(FindConVar("tf_medieval")); + bMedieval=FindEntityByClassname(-1, "tf_logic_medieval")!=-1 || view_as(GetConVarInt(FindConVar("tf_medieval"))); FindHealthBar(); #if defined _steamtools_included @@ -684,7 +686,7 @@ public EnableFF2() changeGamemode=0; } -public DisableFF2() +public void DisableFF2() { Enabled=false; Enabled2=false; @@ -704,7 +706,7 @@ public DisableFF2() doorCheckTimer=INVALID_HANDLE; } - for(new client=1; client<=MaxClients; client++) + for(int client=1; client<=MaxClients; client++) { if(IsValidClient(client)) { @@ -735,11 +737,11 @@ public DisableFF2() changeGamemode=0; } -public FindCharacters() +public void FindCharacters() { chancesArray=CreateArray(); - decl String:config[PLATFORM_MAX_PATH], String:charset[42]; + char config[PLATFORM_MAX_PATH], charset[42]; BuildPath(Path_SM, config, sizeof(config), "%s/%s", FF2_SETTINGS, BOSS_CONFIG); if(!FileExists(config)) @@ -749,10 +751,10 @@ public FindCharacters() return; } - new Handle:kv=CreateKeyValues(""); + Handle kv=CreateKeyValues(""); FileToKeyValues(kv, config); - new Action:action; + Action action; Call_StartForward(OnLoadCharacterSet); strcopy(charset, sizeof(charset), FF2CharSetString); Call_PushStringEx(charset, sizeof(charset), SM_PARAM_STRING_UTF8 | SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); @@ -761,7 +763,7 @@ public FindCharacters() { if(strlen(charset)) { - new i; + int i; KvRewind(kv); while(KvGotoNextKey(kv)) @@ -783,7 +785,7 @@ public FindCharacters() if(KvGotoFirstSubKey(kv, false)) { - new index; + int index; do { KvGetSectionName(kv, config, sizeof(config)); @@ -794,7 +796,7 @@ public FindCharacters() LogError("[FF2 Bosses] Character %s has an invalid chance - assuming 0", config); } - for(new j; j(StringToInt(newValue)); } else if(convar==cvarArenaRounds) { @@ -1115,15 +1117,15 @@ public CvarChange(Handle:convar, const String:oldValue[], const String:newValue[ } else if(convar==cvarLastPlayerGlow) { - lastPlayerGlow=bool:StringToInt(newValue); + lastPlayerGlow=view_as(StringToInt(newValue)); } else if(convar==cvarSpecForceBoss) { - SpecForceBoss=bool:StringToInt(newValue); + SpecForceBoss=view_as(StringToInt(newValue)); } else if(convar==cvarBossTeleporter) { - bossTeleportation=bool:StringToInt(newValue); + bossTeleportation=view_as(StringToInt(newValue)); } else if(convar==cvarShieldCrits) { @@ -1146,13 +1148,13 @@ public CvarChange(Handle:convar, const String:oldValue[], const String:newValue[ } #if defined _smac_included -public Action:SMAC_OnCheatDetected(client, const String:module[], DetectionType:type, Handle:info) +public Action SMAC_OnCheatDetected(int client, const char[] module, DetectionType type, Handle info) { Debug("SMAC: Cheat detected!"); if(type==Detection_CvarViolation) { Debug("SMAC: Cheat was a cvar violation!"); - decl String:cvar[PLATFORM_MAX_PATH]; + char cvar[PLATFORM_MAX_PATH]; KvGetString(info, "cvar", cvar, sizeof(cvar)); Debug("Cvar was %s", cvar); if((StrEqual(cvar, "sv_cheats") || StrEqual(cvar, "host_timescale")) && !(FF2Flags[Boss[client]] & FF2FLAG_CHANGECVAR)) @@ -1165,9 +1167,9 @@ public Action:SMAC_OnCheatDetected(client, const String:module[], DetectionType: } #endif -public Action:Timer_Announce(Handle:timer) +public Action Timer_Announce(Handle timer) { - static announcecount=-1; + static int announcecount=-1; announcecount++; if(Announce>1.0 && Enabled2) { @@ -1199,9 +1201,9 @@ public Action:Timer_Announce(Handle:timer) return Plugin_Continue; } -stock bool:IsFF2Map() +stock bool IsFF2Map() { - decl String:config[PLATFORM_MAX_PATH]; + char config[PLATFORM_MAX_PATH]; GetCurrentMap(currentmap, sizeof(currentmap)); if(FileExists("bNextMapToFF2")) { @@ -1215,14 +1217,14 @@ stock bool:IsFF2Map() return false; } - new Handle:file=OpenFile(config, "r"); + Handle file=OpenFile(config, "r"); if(file==INVALID_HANDLE) { LogError("[FF2] Error reading maps from %s, disabling plugin.", config); return false; } - new tries; + int tries; while(ReadFileLine(file, config, sizeof(config)) && tries<100) { tries++; @@ -1248,10 +1250,10 @@ stock bool:IsFF2Map() return false; } -stock bool:MapHasMusic(bool:forceRecalc=false) //SAAAAAARGE +stock bool MapHasMusic(bool forceRecalc=false) //SAAAAAARGE { - static bool:hasMusic; - static bool:found; + static bool hasMusic; + static bool found; if(forceRecalc) { found=false; @@ -1260,8 +1262,8 @@ stock bool:MapHasMusic(bool:forceRecalc=false) //SAAAAAARGE if(!found) { - new entity=-1; - decl String:name[64]; + int entity=-1; + char name[64]; while((entity=FindEntityByClassname2(entity, "info_target"))!=-1) { GetEntPropString(entity, Prop_Data, "m_iName", name, sizeof(name)); @@ -1275,14 +1277,14 @@ stock bool:MapHasMusic(bool:forceRecalc=false) //SAAAAAARGE return hasMusic; } -stock bool:CheckToChangeMapDoors() +stock bool CheckToChangeMapDoors() { if(!Enabled || !Enabled2) { return; } - decl String:config[PLATFORM_MAX_PATH]; + char config[PLATFORM_MAX_PATH]; checkDoors=false; BuildPath(Path_SM, config, sizeof(config), "%s/%s", FF2_SETTINGS, DOORS_CONFIG); if(!FileExists(config)) @@ -1294,7 +1296,7 @@ stock bool:CheckToChangeMapDoors() return; } - new Handle:file=OpenFile(config, "r"); + Handle file=OpenFile(config, "r"); if(file==INVALID_HANDLE) { if(!strncmp(currentmap, "vsh_lolcano_pb1", 15, false)) @@ -1322,7 +1324,7 @@ stock bool:CheckToChangeMapDoors() CloseHandle(file); } -public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast) +public Action OnRoundStart(Handle event, const char[] name, bool dontBroadcast) { if(changeGamemode==1) { @@ -1355,12 +1357,12 @@ public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast DeleteFile("bNextMapToFF2"); } - new bool:blueBoss; + bool blueBoss; switch(GetConVarInt(cvarForceBossTeam)) { case 1: { - blueBoss=bool:GetRandomInt(0, 1); + blueBoss=view_as(GetRandomInt(0, 1)); } case 2: { @@ -1374,21 +1376,21 @@ public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast if(blueBoss) { - SetTeamScore(_:TFTeam_Red, GetTeamScore(_:OtherTeam)); - SetTeamScore(_:TFTeam_Blue, GetTeamScore(_:BossTeam)); + SetTeamScore(view_as(TFTeam_Red), GetTeamScore(view_as(OtherTeam))); + SetTeamScore(view_as(TFTeam_Blue), GetTeamScore(view_as(BossTeam))); OtherTeam=TFTeam_Red; BossTeam=TFTeam_Blue; } else { - SetTeamScore(_:TFTeam_Red, GetTeamScore(_:BossTeam)); - SetTeamScore(_:TFTeam_Blue, GetTeamScore(_:OtherTeam)); + SetTeamScore(view_as(TFTeam_Red), GetTeamScore(view_as(BossTeam))); + SetTeamScore(view_as(TFTeam_Blue), GetTeamScore(view_as(OtherTeam))); OtherTeam=TFTeam_Blue; BossTeam=TFTeam_Red; } playing=0; - for(new client=1; client<=MaxClients; client++) + for(int client=1; client<=MaxClients; client++) { Damage[client]=0; uberTarget[client]=-1; @@ -1414,9 +1416,9 @@ public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast //DisableSubPlugins(); SetArenaCapEnableTime(60.0); CreateTimer(71.0, Timer_EnableCap, _, TIMER_FLAG_NO_MAPCHANGE); - new bool:toRed; - new TFTeam:team; - for(new client; client<=MaxClients; client++) + bool toRed; + TFTeam team; + for(int client; client<=MaxClients; client++) { if(IsValidClient(client) && (team=TF2_GetClientTeam(client))>TFTeam_Spectator) { @@ -1437,7 +1439,7 @@ public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast return Plugin_Continue; } - for(new client; client<=MaxClients; client++) + for(int client; client<=MaxClients; client++) { Boss[client]=0; if(IsValidClient(client) && IsPlayerAlive(client) && !(FF2Flags[client] & FF2FLAG_HASONGIVED)) @@ -1450,16 +1452,16 @@ public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast //EnableSubPlugins(); CheckArena(); - new bool:omit[MaxClients+1]; + bool[] omit=new bool[MaxClients+1]; Boss[0]=GetClientWithMostQueuePoints(omit); omit[Boss[0]]=true; - new bool:teamHasPlayers[TFTeam]; - for(new client=1; client<=MaxClients; client++) //Find out if each team has at least one player on it + bool teamHasPlayers[TFTeam]; + for(int client=1; client<=MaxClients; client++) //Find out if each team has at least one player on it { if(IsValidClient(client)) { - new TFTeam:team=TF2_GetClientTeam(client); + TFTeam team=TF2_GetClientTeam(client); if(team>TFTeam_Spectator) { teamHasPlayers[team]=true; @@ -1479,7 +1481,7 @@ public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast AssignTeam(Boss[0], BossTeam); } - for(new client=1; client<=MaxClients; client++) + for(int client=1; client<=MaxClients; client++) { if(IsValidClient(client) && !IsBoss(client) && TF2_GetClientTeam(client)!=OtherTeam) { @@ -1498,7 +1500,7 @@ public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast FindCompanion(0, playing, omit); //Find companions for the boss! - for(new boss; boss<=MaxClients; boss++) + for(int boss; boss<=MaxClients; boss++) { BossInfoTimer[boss][0]=INVALID_HANDLE; BossInfoTimer[boss][1]=INVALID_HANDLE; @@ -1513,14 +1515,14 @@ public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast CreateTimer(9.1, StartBossTimer, _, TIMER_FLAG_NO_MAPCHANGE); CreateTimer(9.6, MessageTimer, _, TIMER_FLAG_NO_MAPCHANGE); - for(new entity=MaxClients+1; entity(GetEventInt(event, "team"))==BossTeam)) { bossWin=true; if(FindSound("win", sound, sizeof(sound))) @@ -1662,8 +1664,8 @@ public Action:OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast) StopMusic(); DrawGameTimer=INVALID_HANDLE; - new bool:isBossAlive; - for(new boss; boss<=MaxClients; boss++) + bool isBossAlive; + for(int boss; boss<=MaxClients; boss++) { if(IsValidClient(Boss[boss])) { @@ -1674,7 +1676,7 @@ public Action:OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast) isBossAlive=true; } - for(new slot=1; slot<8; slot++) + for(int slot=1; slot<8; slot++) { BossCharge[boss][slot]=0.0; } @@ -1689,7 +1691,7 @@ public Action:OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast) detonations[boss]=0; } - for(new timer; timer<=1; timer++) + for(int timer; timer<=1; timer++) { if(BossInfoTimer[boss][timer]!=INVALID_HANDLE) { @@ -1699,12 +1701,12 @@ public Action:OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast) } } - new boss; + int boss; if(isBossAlive) { - new String:text[128]; //Do not decl this - decl String:bossName[64], String:lives[8]; - for(new target; target<=MaxClients; target++) + char text[128]; //Do not decl this + char bossName[64], lives[8]; + for(int target; target<=MaxClients; target++) { if(IsBoss(target)) { @@ -1718,7 +1720,7 @@ public Action:OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast) } SetHudTextParams(-1.0, 0.2, 10.0, 255, 255, 255, 255); - for(new client; client<=MaxClients; client++) + for(int client; client<=MaxClients; client++) { if(IsValidClient(client)) { @@ -1733,9 +1735,9 @@ public Action:OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast) } } - new top[3]; + int top[3]; Damage[0]=0; - for(new client=1; client<=MaxClients; client++) + for(int client=1; client<=MaxClients; client++) { if(!IsValidClient(client) || Damage[client]<=0 || IsBoss(client)) { @@ -1764,8 +1766,8 @@ public Action:OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast) CreateTimer(1.0, Timer_NineThousand, _, TIMER_FLAG_NO_MAPCHANGE); } - decl String:leaders[3][32]; - for(new i; i<=2; i++) + char leaders[3][32]; + for(int i; i<=2; i++) { if(IsValidClient(top[i])) { @@ -1781,8 +1783,8 @@ public Action:OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast) SetHudTextParams(-1.0, 0.3, 10.0, 255, 255, 255, 255); PrintCenterTextAll(""); - new String:text[128]; //Do not decl this - for(new client; client<=MaxClients; client++) + char text[128]; //Do not decl this + for(int client; client<=MaxClients; client++) { if(IsValidClient(client)) { @@ -1804,9 +1806,9 @@ public Action:OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast) return Plugin_Continue; } -public Action:OnBroadcast(Handle:event, const String:name[], bool:dontBroadcast) +public Action OnBroadcast(Handle event, const char[] name, bool dontBroadcast) { - decl String:sound[PLATFORM_MAX_PATH]; + char sound[PLATFORM_MAX_PATH]; GetEventString(event, "sound", sound, sizeof(sound)); if(!StrContains(sound, "Game.Your", false) || StrEqual(sound, "Game.Stalemate", false)) { @@ -1815,28 +1817,28 @@ public Action:OnBroadcast(Handle:event, const String:name[], bool:dontBroadcast) return Plugin_Continue; } -public Action:Timer_NineThousand(Handle:timer) +public Action Timer_NineThousand(Handle timer) { EmitSoundToAllExcept(FF2SOUND_MUTEVOICE, "saxton_hale/9000.wav", _, SNDCHAN_VOICE, _, _, _, _, _, _, _, false); EmitSoundToAllExcept(FF2SOUND_MUTEVOICE, "saxton_hale/9000.wav", _, SNDCHAN_VOICE, _, _, _, _, _, _, _, false); return Plugin_Continue; } -public Action:Timer_CalcQueuePoints(Handle:timer) +public Action Timer_CalcQueuePoints(Handle timer) { - new damage; + int damage; botqueuepoints+=5; - new add_points[MaxClients+1]; - new add_points2[MaxClients+1]; - for(new client=1; client<=MaxClients; client++) + int[] add_points=new int[MaxClients+1]; + int[] add_points2=new int[MaxClients+1]; + for(int client=1; client<=MaxClients; client++) { if(IsValidClient(client)) { damage=Damage[client]; - new Handle:event=CreateEvent("player_escort_score", true); + Handle event=CreateEvent("player_escort_score", true); SetEventInt(event, "player", client); - new points; + int points; while(damage-600>0) { damage-=600; @@ -1865,7 +1867,7 @@ public Action:Timer_CalcQueuePoints(Handle:timer) } } - new Action:action; + Action action; Call_StartForward(OnAddQueuePoints); Call_PushArrayEx(add_points2, MaxClients+1, SM_PARAM_COPYBACK); Call_Finish(action); @@ -1877,7 +1879,7 @@ public Action:Timer_CalcQueuePoints(Handle:timer) } case Plugin_Changed: { - for(new client=1; client<=MaxClients; client++) + for(int client=1; client<=MaxClients; client++) { if(IsValidClient(client)) { @@ -1891,7 +1893,7 @@ public Action:Timer_CalcQueuePoints(Handle:timer) } default: { - for(new client=1; client<=MaxClients; client++) + for(int client=1; client<=MaxClients; client++) { if(IsValidClient(client)) { @@ -1906,9 +1908,9 @@ public Action:Timer_CalcQueuePoints(Handle:timer) } } -public Action:StartResponseTimer(Handle:timer) +public Action StartResponseTimer(Handle timer) { - decl String:sound[PLATFORM_MAX_PATH]; + char sound[PLATFORM_MAX_PATH]; if(FindSound("begin", sound, sizeof(sound))) { EmitSoundToAllExcept(FF2SOUND_MUTEVOICE, sound); @@ -1917,11 +1919,11 @@ public Action:StartResponseTimer(Handle:timer) return Plugin_Continue; } -public Action:StartBossTimer(Handle:timer) +public Action StartBossTimer(Handle timer) { CreateTimer(0.1, Timer_Move, _, TIMER_FLAG_NO_MAPCHANGE); - new bool:isBossAlive; - for(new boss; boss<=MaxClients; boss++) + bool isBossAlive; + for(int boss; boss<=MaxClients; boss++) { if(IsValidClient(Boss[boss]) && IsPlayerAlive(Boss[boss])) { @@ -1936,7 +1938,7 @@ public Action:StartBossTimer(Handle:timer) } playing=0; - for(new client=1; client<=MaxClients; client++) + for(int client=1; client<=MaxClients; client++) { if(IsValidClient(client) && !IsBoss(client) && IsPlayerAlive(client)) { @@ -1958,9 +1960,9 @@ public Action:StartBossTimer(Handle:timer) return Plugin_Continue; } -public Action:Timer_PrepareBGM(Handle:timer, any:userid) +public Action Timer_PrepareBGM(Handle timer, int userid) { - new client=GetClientOfUserId(userid); + int client=GetClientOfUserId(userid); if(CheckRoundState()!=FF2RoundState_RoundRunning || (!client && MapHasMusic()) || (!client && userid)) { return Plugin_Stop; @@ -2007,25 +2009,25 @@ public Action:Timer_PrepareBGM(Handle:timer, any:userid) return Plugin_Continue; } -PlayBGM(client) +void PlayBGM(int client) { - new Handle:kv=GetArrayCell(bossesArray, character[0]); + Handle kv=GetArrayCell(bossesArray, character[0]); KvRewind(kv); if(KvJumpToKey(kv, "sounds")) { - new Handle:musicArray=CreateArray(PLATFORM_MAX_PATH); - new Handle:timeArray=CreateArray(); - decl String:music[PLATFORM_MAX_PATH]; + Handle musicArray=CreateArray(PLATFORM_MAX_PATH); + Handle timeArray=CreateArray(); + char music[PLATFORM_MAX_PATH]; KvGotoFirstSubKey(kv); do { KvGetSectionName(kv, music, sizeof(music)); - new time=KvGetNum(kv, "time"); + int time=KvGetNum(kv, "time"); if(time>0) { if(FindStringInArray(musicArray, music)>=0) { - decl String:bossName[64]; + char bossName[64]; KvRewind(kv); KvGetString(kv, "name", bossName, sizeof(bossName)); PrintToServer("[FF2 Bosses] Character %s has a duplicate sound '%s'!", bossName, music); @@ -2036,7 +2038,7 @@ PlayBGM(client) } else if(time<0) { - decl String:bossName[64]; + char bossName[64]; KvRewind(kv); KvGetString(kv, "name", bossName, sizeof(bossName)); PrintToServer("[FF2 Bosses] Character %s has an invalid time for sound '%s'!", bossName, music); @@ -2048,13 +2050,13 @@ PlayBGM(client) { return; } - new index=GetRandomInt(0, GetArraySize(musicArray)-1); + int index=GetRandomInt(0, GetArraySize(musicArray)-1); - new Action:action; + Action action; Call_StartForward(OnMusic); - decl String:temp[PLATFORM_MAX_PATH]; - new String:buffer[PLATFORM_MAX_PATH]; - new time2=GetArrayCell(timeArray, index); + char temp[PLATFORM_MAX_PATH]; + char buffer[PLATFORM_MAX_PATH]; + int time2=GetArrayCell(timeArray, index); GetArrayString(musicArray, index, temp, sizeof(temp)); Call_PushCell(client); Call_PushStringEx(temp, sizeof(temp), SM_PARAM_STRING_UTF8 | SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); @@ -2086,7 +2088,7 @@ PlayBGM(client) } else { - decl String:bossName[64]; + char bossName[64]; KvRewind(kv); KvGetString(kv, "name", bossName, sizeof(bossName)); PrintToServer("[FF2 Bosses] Character %s is missing BGM file '%s'!", bossName, music); @@ -2094,12 +2096,12 @@ PlayBGM(client) } } -StartMusic(client=0) +void StartMusic(int client=0) { if(client<=0) //Start music for all clients { StopMusic(); - for(new target; target<=MaxClients; target++) + for(int target; target<=MaxClients; target++) { playBGM[target]=true; //This includes the 0th index } @@ -2113,7 +2115,7 @@ StartMusic(client=0) } } -StopMusic(client=0, bool:permanent=false) +void StopMusic(int client=0, bool permanent=false) { if(client<=0) //Stop music for all clients { @@ -2161,10 +2163,11 @@ StopMusic(client=0, bool:permanent=false) } } -stock EmitSoundToAllExcept(soundFlags, const String:sample[], entity=SOUND_FROM_PLAYER, channel=SNDCHAN_AUTO, level=SNDLEVEL_NORMAL, flags=SND_NOFLAGS, Float:volume=SNDVOL_NORMAL, pitch=SNDPITCH_NORMAL, speakerentity=-1, const Float:origin[3]=NULL_VECTOR, const Float:dir[3]=NULL_VECTOR, bool:updatePos=true, Float:soundtime=0.0) +stock void EmitSoundToAllExcept(int soundFlags, const char[] sample, int entity=SOUND_FROM_PLAYER, int channel=SNDCHAN_AUTO, int level=SNDLEVEL_NORMAL, int flags=SND_NOFLAGS, float volume=SNDVOL_NORMAL, int pitch=SNDPITCH_NORMAL, int speakerentity=-1, const float origin[3]=NULL_VECTOR, const float dir[3]=NULL_VECTOR, bool updatePos=true, float soundtime=0.0) { - new clients[MaxClients+1], total; - for(new client=1; client<=MaxClients; client++) + int[] clients=new int[MaxClients+1]; + int total; + for(int client=1; client<=MaxClients; client++) { if(IsValidClient(client) && IsClientInGame(client)) { @@ -2183,7 +2186,7 @@ stock EmitSoundToAllExcept(soundFlags, const String:sample[], entity=SOUND_FROM_ EmitSound(clients, total, sample, entity, channel, level, flags, volume, pitch, speakerentity, origin, dir, updatePos, soundtime); } -public bool:CheckSoundFlags(client, soundFlags) +public bool CheckSoundFlags(int client, int soundFlags) { if(!IsValidClient(client)) { @@ -2202,37 +2205,37 @@ public bool:CheckSoundFlags(client, soundFlags) return true; } -public SetSoundFlags(client, soundFlags) +public void SetSoundFlags(int client, int soundFlags) { if(!IsValidClient(client) || IsFakeClient(client)) { return; } - decl String:buffer[5]; + char buffer[5]; GetClientCookie(client, FF2Cookie_MuteSound, buffer, sizeof(buffer)); IntToString((StringToInt(buffer) | soundFlags), buffer, sizeof(buffer)); SetClientCookie(client, FF2Cookie_MuteSound, buffer); muteSound[client] |= soundFlags; } -public ClearSoundFlags(client, soundFlags) +public void ClearSoundFlags(int client, int soundFlags) { if(!IsValidClient(client) || IsFakeClient(client)) { return; } - decl String:buffer[5]; + char buffer[5]; GetClientCookie(client, FF2Cookie_MuteSound, buffer, sizeof(buffer)); IntToString((StringToInt(buffer) & ~soundFlags), buffer, sizeof(buffer)); SetClientCookie(client, FF2Cookie_MuteSound, buffer); muteSound[client]&=~soundFlags; } -public Action:Timer_Move(Handle:timer) +public Action Timer_Move(Handle timer) { - for(new client=1; client<=MaxClients; client++) + for(int client=1; client<=MaxClients; client++) { if(IsValidClient(client) && IsPlayerAlive(client)) { @@ -2241,20 +2244,20 @@ public Action:Timer_Move(Handle:timer) } } -public Action:StartRound(Handle:timer) +public Action StartRound(Handle timer) { CreateTimer(10.0, Timer_NextBossPanel, _, TIMER_FLAG_NO_MAPCHANGE); UpdateHealthBar(); return Plugin_Handled; } -public Action:Timer_NextBossPanel(Handle:timer) +public Action Timer_NextBossPanel(Handle timer) { - new clients; - new bool:added[MaxClients+1]; + int clients; + bool[] added=new bool[MaxClients+1]; while(clients<3) //TODO: Make this configurable? { - new client=GetClientWithMostQueuePoints(added); + int client=GetClientWithMostQueuePoints(added); if(!IsValidClient(client)) //No more players left on the server { break; @@ -2269,7 +2272,7 @@ public Action:Timer_NextBossPanel(Handle:timer) } } -public Action:MessageTimer(Handle:timer) +public Action MessageTimer(Handle timer) { if(CheckRoundState()!=FF2RoundState_Setup) { @@ -2278,7 +2281,7 @@ public Action:MessageTimer(Handle:timer) if(checkDoors) { - new entity=-1; + int entity=-1; while((entity=FindEntityByClassname2(entity, "func_door"))!=-1) { AcceptEntityInput(entity, "Open"); @@ -2292,15 +2295,15 @@ public Action:MessageTimer(Handle:timer) } SetHudTextParams(-1.0, 0.2, 10.0, 255, 255, 255, 255); - new String:text[512]; //Do not decl this - decl String:textChat[512]; - decl String:lives[8]; - decl String:name[64]; - for(new client; client<=MaxClients; client++) + char text[512]; //Do not decl this + char textChat[512]; + char lives[8]; + char name[64]; + for(int client; client<=MaxClients; client++) { if(IsBoss(client)) { - new boss=Boss[client]; + int boss=Boss[client]; KvRewind(GetArrayCell(bossesArray, character[boss])); KvGetString(GetArrayCell(bossesArray, character[boss]), "name", name, sizeof(name), "=Failed name="); if(BossLives[boss]>1) @@ -2319,7 +2322,7 @@ public Action:MessageTimer(Handle:timer) } } - for(new client; client<=MaxClients; client++) + for(int client; client<=MaxClients; client++) { if(IsValidClient(client)) { @@ -2330,12 +2333,12 @@ public Action:MessageTimer(Handle:timer) return Plugin_Continue; } -public Action:MakeModelTimer(Handle:timer, any:boss) +public Action MakeModelTimer(Handle timer, int boss) { - new client=Boss[boss]; + int client=Boss[boss]; if(IsValidClient(client) && IsPlayerAlive(client) && CheckRoundState()!=FF2RoundState_RoundEnd) { - decl String:model[PLATFORM_MAX_PATH]; + char model[PLATFORM_MAX_PATH]; KvRewind(GetArrayCell(bossesArray, character[boss])); KvGetString(GetArrayCell(bossesArray, character[boss]), "model", model, sizeof(model)); SetVariantString(model); @@ -2346,14 +2349,14 @@ public Action:MakeModelTimer(Handle:timer, any:boss) return Plugin_Stop; } -EquipBoss(boss) +void EquipBoss(int boss) { - new client=Boss[boss]; + int client=Boss[boss]; DoOverlay(client, ""); TF2_RemoveAllWeapons(client); - decl String:classname[64], String:attributes[256], String:bossName[64]; + char classname[64], attributes[256], bossName[64]; - new Handle:kv=GetArrayCell(bossesArray, character[boss]); + Handle kv=GetArrayCell(bossesArray, character[boss]); KvRewind(kv); KvGetString(kv, "name", bossName, sizeof(bossName), "=Failed Name="); if(KvJumpToKey(kv, "weapons")) @@ -2361,9 +2364,9 @@ EquipBoss(boss) KvGotoFirstSubKey(kv); do { - decl String:sectionName[32]; + char sectionName[32]; KvGetSectionName(kv, sectionName, sizeof(sectionName)); - new index=StringToInt(sectionName); + int index=StringToInt(sectionName); //NOTE: StringToInt returns 0 on failure which corresponds to tf_weapon_bat, //so there's no way to distinguish between an invalid string and 0. //Blocked on bug 6438: https://bugs.alliedmods.net/show_bug.cgi?id=6438 @@ -2391,7 +2394,7 @@ EquipBoss(boss) //2: x3.1 damage } - new weapon=SpawnWeapon(client, classname, index, 101, 5, attributes); + int weapon=SpawnWeapon(client, classname, index, 101, 5, attributes); if(StrEqual(classname, "tf_weapon_builder", false) && index!=735) //PDA, normal sapper { SetEntProp(weapon, Prop_Send, "m_aBuildableObjectTypes", 1, _, 0); @@ -2424,16 +2427,16 @@ EquipBoss(boss) } KvRewind(kv); - new TFClassType:class=TFClassType:KvGetNum(kv, "class", 1); - if(TF2_GetPlayerClass(client)!=class) + TFClassType playerclass=view_as(KvGetNum(kv, "class", 1)); + if(TF2_GetPlayerClass(client)!=playerclass) { - TF2_SetPlayerClass(client, class, _, !GetEntProp(client, Prop_Send, "m_iDesiredPlayerClass") ? true : false); + TF2_SetPlayerClass(client, playerclass, _, !GetEntProp(client, Prop_Send, "m_iDesiredPlayerClass") ? true : false); } } -public Action:MakeBoss(Handle:timer, any:boss) +public Action MakeBoss(Handle timer, int boss) { - new client=Boss[boss]; + int client=Boss[boss]; if(!IsValidClient(client) || CheckRoundState()==FF2RoundState_Loading) { return Plugin_Continue; @@ -2451,7 +2454,7 @@ public Action:MakeBoss(Handle:timer, any:boss) } } - new Handle:kv=GetArrayCell(bossesArray, character[boss]); + Handle kv=GetArrayCell(bossesArray, character[boss]); KvRewind(kv); if(TF2_GetClientTeam(client)!=BossTeam) { @@ -2462,11 +2465,11 @@ public Action:MakeBoss(Handle:timer, any:boss) BossLivesMax[boss]=BossLives[boss]=ParseFormula(boss, "lives", 1); BossHealth[boss]=BossHealthLast[boss]=BossHealthMax[boss]*BossLivesMax[boss]; BossRageDamage[boss]=ParseFormula(boss, "rage damage", 1900); - BossSpeed[boss]=float(ParseFormula(boss, "speed", 340)); + BossSpeed[boss]=float((ParseFormula(boss, "speed", 340))); SetEntProp(client, Prop_Send, "m_bGlowEnabled", 0); TF2_RemovePlayerDisguise(client); - TF2_SetPlayerClass(client, TFClassType:KvGetNum(kv, "class", 1), _, !GetEntProp(client, Prop_Send, "m_iDesiredPlayerClass") ? true : false); + TF2_SetPlayerClass(client, view_as(KvGetNum(kv, "class", 1)), _, !GetEntProp(client, Prop_Send, "m_iDesiredPlayerClass") ? true : false); SDKHook(client, SDKHook_GetMaxHealth, OnGetMaxHealth); //Temporary: Used to prevent boss overheal switch(KvGetNum(kv, "pickups", 0)) //Check if the boss is allowed to pickup health/ammo @@ -2496,7 +2499,7 @@ public Action:MakeBoss(Handle:timer, any:boss) return Plugin_Continue; } - new entity=-1; + int entity=-1; while((entity=FindEntityByClassname2(entity, "tf_wear*"))!=-1) { if(IsBoss(GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity"))) @@ -2532,7 +2535,7 @@ public Action:MakeBoss(Handle:timer, any:boss) } /*Soon(TM) -CreateWeaponModsKeyValues() +void CreateWeaponModsKeyValues() { if(kvWeaponSpecials!=INVALID_HANDLE) { @@ -2540,7 +2543,7 @@ CreateWeaponModsKeyValues() } kvWeaponSpecials=CreateKeyValues("WeaponSpecials"); - for(new i=0; i-1) { flags|=OVERRIDE_ITEM_LEVEL; @@ -2612,7 +2615,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti level=1; } - new quality=KvGetNum(kvWeaponMods, "quality", -1); + int quality=KvGetNum(kvWeaponMods, "quality", -1); if(quality>-1) { flags|=OVERRIDE_ITEM_QUALITY; @@ -2627,7 +2630,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti TF2Items_SetQuality(weapon, quality); TF2Items_SetLevel(weapon, level); Debug("\t\tGave new weapon with classname %s, index %i, quality %i, and level %i", classname, index, quality, level); - new entity=TF2Items_GiveNamedItem(client, weapon); + int entity=TF2Items_GiveNamedItem(client, weapon); EquipPlayerWeapon(client, entity); CloseHandle(weapon); @@ -2639,9 +2642,9 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti if(KvJumpToKey(kvWeaponMods, "add")) { Debug("\tEntered add"); - decl String:attributes[32][8]; - new attribCount; - for(new key; KvGotoNextKey(kvWeaponMods); key+=2) + char attributes[32][8]; + int attribCount; + for(int key; KvGotoNextKey(kvWeaponMods); key+=2) { if(key>=32) { @@ -2657,10 +2660,10 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti if(attribCount) { - new entity=FindEntityByClassname(-1, classname); - for(new attribute; attributeremoveattribs: First attrib was %i", attributes[0]); - for(new key=2; KvGotoNextKey(kvWeaponMods, false); key++) + for(int key=2; KvGotoNextKey(kvWeaponMods, false); key++) { - decl String:temp[4]; + char temp[4]; IntToString(key, temp, sizeof(temp)); attributes[key]=KvGetNum(kvWeaponMods, temp); Debug("\t\tKeyvalues classname>removeattribs: Got attrib %i", attributes[key]); @@ -2740,8 +2743,8 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti if(attribCount>0) { - new i=0; - for(new attribute=0; attribute0) { - new i=0; - for(new attribute=0; attributeaddattribs: Added attrib set %s ; %s", attributes[attribute], attributes[attribute+1]); - new entity=FindEntityByClassname(-1, classname); + int entity=FindEntityByClassname(-1, classname); { //FIXME: THIS BRACKET TF2Attrib_SetByDefIndex(entity, StringToInt(attributes[attribute]), StringToFloat(attributes[attribute+1])); } @@ -2839,7 +2842,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti { case 38, 457: //Axtinguisher, Postal Pummeler { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "", false); + Handle itemOverride=PrepareItemHandle(item, _, _, "", false); if(itemOverride!=INVALID_HANDLE) { item=itemOverride; @@ -2848,7 +2851,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti } case 39, 351, 1081: //Flaregun, Detonator, Festive Flaregun { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "25 ; 0.5 ; 58 ; 3.2 ; 144 ; 1.0 ; 207 ; 1.33", false); + Handle itemOverride=PrepareItemHandle(item, _, _, "25 ; 0.5 ; 58 ; 3.2 ; 144 ; 1.0 ; 207 ; 1.33", false); //25: -50% ammo //58: 220% self damage force //144: NOPE @@ -2861,7 +2864,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti } case 40, 1146: //Backburner, Festive Backburner { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "165 ; 1.0"); + Handle itemOverride=PrepareItemHandle(item, _, _, "165 ; 1.0"); if(itemOverride!=INVALID_HANDLE) { item=itemOverride; @@ -2870,7 +2873,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti } case 224: //L'etranger { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "85 ; 0.5 ; 157 ; 1.0 ; 253 ; 1.0"); + Handle itemOverride=PrepareItemHandle(item, _, _, "85 ; 0.5 ; 157 ; 1.0 ; 253 ; 1.0"); //85: +50% time needed to regen cloak //157: +1 second needed to fully disguise //253: +1 second needed to fully cloak @@ -2882,7 +2885,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti } case 239, 1084, 1100: //GRU, Festive GRU, Bread Bite { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "1 ; 0.5 ; 107 ; 1.5 ; 128 ; 1 ; 191 ; -7 ; 772 ; 1.5", false); + Handle itemOverride=PrepareItemHandle(item, _, _, "1 ; 0.5 ; 107 ; 1.5 ; 128 ; 1 ; 191 ; -7 ; 772 ; 1.5", false); //1: -50% damage //107: +50% move speed //128: Only when weapon is active @@ -2896,7 +2899,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti } case 56, 1005, 1092: //Huntsman, Festive Huntsman, Fortified Compound { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "2 ; 1.5 ; 76 ; 2"); + Handle itemOverride=PrepareItemHandle(item, _, _, "2 ; 1.5 ; 76 ; 2"); //2: +50% damage //76: +100% ammo if(itemOverride!=INVALID_HANDLE) @@ -2907,7 +2910,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti } /*case 132, 266, 482: //Eyelander, HHHH, Nessie's Nine Iron - commented out because { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "202 ; 0.5 ; 125 ; -15", false); + Handle itemOverride=PrepareItemHandle(item, _, _, "202 ; 0.5 ; 125 ; -15", false); if(itemOverride!=INVALID_HANDLE) { item=itemOverride; @@ -2916,7 +2919,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti }*/ case 226: //Battalion's Backup { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "140 ; 10.0"); + Handle itemOverride=PrepareItemHandle(item, _, _, "140 ; 10.0"); if(itemOverride!=INVALID_HANDLE) { item=itemOverride; @@ -2925,7 +2928,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti } case 231: //Darwin's Danger Shield { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "26 ; 50"); //+50 health + Handle itemOverride=PrepareItemHandle(item, _, _, "26 ; 50"); //+50 health if(itemOverride!=INVALID_HANDLE) { item=itemOverride; @@ -2934,7 +2937,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti } case 305, 1079: //Crusader's Crossbow, Festive Crusader's Crossbow { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "2 ; 1.2 ; 17 ; 0.15"); + Handle itemOverride=PrepareItemHandle(item, _, _, "2 ; 1.2 ; 17 ; 0.15"); //2: +20% damage //17: +15% uber on hit if(itemOverride!=INVALID_HANDLE) @@ -2945,7 +2948,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti } case 331: //Fists of Steel { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "205 ; 0.8 ; 206 ; 2.0 ; 772 ; 2.0", false); + Handle itemOverride=PrepareItemHandle(item, _, _, "205 ; 0.8 ; 206 ; 2.0 ; 772 ; 2.0", false); //205: -80% damage from ranged while active //206: +100% damage from melee while active //772: Holsters 100% slower @@ -2957,7 +2960,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti } case 415: //Reserve Shooter { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "2 ; 1.1 ; 3 ; 0.5 ; 114 ; 1 ; 179 ; 1 ; 547 ; 0.6", false); + Handle itemOverride=PrepareItemHandle(item, _, _, "2 ; 1.1 ; 3 ; 0.5 ; 114 ; 1 ; 179 ; 1 ; 547 ; 0.6", false); //2: +10% damage bonus //3: -50% clip size //114: Mini-crits targets launched airborne by explosions, grapple hooks or enemy attacks @@ -2975,7 +2978,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti } case 648: //Wrap Assassin { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "279 ; 2.0"); + Handle itemOverride=PrepareItemHandle(item, _, _, "279 ; 2.0"); //279: 2 ornaments if(itemOverride!=INVALID_HANDLE) { @@ -2985,7 +2988,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti } case 656: //Holiday Punch { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "199 ; 0 ; 547 ; 0 ; 358 ; 0 ; 362 ; 0 ; 363 ; 0 ; 369 ; 0", false); + Handle itemOverride=PrepareItemHandle(item, _, _, "199 ; 0 ; 547 ; 0 ; 358 ; 0 ; 362 ; 0 ; 363 ; 0 ; 369 ; 0", false); //199: Holsters 100% faster //547: Deploys 100% faster //Other attributes: Because TF2Items doesn't feel like stripping the Holiday Punch's attributes for some reason @@ -2997,7 +3000,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti } case 772: //Baby Face's Blaster { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "2 ; 1.25 ; 109 ; 0.5 ; 125 ; -25 ; 394 ; 0.85 ; 418 ; 1 ; 419 ; 100 ; 532 ; 0.5 ; 651 ; 0.5 ; 709 ; 1", false); + Handle itemOverride=PrepareItemHandle(item, _, _, "2 ; 1.25 ; 109 ; 0.5 ; 125 ; -25 ; 394 ; 0.85 ; 418 ; 1 ; 419 ; 100 ; 532 ; 0.5 ; 651 ; 0.5 ; 709 ; 1", false); //2: +25% damage bonus //109: -50% health from packs on wearer //125: -25 max health @@ -3015,7 +3018,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti } case 1103: //Back Scatter { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "179 ; 1"); + Handle itemOverride=PrepareItemHandle(item, _, _, "179 ; 1"); //179: Crit instead of mini-critting if(itemOverride!=INVALID_HANDLE) { @@ -3027,7 +3030,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti if(TF2_GetPlayerClass(client)==TFClass_Soldier && (!StrContains(classname, "tf_weapon_rocketlauncher", false) || !StrContains(classname, "tf_weapon_shotgun", false))) { - new Handle:itemOverride; + Handle itemOverride; if(iItemDefinitionIndex==127) //Direct Hit { itemOverride=PrepareItemHandle(item, _, _, "114 ; 1 ; 179 ; 1.0"); @@ -3049,7 +3052,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti if(!StrContains(classname, "tf_weapon_syringegun_medic")) //Syringe guns { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "17 ; 0.05 ; 144 ; 1", false); + Handle itemOverride=PrepareItemHandle(item, _, _, "17 ; 0.05 ; 144 ; 1", false); //17: 5% uber on hit //144: Sets weapon mode - *possibly* the overdose speed effect if(itemOverride!=INVALID_HANDLE) @@ -3060,7 +3063,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti } else if(!StrContains(classname, "tf_weapon_medigun")) //Mediguns { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "10 ; 1.75 ; 11 ; 1.5 ; 144 ; 2.0 ; 199 ; 0.75 ; 314 ; 4 ; 547 ; 0.75", false); + Handle itemOverride=PrepareItemHandle(item, _, _, "10 ; 1.75 ; 11 ; 1.5 ; 144 ; 2.0 ; 199 ; 0.75 ; 314 ; 4 ; 547 ; 0.75", false); //10: +75% faster charge rate //11: +50% overheal bonus //144: Quick-fix speed/jump effects @@ -3076,15 +3079,15 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti return Plugin_Continue; } -public Action:Timer_NoHonorBound(Handle:timer, any:userid) +public Action Timer_NoHonorBound(Handle timer, int userid) { - new client=GetClientOfUserId(userid); + int client=GetClientOfUserId(userid); if(IsValidClient(client) && IsPlayerAlive(client)) { - new melee=GetPlayerWeaponSlot(client, TFWeaponSlot_Melee); - new index=((IsValidEntity(melee) && melee>MaxClients) ? GetEntProp(melee, Prop_Send, "m_iItemDefinitionIndex") : -1); - new weapon=GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon"); - new String:classname[64]; + int melee=GetPlayerWeaponSlot(client, TFWeaponSlot_Melee); + int index=((IsValidEntity(melee) && melee>MaxClients) ? GetEntProp(melee, Prop_Send, "m_iItemDefinitionIndex") : -1); + int weapon=GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon"); + char classname[64]; if(IsValidEntity(weapon)) { GetEntityClassname(weapon, classname, sizeof(classname)); @@ -3111,14 +3114,14 @@ public Action:Timer_NoHonorBound(Handle:timer, any:userid) * * @return Item handle on success, INVALID_HANDLE on failure */ -stock Handle:PrepareItemHandle(Handle:item, String:classname[]="", index=-1, const String:attributeList[]="", bool:preserve=true) +stock Handle PrepareItemHandle(Handle item, char[] classname="", int index=-1, const char[] attributeList="", bool preserve=true) { // TODO: This duplicates a whole lot of logic in SpawnWeapon - static Handle:weapon; - new addattribs; + static Handle weapon; + int addattribs; - new String:attributes[32][32]; - new count=ExplodeString(attributeList, ";", attributes, 32, 32); + char attributes[32][32]; + int count=ExplodeString(attributeList, ";", attributes, 32, 32); if(count==1) // ExplodeString returns the original string if no matching delimiter was found so we need to special-case this { @@ -3148,7 +3151,7 @@ stock Handle:PrepareItemHandle(Handle:item, String:classname[]="", index=-1, con return weapon; } - new flags=OVERRIDE_ATTRIBUTES; + int flags=OVERRIDE_ATTRIBUTES; if(preserve) { flags|=PRESERVE_ATTRIBUTES; @@ -3168,11 +3171,11 @@ stock Handle:PrepareItemHandle(Handle:item, String:classname[]="", index=-1, con addattribs=TF2Items_GetNumAttributes(item); if(addattribs>0) { - for(new i; i<2*addattribs; i+=2) + for(int i; i<2*addattribs; i+=2) { - new bool:dontAdd; - new attribIndex=TF2Items_GetAttributeId(item, i); - for(new z; z0) { TF2Items_SetNumAttributes(weapon, count/2); - new i2; - for(new i; i0.05) { TF2_AddCondition(client, TFCond_HalloweenCritCandy, 0.5); @@ -3556,7 +3559,7 @@ public Action:Timer_Uber(Handle:timer, any:medigunid) return Plugin_Continue; } -public Action:Command_GetHPCmd(client, args) +public Action Command_GetHPCmd(int client, int args) { if(!IsValidClient(client) || !Enabled || CheckRoundState()!=FF2RoundState_RoundRunning) { @@ -3567,17 +3570,17 @@ public Action:Command_GetHPCmd(client, args) return Plugin_Handled; } -public Action:Command_GetHP(client) //TODO: This can rarely show a very large negative number if you time it right +public Action Command_GetHP(int client) //TODO: This can rarely show a very large negative number if you time it right { if(IsBoss(client) || GetGameTime()>=HPTime) { - new String:text[512]; //Do not decl this - decl String:lives[8], String:name[64]; - for(new target; target<=MaxClients; target++) + char text[512]; //Do not decl this + char lives[8], name[64]; + for(int target; target<=MaxClients; target++) { if(IsBoss(target)) { - new boss=Boss[target]; + int boss=Boss[target]; KvRewind(GetArrayCell(bossesArray, character[boss])); KvGetString(GetArrayCell(bossesArray, character[boss]), "name", name, sizeof(name), "=Failed name="); if(BossLives[boss]>1) @@ -3594,7 +3597,7 @@ public Action:Command_GetHP(client) //TODO: This can rarely show a very large n } } - for(new target; target<=MaxClients; target++) + for(int target; target<=MaxClients; target++) { if(IsValidClient(target) && !(FF2Flags[target] & FF2FLAG_HUDDISABLED)) { @@ -3613,8 +3616,8 @@ public Action:Command_GetHP(client) //TODO: This can rarely show a very large n if(RedAlivePlayers>1) { - new String:waitTime[128]; - for(new target; target<=MaxClients; target++) + char waitTime[128]; + for(int target; target<=MaxClients; target++) { if(IsBoss(target)) { @@ -3626,9 +3629,9 @@ public Action:Command_GetHP(client) //TODO: This can rarely show a very large n return Plugin_Continue; } -public Action:Command_SetNextBoss(client, args) +public Action Command_SetNextBoss(int client, int args) { - decl String:name[64], String:boss[64]; + char name[64], boss[64]; if(args<1) { @@ -3637,9 +3640,9 @@ public Action:Command_SetNextBoss(client, args) } GetCmdArgString(name, sizeof(name)); - for(new config; config1) { - for(new target; target1) { - for(new target; target1) { - for(new target; target=0) @@ -3834,16 +3837,16 @@ public Action:Command_Charset(client, args) return Plugin_Handled; } -public Action:Command_ReloadSubPlugins(client, args) +public Action Command_ReloadSubPlugins(int client, int args) { if(Enabled) { //DisableSubPlugins(true); //EnableSubPlugins(true); - decl String:path[PLATFORM_MAX_PATH], String:filename[PLATFORM_MAX_PATH]; + char path[PLATFORM_MAX_PATH], filename[PLATFORM_MAX_PATH]; BuildPath(Path_SM, path, sizeof(path), "plugins/freak_fortress_2"); - decl FileType:filetype; - new Handle:directory=OpenDirectory(path); + FileType filetype; + Handle directory=OpenDirectory(path); while(ReadDirEntry(directory, filename, sizeof(filename), filetype)) { if(filetype==FileType_File && StrContains(filename, ".smx", false)!=-1) @@ -3857,7 +3860,7 @@ public Action:Command_ReloadSubPlugins(client, args) return Plugin_Handled; } -public Action:Command_Point_Disable(client, args) +public Action Command_Point_Disable(int client, int args) { if(Enabled) { @@ -3866,7 +3869,7 @@ public Action:Command_Point_Disable(client, args) return Plugin_Handled; } -public Action:Command_Point_Enable(client, args) +public Action Command_Point_Enable(int client, int args) { if(Enabled) { @@ -3875,9 +3878,9 @@ public Action:Command_Point_Enable(client, args) return Plugin_Handled; } -stock SetControlPoint(bool:enable) +stock void SetControlPoint(bool enable) { - new controlPoint=MaxClients+1; + int controlPoint=MaxClients+1; while((controlPoint=FindEntityByClassname2(controlPoint, "team_control_point"))!=-1) { if(controlPoint>MaxClients && IsValidEntity(controlPoint)) @@ -3889,18 +3892,18 @@ stock SetControlPoint(bool:enable) } } -stock SetArenaCapEnableTime(Float:time) +stock void SetArenaCapEnableTime(float time) { - new entity=-1; + int entity=-1; if((entity=FindEntityByClassname2(-1, "tf_logic_arena"))!=-1 && IsValidEntity(entity)) { - decl String:timeString[32]; + char timeString[32]; FloatToString(time, timeString, sizeof(timeString)); DispatchKeyValue(entity, "CapEnableDelay", timeString); } } -public OnClientPostAdminCheck(client) +public void OnClientPostAdminCheck(int client) { // TODO: Hook these inside of EnableFF2() or somewhere instead SDKHook(client, SDKHook_OnTakeDamageAlive, OnTakeDamageAlive); @@ -3924,9 +3927,9 @@ public OnClientPostAdminCheck(client) } } -public OnClientCookiesCached(client) +public void OnClientCookiesCached(int client) { - decl String:buffer[4]; + char buffer[4]; GetClientCookie(client, FF2Cookie_QueuePoints, buffer, sizeof(buffer)); if(!buffer[0]) { @@ -3947,17 +3950,17 @@ public OnClientCookiesCached(client) SetClientCookie(client, FF2Cookie_DisplayInfo, "1"); buffer="1"; } - displayInfo[client]=bool:StringToInt(buffer); + displayInfo[client]=view_as(StringToInt(buffer)); } -public OnClientDisconnect(client) +public void OnClientDisconnect(int client) { if(Enabled) { if(IsBoss(client) && !CheckRoundState() && GetConVarBool(cvarPreroundBossDisconnect)) { - new boss=GetBossIndex(client); - new bool:omit[MaxClients+1]; + int boss=GetBossIndex(client); + bool[] omit=new bool[MaxClients+1]; omit[client]=true; Boss[boss]=GetClientWithMostQueuePoints(omit); @@ -3982,7 +3985,7 @@ public OnClientDisconnect(client) } } -public Action:OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) +public Action OnPlayerSpawn(Handle event, const char[] name, bool dontBroadcast) { if(Enabled && CheckRoundState()==FF2RoundState_RoundRunning) { @@ -3991,14 +3994,14 @@ public Action:OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcas return Plugin_Continue; } -public Action:OnPostInventoryApplication(Handle:event, const String:name[], bool:dontBroadcast) +public Action OnPostInventoryApplication(Handle event, const char[] name, bool dontBroadcast) { if(!Enabled) { return Plugin_Continue; } - new client=GetClientOfUserId(GetEventInt(event, "userid")); + int client=GetClientOfUserId(GetEventInt(event, "userid")); if(!IsValidClient(client)) { return Plugin_Continue; @@ -4031,32 +4034,32 @@ public Action:OnPostInventoryApplication(Handle:event, const String:name[], bool return Plugin_Continue; } -public Action:Timer_RegenPlayer(Handle:timer, any:userid) +public Action Timer_RegenPlayer(Handle timer, int userid) { - new client=GetClientOfUserId(userid); + int client=GetClientOfUserId(userid); if(IsValidClient(client) && IsPlayerAlive(client)) { TF2_RegeneratePlayer(client); } } -public Action:ClientTimer(Handle:timer) +public Action ClientTimer(Handle timer) { if(!Enabled || CheckRoundState()==FF2RoundState_RoundEnd || CheckRoundState()==FF2RoundState_Loading) { return Plugin_Stop; } - decl String:classname[32]; - new TFCond:cond; - for(new client=1; client<=MaxClients; client++) + char classname[32]; + TFCond cond; + for(int client=1; client<=MaxClients; client++) { if(IsValidClient(client) && !IsBoss(client) && !(FF2Flags[client] & FF2FLAG_CLASSTIMERDISABLED)) { SetHudTextParams(-1.0, 0.88, 0.35, 90, 255, 90, 255, 0, 0.35, 0.0, 0.1); if(!IsPlayerAlive(client)) { - new observer=GetEntPropEnt(client, Prop_Send, "m_hObserverTarget"); + int observer=GetEntPropEnt(client, Prop_Send, "m_hObserverTarget"); if(IsValidClient(observer) && !IsBoss(observer) && observer!=client) { FF2_ShowSyncHudText(client, rageHUD, "%t-%t", "Your Damage Dealt", Damage[client], "Spectator Damage Dealt", observer, Damage[observer]); @@ -4069,24 +4072,24 @@ public Action:ClientTimer(Handle:timer) } FF2_ShowSyncHudText(client, rageHUD, "%t", "Your Damage Dealt", Damage[client]); - new TFClassType:class=TF2_GetPlayerClass(client); - new weapon=GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon"); + TFClassType playerclass=TF2_GetPlayerClass(client); + int weapon=GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon"); if(weapon<=MaxClients || !IsValidEntity(weapon) || !GetEntityClassname(weapon, classname, sizeof(classname))) { strcopy(classname, sizeof(classname), ""); } - new bool:validwep=!StrContains(classname, "tf_weapon", false); + bool validwep=!StrContains(classname, "tf_weapon", false); - new index=(validwep ? GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex") : -1); - if(class==TFClass_Medic) + int index=(validwep ? GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex") : -1); + if(playerclass==TFClass_Medic) { if(weapon==GetPlayerWeaponSlot(client, TFWeaponSlot_Primary)) { - new medigun=GetPlayerWeaponSlot(client, TFWeaponSlot_Secondary); - decl String:mediclassname[64]; + int medigun=GetPlayerWeaponSlot(client, TFWeaponSlot_Secondary); + char mediclassname[64]; if(IsValidEntity(medigun) && GetEntityClassname(medigun, mediclassname, sizeof(mediclassname)) && !StrContains(mediclassname, "tf_weapon_medigun", false)) { - new charge=RoundToFloor(GetEntPropFloat(medigun, Prop_Send, "m_flChargeLevel")*100); + int charge=RoundToFloor(GetEntPropFloat(medigun, Prop_Send, "m_flChargeLevel")*100); SetHudTextParams(-1.0, 0.83, 0.35, 255, 255, 255, 255, 0, 0.2, 0.0, 0.1); FF2_ShowSyncHudText(client, jumpHUD, "%T: %i", "Ubercharge", client, charge); @@ -4099,14 +4102,14 @@ public Action:ClientTimer(Handle:timer) } else if(weapon==GetPlayerWeaponSlot(client, TFWeaponSlot_Secondary)) { - new healtarget=GetHealingTarget(client, true); + int healtarget=GetHealingTarget(client, true); if(IsValidClient(healtarget) && TF2_GetPlayerClass(healtarget)==TFClass_Scout) { TF2_AddCondition(client, TFCond_SpeedBuffAlly, 0.3); } } } - else if(class==TFClass_Soldier) + else if(playerclass==TFClass_Soldier) { if((FF2Flags[client] & FF2FLAG_ISBUFFED) && !(GetEntProp(client, Prop_Send, "m_bRageDraining"))) { @@ -4117,7 +4120,7 @@ public Action:ClientTimer(Handle:timer) if(RedAlivePlayers==1 && !TF2_IsPlayerInCondition(client, TFCond_Cloaked)) { TF2_AddCondition(client, TFCond_HalloweenCritCandy, 0.3); - if(class==TFClass_Engineer && weapon==GetPlayerWeaponSlot(client, TFWeaponSlot_Primary) && StrEqual(classname, "tf_weapon_sentry_revenge", false)) + if(playerclass==TFClass_Engineer && weapon==GetPlayerWeaponSlot(client, TFWeaponSlot_Primary) && StrEqual(classname, "tf_weapon_sentry_revenge", false)) { SetEntProp(client, Prop_Send, "m_iRevengeCrits", 3); } @@ -4140,14 +4143,14 @@ public Action:ClientTimer(Handle:timer) } cond=TFCond_HalloweenCritCandy; - if(TF2_IsPlayerInCondition(client, TFCond_CritCola) && (class==TFClass_Scout || class==TFClass_Heavy)) + if(TF2_IsPlayerInCondition(client, TFCond_CritCola) && (playerclass==TFClass_Scout || playerclass==TFClass_Heavy)) { TF2_AddCondition(client, cond, 0.3); continue; } - new healer=-1; - for(new healtarget=1; healtarget<=MaxClients; healtarget++) + int healer=-1; + for(int healtarget=1; healtarget<=MaxClients; healtarget++) { if(IsValidClient(healtarget) && IsPlayerAlive(healtarget) && GetHealingTarget(healtarget, true)==client) { @@ -4156,7 +4159,7 @@ public Action:ClientTimer(Handle:timer) } } - new bool:addthecrit; + bool addthecrit; if(validwep && weapon==GetPlayerWeaponSlot(client, TFWeaponSlot_Melee) && StrContains(classname, "tf_weapon_knife", false)==-1) //Every melee except knives { addthecrit=true; @@ -4172,7 +4175,7 @@ public Action:ClientTimer(Handle:timer) !StrContains(classname, "tf_weapon_handgun_scout_secondary")) { addthecrit=true; - if(class==TFClass_Scout && cond==TFCond_HalloweenCritCandy) + if(playerclass==TFClass_Scout && cond==TFCond_HalloweenCritCandy) { cond=TFCond_Buffed; } @@ -4183,18 +4186,18 @@ public Action:ClientTimer(Handle:timer) addthecrit=false; } - switch(class) + switch(playerclass) { case TFClass_Medic: { if(weapon==GetPlayerWeaponSlot(client, TFWeaponSlot_Primary)) { - new medigun=GetPlayerWeaponSlot(client, TFWeaponSlot_Secondary); - decl String:mediclassname[64]; + int medigun=GetPlayerWeaponSlot(client, TFWeaponSlot_Secondary); + char mediclassname[64]; if(IsValidEntity(medigun) && GetEntityClassname(medigun, mediclassname, sizeof(mediclassname)) && !StrContains(mediclassname, "tf_weapon_medigun", false)) { SetHudTextParams(-1.0, 0.83, 0.15, 255, 255, 255, 255, 0, 0.2, 0.0, 0.1); - new charge=RoundToFloor(GetEntPropFloat(medigun, Prop_Send, "m_flChargeLevel")*100); + int charge=RoundToFloor(GetEntPropFloat(medigun, Prop_Send, "m_flChargeLevel")*100); FF2_ShowHudText(client, -1, "%T: %i", "Ubercharge", client, charge); if(charge==100 && !(FF2Flags[client] & FF2FLAG_UBERREADY)) { @@ -4205,7 +4208,7 @@ public Action:ClientTimer(Handle:timer) } else if(weapon==GetPlayerWeaponSlot(client, TFWeaponSlot_Secondary)) { - new healtarget=GetHealingTarget(client, true); + int healtarget=GetHealingTarget(client, true); if(IsValidClient(healtarget) && TF2_GetPlayerClass(healtarget)==TFClass_Scout) { TF2_AddCondition(client, TFCond_SpeedBuffAlly, 0.3); @@ -4237,7 +4240,7 @@ public Action:ClientTimer(Handle:timer) { if(weapon==GetPlayerWeaponSlot(client, TFWeaponSlot_Primary) && StrEqual(classname, "tf_weapon_sentry_revenge", false)) { - new sentry=FindSentry(client); + int sentry=FindSentry(client); if(IsValidEntity(sentry) && IsBoss(GetEntPropEnt(sentry, Prop_Send, "m_hEnemy"))) { SetEntProp(client, Prop_Send, "m_iRevengeCrits", 3); @@ -4271,9 +4274,9 @@ public Action:ClientTimer(Handle:timer) return Plugin_Continue; } -stock FindSentry(client) +stock int FindSentry(int client) { - new entity=-1; + int entity=-1; while((entity=FindEntityByClassname2(entity, "obj_sentrygun"))!=-1) { if(GetEntPropEnt(entity, Prop_Send, "m_hBuilder")==client) @@ -4284,17 +4287,17 @@ stock FindSentry(client) return -1; } -public Action:BossTimer(Handle:timer) +public Action BossTimer(Handle timer) { if(!Enabled || CheckRoundState()==FF2RoundState_RoundEnd) { return Plugin_Stop; } - new bool:validBoss; - for(new boss; boss<=MaxClients; boss++) + bool validBoss; + for(int boss; boss<=MaxClients; boss++) { - new client=Boss[boss]; + int client=Boss[boss]; if(!IsValidClient(client) || !IsPlayerAlive(client) || !(FF2Flags[client] & FF2FLAG_USEBOSSTIMER)) { continue; @@ -4326,7 +4329,7 @@ public Action:BossTimer(Handle:timer) SetHudTextParams(-1.0, 0.83, 0.15, 255, 64, 64, 255); FF2_ShowSyncHudText(client, rageHUD, "%t", "Activate Rage"); - decl String:sound[PLATFORM_MAX_PATH]; + char sound[PLATFORM_MAX_PATH]; if(FindSound("full rage", sound, sizeof(sound), boss) && emitRageSound[boss]) { EmitSoundToAllExcept(FF2SOUND_MUTEVOICE, sound, client); @@ -4345,23 +4348,23 @@ public Action:BossTimer(Handle:timer) SetClientGlow(client, -0.2); - new Handle:kv=GetArrayCell(bossesArray, character[boss]); + Handle kv=GetArrayCell(bossesArray, character[boss]); KvRewind(kv); if(KvJumpToKey(kv, "abilities")) { - decl String:ability[10]; + char ability[10]; KvGotoFirstSubKey(kv); do { - decl String:pluginName[64]; + char pluginName[64]; KvGetSectionName(kv, pluginName, sizeof(pluginName)); KvGotoFirstSubKey(kv); do { - decl String:abilityName[64]; + char abilityName[64]; KvGetSectionName(kv, abilityName, sizeof(abilityName)); - new slot=KvGetNum(kv, "slot", 0); - new buttonmode=KvGetNum(kv, "buttonmode", 0); + int slot=KvGetNum(kv, "slot", 0); + int buttonmode=KvGetNum(kv, "buttonmode", 0); if(slot<1) // We don't care about rage/life-loss abilities here { continue; @@ -4374,10 +4377,10 @@ public Action:BossTimer(Handle:timer) } else // But these do { - decl String:temp[3]; - new Handle:livesArray=CreateArray(sizeof(temp)); - new count=ExplodeStringIntoArrayList(ability, " ", livesArray, sizeof(temp)); - for(new n; n1) { Format(bossLives, sizeof(bossLives), "x%i", BossLives[boss2]); @@ -4419,7 +4422,7 @@ public Action:BossTimer(Handle:timer) } } - for(new target; target<=MaxClients; target++) + for(int target; target<=MaxClients; target++) { if(IsValidClient(target) && !(FF2Flags[target] & FF2FLAG_HUDDISABLED)) { @@ -4449,7 +4452,7 @@ public Action:BossTimer(Handle:timer) HPTime=0.0; } - for(new client2; client2<=MaxClients; client2++) + for(int client2; client2<=MaxClients; client2++) { if(KSpreeTimer[client2]>0) { @@ -4465,7 +4468,7 @@ public Action:BossTimer(Handle:timer) return Plugin_Continue; } -public Action:Timer_BotRage(Handle:timer, any:bot) +public Action Timer_BotRage(Handle timer, int bot) { if(IsValidClient(Boss[bot], false)) { @@ -4473,10 +4476,10 @@ public Action:Timer_BotRage(Handle:timer, any:bot) } } -stock OnlyScoutsLeft() +stock int OnlyScoutsLeft() { - new scouts; - for(new client; client<=MaxClients; client++) + int scouts; + for(int client; client<=MaxClients; client++) { if(IsValidClient(client) && IsPlayerAlive(client) && TF2_GetClientTeam(client)!=BossTeam) { @@ -4493,17 +4496,17 @@ stock OnlyScoutsLeft() return scouts; } -stock GetIndexOfWeaponSlot(client, slot) +stock int GetIndexOfWeaponSlot(int client, int slot) { - new weapon=GetPlayerWeaponSlot(client, slot); + int weapon=GetPlayerWeaponSlot(client, slot); return (weapon>MaxClients && IsValidEntity(weapon) ? GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex") : -1); } -public TF2_OnConditionAdded(client, TFCond:condition) +public void TF2_OnConditionAdded(int client, TFCond condition) { if(Enabled) { - if(IsBoss(client) && (condition==TFCond_Jarated || condition==TFCond_MarkedForDeath || (condition==TFCond_Dazed && TF2_IsPlayerInCondition(client, TFCond:42)))) + if(IsBoss(client) && (condition==TFCond_Jarated || condition==TFCond_MarkedForDeath || (condition==TFCond_Dazed && TF2_IsPlayerInCondition(client, view_as(42))))) { TF2_RemoveCondition(client, condition); } @@ -4514,7 +4517,7 @@ public TF2_OnConditionAdded(client, TFCond:condition) } } -public TF2_OnConditionRemoved(client, TFCond:condition) +public void TF2_OnConditionRemoved(int client, TFCond condition) { if(Enabled) { @@ -4529,16 +4532,16 @@ public TF2_OnConditionRemoved(client, TFCond:condition) } } -public Action:OnCallForMedic(client, const String:command[], args) +public Action OnCallForMedic(int client, const char[] command, int args) { if(!Enabled || !IsPlayerAlive(client) || CheckRoundState()!=FF2RoundState_RoundRunning || !IsBoss(client) || args!=2) { return Plugin_Continue; } - new boss=GetBossIndex(client); + int boss=GetBossIndex(client); - decl String:arg1[4], String:arg2[4]; + char arg1[4], arg2[4]; GetCmdArg(1, arg1, sizeof(arg1)); GetCmdArg(2, arg2, sizeof(arg2)); if(StringToInt(arg1) || StringToInt(arg2)) //We only want "voicemenu 0 0"-thanks friagram for pointing out edge cases @@ -4548,20 +4551,20 @@ public Action:OnCallForMedic(client, const String:command[], args) if(RoundFloat(BossCharge[boss][0])==100) { - new Handle:kv=GetArrayCell(bossesArray, character[boss]); + Handle kv=GetArrayCell(bossesArray, character[boss]); KvRewind(kv); if(KvJumpToKey(kv, "abilities")) { - decl String:ability[10]; + char ability[10]; KvGotoFirstSubKey(kv); do { - decl String:pluginName[64]; + char pluginName[64]; KvGetSectionName(kv, pluginName, sizeof(pluginName)); KvGotoFirstSubKey(kv); do { - decl String:abilityName[64]; + char abilityName[64]; KvGetSectionName(kv, abilityName, sizeof(abilityName)); if(KvGetNum(kv, "slot")) // Rage is slot 0 { @@ -4578,10 +4581,10 @@ public Action:OnCallForMedic(client, const String:command[], args) } else // But these do { - decl String:temp[3]; - new Handle:livesArray=CreateArray(sizeof(temp)); - new count=ExplodeStringIntoArrayList(ability, " ", livesArray, sizeof(temp)); - for(new n; n" { - new String:classnames[][]={"", "scout", "sniper", "soldier", "demoman", "medic", "heavy", "pyro", "spy", "engineer"}; - decl String:class[32]; - Format(class, sizeof(class), "kill %s", classnames[TF2_GetPlayerClass(client)]); - if(FindSound(class, sound, sizeof(sound), boss)) + char classnames[][]={"", "scout", "sniper", "soldier", "demoman", "medic", "heavy", "pyro", "spy", "engineer"}; + char playerclass[32]; + Format(playerclass, sizeof(playerclass), "kill %s", classnames[TF2_GetPlayerClass(client)]); + if(FindSound(playerclass, sound, sizeof(sound), boss)) { EmitSoundToAllExcept(FF2SOUND_MUTEVOICE, sound, attacker); EmitSoundToAllExcept(FF2SOUND_MUTEVOICE, sound, attacker); @@ -4801,7 +4805,7 @@ public Action:OnPlayerDeath(Handle:event, const String:eventName[], bool:dontBro } else { - new boss=GetBossIndex(client); + int boss=GetBossIndex(client); if(boss==-1 || (GetEventInt(event, "death_flags") & TF_DEATHFLAG_DEADRINGER)) { return Plugin_Continue; @@ -4822,9 +4826,9 @@ public Action:OnPlayerDeath(Handle:event, const String:eventName[], bool:dontBro if(TF2_GetPlayerClass(client)==TFClass_Engineer && !(GetEventInt(event, "death_flags") & TF_DEATHFLAG_DEADRINGER)) { - decl String:name[PLATFORM_MAX_PATH]; + char name[PLATFORM_MAX_PATH]; FakeClientCommand(client, "destroy 2"); - for(new entity=MaxClients+1; entitycountdownPlayers) { @@ -4990,9 +4994,9 @@ public Action:Timer_DrawGame(Handle:timer) return Plugin_Stop; } - new time=timeleft; + int time=timeleft; timeleft--; - decl String:timeDisplay[6]; + char timeDisplay[6]; if(time/60>9) { IntToString(time/60, timeDisplay, sizeof(timeDisplay)); @@ -5012,7 +5016,7 @@ public Action:Timer_DrawGame(Handle:timer) } SetHudTextParams(-1.0, 0.17, 1.1, 255, 255, 255, 255); - for(new client; client<=MaxClients; client++) + for(int client; client<=MaxClients; client++) { if(IsValidClient(client)) { @@ -5044,7 +5048,7 @@ public Action:Timer_DrawGame(Handle:timer) } case 1, 2, 3, 4, 5: { - decl String:sound[PLATFORM_MAX_PATH]; + char sound[PLATFORM_MAX_PATH]; Format(sound, sizeof(sound), "vo/announcer_ends_%isec.mp3", time); EmitSoundToAll(sound); } @@ -5052,7 +5056,7 @@ public Action:Timer_DrawGame(Handle:timer) { if(!GetConVarBool(cvarCountdownResult)) { - for(new client=1; client<=MaxClients; client++) //Thx MasterOfTheXP + for(int client=1; client<=MaxClients; client++) //Thx MasterOfTheXP { if(IsClientInGame(client) && IsPlayerAlive(client)) { @@ -5070,7 +5074,7 @@ public Action:Timer_DrawGame(Handle:timer) return Plugin_Continue; } -public Action:OnPlayerHurt(Handle:event, const String:name[], bool:dontBroadcast) //TODO: Can this be removed? +public Action OnPlayerHurt(Handle event, const char[] name, bool dontBroadcast) //TODO: Can this be removed? { if(Enabled && CheckRoundState()==FF2RoundState_RoundRunning && GetEventBool(event, "minicrit") && GetEventBool(event, "allseecrit")) { @@ -5080,7 +5084,7 @@ public Action:OnPlayerHurt(Handle:event, const String:name[], bool:dontBroadcast return Plugin_Continue; } -public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &damagetype, &weapon, Float:damageForce[3], Float:damagePosition[3], damagecustom) +public Action OnTakeDamageAlive(int client, int& attacker, int& inflictor, float& damage, int& damagetype, int& weapon, float damageForce[3], float damagePosition[3], int damagecustom) { if(!Enabled || !IsValidEntity(attacker)) { @@ -5104,7 +5108,7 @@ public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &d return Plugin_Changed; } - new Float:position[3]; + float position[3]; GetEntPropVector(attacker, Prop_Send, "m_vecOrigin", position); if(IsBoss(attacker)) { @@ -5147,13 +5151,13 @@ public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &d } else { - new boss=GetBossIndex(client); + int boss=GetBossIndex(client); if(boss!=-1) { if(attacker<=MaxClients) { - new index; - decl String:classname[64]; + int index; + char classname[64]; if(IsValidEntity(weapon) && weapon>MaxClients && attacker<=MaxClients) { GetEntityClassname(weapon, classname, sizeof(classname)); @@ -5188,20 +5192,20 @@ public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &d { if(CheckRoundState()!=FF2RoundState_RoundEnd) { - new Float:charge=(IsValidEntity(weapon) && weapon>MaxClients ? GetEntPropFloat(weapon, Prop_Send, "m_flChargedDamage") : 0.0); + float charge=(IsValidEntity(weapon) && weapon>MaxClients ? GetEntPropFloat(weapon, Prop_Send, "m_flChargedDamage") : 0.0); if(index==752) //Hitman's Heatmaker { - new Float:focus=10+(charge/10); + float focus=10+(charge/10); if(TF2_IsPlayerInCondition(attacker, TFCond_FocusBuff)) { focus/=3; } - new Float:rage=GetEntPropFloat(attacker, Prop_Send, "m_flRageMeter"); + float rage=GetEntPropFloat(attacker, Prop_Send, "m_flRageMeter"); SetEntPropFloat(attacker, Prop_Send, "m_flRageMeter", (rage+focus>100) ? 100.0 : rage+focus); } else if(index!=230 && index!=402 && index!=526 && index!=30665) //Sydney Sleeper, Bazaar Bargain, Machina, Shooting Star { - new Float:time=(GlowTimer[boss]>10 ? 1.0 : 2.0); + float time=(GlowTimer[boss]>10 ? 1.0 : 2.0); time+=(GlowTimer[boss]>10 ? (GlowTimer[boss]>20 ? 1.0 : 2.0) : 4.0)*(charge/100.0); SetClientGlow(Boss[boss], time); if(GlowTimer[boss]>30.0) @@ -5241,8 +5245,8 @@ public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &d } case 214: //Powerjack { - new health=GetClientHealth(attacker); - new newhealth=health+50; + int health=GetClientHealth(attacker); + int newhealth=health+50; if(newhealth<=GetEntProp(attacker, Prop_Data, "m_iMaxHealth")) //No overheal allowed { SetEntityHealth(attacker, newhealth); @@ -5255,8 +5259,8 @@ public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &d } case 310: //Warrior's Spirit { - new health=GetClientHealth(attacker); - new newhealth=health+50; + int health=GetClientHealth(attacker); + int newhealth=health+50; if(newhealth<=GetEntProp(attacker, Prop_Data, "m_iMaxHealth")) //No overheal allowed { SetEntityHealth(attacker, newhealth); @@ -5273,8 +5277,8 @@ public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &d } case 327: //Claidheamh Mòr { - new health=GetClientHealth(attacker); - new newhealth=health+25; + int health=GetClientHealth(attacker); + int newhealth=health+25; if(newhealth<=GetEntProp(attacker, Prop_Data, "m_iMaxHealth")) //No overheal allowed { SetEntityHealth(attacker, newhealth); @@ -5285,7 +5289,7 @@ public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &d TF2_RemoveCondition(attacker, TFCond_OnFire); } - new Float:charge=GetEntPropFloat(attacker, Prop_Send, "m_flChargeMeter"); + float charge=GetEntPropFloat(attacker, Prop_Send, "m_flChargeMeter"); if(charge+25.0>=100.0) { SetEntPropFloat(attacker, Prop_Send, "m_flChargeMeter", 100.0); @@ -5314,9 +5318,9 @@ public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &d SetEntProp(attacker, Prop_Send, "m_iKillCountSinceLastDeploy", 1); } - new health=GetClientHealth(attacker); - new max=GetEntProp(attacker, Prop_Data, "m_iMaxHealth"); - new newhealth=health+50; + int health=GetClientHealth(attacker); + int max=GetEntProp(attacker, Prop_Data, "m_iMaxHealth"); + int newhealth=health+50; if(healthmax+100) @@ -5370,9 +5374,9 @@ public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &d } case 593: //Third Degree { - new healers[MAXPLAYERS]; - new healerCount; - for(new healer; healer<=MaxClients; healer++) + int healers[MAXPLAYERS]; + int healerCount; + for(int healer; healer<=MaxClients; healer++) { if(IsValidClient(healer) && IsPlayerAlive(healer) && (GetHealingTarget(healer, true)==attacker)) { @@ -5381,18 +5385,18 @@ public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &d } } - for(new healer; healer1.0) { uber=1.0; @@ -5417,7 +5421,7 @@ public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &d } case 1104: { - static Float:airStrikeDamage; + static float airStrikeDamage; airStrikeDamage+=damage; if(airStrikeDamage>=200.0) { @@ -5441,11 +5445,11 @@ public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &d SetEntPropFloat(attacker, Prop_Send, "m_flNextAttack", GetGameTime()+2.0); SetEntPropFloat(attacker, Prop_Send, "m_flStealthNextChangeTime", GetGameTime()+2.0); - new viewmodel=GetEntPropEnt(attacker, Prop_Send, "m_hViewModel"); + int viewmodel=GetEntPropEnt(attacker, Prop_Send, "m_hViewModel"); if(viewmodel>MaxClients && IsValidEntity(viewmodel) && TF2_GetPlayerClass(attacker)==TFClass_Spy) { - new melee=GetIndexOfWeaponSlot(attacker, TFWeaponSlot_Melee); - new animation=41; + int melee=GetIndexOfWeaponSlot(attacker, TFWeaponSlot_Melee); + int animation=41; switch(melee) { case 225, 356, 423, 461, 574, 649, 1071: //Your Eternal Reward, Conniver's Kunai, Saxxy, Wanga Prick, Big Earner, Spy-cicle, Golden Frying Pan @@ -5476,7 +5480,7 @@ public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &d } else if(index==356) //Conniver's Kunai { - new health=GetClientHealth(attacker)+200; + int health=GetClientHealth(attacker)+200; if(health>500) { health=500; @@ -5494,7 +5498,7 @@ public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &d SetEntProp(attacker, Prop_Send, "m_iRevengeCrits", GetEntProp(attacker, Prop_Send, "m_iRevengeCrits")+2); } - decl String:sound[PLATFORM_MAX_PATH]; + char sound[PLATFORM_MAX_PATH]; if(FindSound("stabbed", sound, sizeof(sound), boss)) { EmitSoundToAllExcept(FF2SOUND_MUTEVOICE, sound, client); @@ -5517,7 +5521,7 @@ public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &d } damage=(BossHealth[boss]>9001 ? 9001.0 : float(GetEntProp(Boss[boss], Prop_Send, "m_iHealth"))+90.0); - new teleowner=FindTeleOwner(attacker); + int teleowner=FindTeleOwner(attacker); if(IsValidClient(teleowner) && teleowner!=attacker) { Damage[teleowner]+=9001*3/5; @@ -5546,14 +5550,14 @@ public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &d } else { - decl String:classname[64]; + char classname[64]; if(GetEntityClassname(attacker, classname, sizeof(classname)) && StrEqual(classname, "trigger_hurt", false)) { - new Action:action; + Action action; Call_StartForward(OnTriggerHurt); Call_PushCell(boss); Call_PushCell(attacker); - new Float:damage2=damage; + float damage2=damage; Call_PushFloatRef(damage2); Call_Finish(action); if(action!=Plugin_Stop && action!=Plugin_Handled) @@ -5595,7 +5599,7 @@ public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &d } else { - new index=(IsValidEntity(weapon) && weapon>MaxClients && attacker<=MaxClients ? GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex") : -1); + int index=(IsValidEntity(weapon) && weapon>MaxClients && attacker<=MaxClients ? GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex") : -1); if(index==307) //Ullapool Caber { if(detonations[attacker](team), 4); SetEntityMoveType(healthpack, MOVETYPE_VPHYSICS); - new Float:velocity[3];//={float(GetRandomInt(-10, 10)), float(GetRandomInt(-10, 10)), 50.0}; //Q_Q + float velocity[3];//={float(GetRandomInt(-10, 10)), float(GetRandomInt(-10, 10)), 50.0}; //Q_Q velocity[0]=float(GetRandomInt(-10, 10)), velocity[1]=float(GetRandomInt(-10, 10)), velocity[2]=50.0; //I did this because setting it on the creation of the vel variable was creating a compiler error for me. TeleportEntity(healthpack, position, NULL_VECTOR, velocity); } } -stock IncrementHeadCount(client) +stock void IncrementHeadCount(int client) { if(!TF2_IsPlayerInCondition(client, TFCond_DemoBuff)) { TF2_AddCondition(client, TFCond_DemoBuff, -1.0); } - new decapitations=GetEntProp(client, Prop_Send, "m_iDecapitations"); - new health=GetClientHealth(client); + int decapitations=GetEntProp(client, Prop_Send, "m_iDecapitations"); + int health=GetClientHealth(client); SetEntProp(client, Prop_Send, "m_iDecapitations", decapitations+1); SetEntityHealth(client, health+15); TF2_AddCondition(client, TFCond_SpeedBuffAlly, 0.01); } -stock FindTeleOwner(client) +stock int FindTeleOwner(int client) { if(!IsValidClient(client) || !IsPlayerAlive(client)) { return -1; } - new teleporter=GetEntPropEnt(client, Prop_Send, "m_hGroundEntity"); - decl String:classname[32]; + int teleporter=GetEntPropEnt(client, Prop_Send, "m_hGroundEntity"); + char classname[32]; if(IsValidEntity(teleporter) && GetEntityClassname(teleporter, classname, sizeof(classname)) && StrEqual(classname, "obj_teleporter", false)) { - new owner=GetEntPropEnt(teleporter, Prop_Send, "m_hBuilder"); + int owner=GetEntPropEnt(teleporter, Prop_Send, "m_hBuilder"); if(IsValidClient(owner, false)) { return owner; @@ -5875,14 +5881,14 @@ stock FindTeleOwner(client) return -1; } -stock TF2_IsPlayerCritBuffed(client) +stock bool TF2_IsPlayerCritBuffed(int client) { - return (TF2_IsPlayerInCondition(client, TFCond_Kritzkrieged) || TF2_IsPlayerInCondition(client, TFCond_HalloweenCritCandy) || TF2_IsPlayerInCondition(client, TFCond:34) || TF2_IsPlayerInCondition(client, TFCond:35) || TF2_IsPlayerInCondition(client, TFCond_CritOnFirstBlood) || TF2_IsPlayerInCondition(client, TFCond_CritOnWin) || TF2_IsPlayerInCondition(client, TFCond_CritOnFlagCapture) || TF2_IsPlayerInCondition(client, TFCond_CritOnKill) || TF2_IsPlayerInCondition(client, TFCond_CritMmmph)); + return (TF2_IsPlayerInCondition(client, TFCond_Kritzkrieged) || TF2_IsPlayerInCondition(client, TFCond_HalloweenCritCandy) || TF2_IsPlayerInCondition(client, view_as(34)) || TF2_IsPlayerInCondition(client, view_as(35)) || TF2_IsPlayerInCondition(client, TFCond_CritOnFirstBlood) || TF2_IsPlayerInCondition(client, TFCond_CritOnWin) || TF2_IsPlayerInCondition(client, TFCond_CritOnFlagCapture) || TF2_IsPlayerInCondition(client, TFCond_CritOnKill) || TF2_IsPlayerInCondition(client, TFCond_CritMmmph)); } -public Action:Timer_DisguiseBackstab(Handle:timer, any:userid) +public Action Timer_DisguiseBackstab(Handle timer, int userid) { - new client=GetClientOfUserId(userid); + int client=GetClientOfUserId(userid); if(IsValidClient(client, false)) { RandomlyDisguise(client); @@ -5890,7 +5896,7 @@ public Action:Timer_DisguiseBackstab(Handle:timer, any:userid) return Plugin_Continue; } -stock AssignTeam(client, TFTeam:team) +stock void AssignTeam(int client, TFTeam team) { if(!GetEntProp(client, Prop_Send, "m_iDesiredPlayerClass")) //Living spectator check: 0 means that no class is selected { @@ -5914,7 +5920,7 @@ stock AssignTeam(client, TFTeam:team) Debug("%N is a living spectator! Please report this to https://github.com/50DKP/FF2-Official", client); if(IsBoss(client)) { - TF2_SetPlayerClass(client, TFClassType:KvGetNum(GetArrayCell(bossesArray, character[Boss[client]]), "class", 1)); + TF2_SetPlayerClass(client, view_as(KvGetNum(GetArrayCell(bossesArray, character[Boss[client]]), "class", 1))); } else { @@ -5925,15 +5931,15 @@ stock AssignTeam(client, TFTeam:team) } } -stock RandomlyDisguise(client) //Original code was mecha's, but the original code is broken and this uses a better method now. +stock void RandomlyDisguise(int client) //Original code was mecha's, but the original code is broken and this uses a better method now. { if(IsValidClient(client) && IsPlayerAlive(client)) { - new disguiseTarget=-1; - new TFTeam:team=TF2_GetClientTeam(client); + int disguiseTarget=-1; + TFTeam team=TF2_GetClientTeam(client); - new Handle:disguiseArray=CreateArray(); - for(new clientcheck; clientcheck<=MaxClients; clientcheck++) + Handle disguiseArray=CreateArray(); + for(int clientcheck; clientcheck<=MaxClients; clientcheck++) { if(IsValidClient(clientcheck) && TF2_GetClientTeam(clientcheck)==team && clientcheck!=client) { @@ -5954,26 +5960,26 @@ stock RandomlyDisguise(client) //Original code was mecha's, but the original cod } } - new class=GetRandomInt(0, 4); - new TFClassType:classArray[]={TFClass_Scout, TFClass_Pyro, TFClass_Medic, TFClass_Engineer, TFClass_Sniper}; + int playerclass=GetRandomInt(0, 4); + TFClassType classArray[]={TFClass_Scout, TFClass_Pyro, TFClass_Medic, TFClass_Engineer, TFClass_Sniper}; CloseHandle(disguiseArray); if(TF2_GetPlayerClass(client)==TFClass_Spy) { - TF2_DisguisePlayer(client, team, classArray[class], disguiseTarget); + TF2_DisguisePlayer(client, team, classArray[playerclass], disguiseTarget); } else { TF2_AddCondition(client, TFCond_Disguised, -1.0); - SetEntProp(client, Prop_Send, "m_nDisguiseTeam", _:team); - SetEntProp(client, Prop_Send, "m_nDisguiseClass", classArray[class]); + SetEntProp(client, Prop_Send, "m_nDisguiseTeam", view_as(team)); + SetEntProp(client, Prop_Send, "m_nDisguiseClass", classArray[playerclass]); SetEntProp(client, Prop_Send, "m_iDisguiseTargetIndex", disguiseTarget); SetEntProp(client, Prop_Send, "m_iDisguiseHealth", 200); } } } -public Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[], &bool:result) +public Action TF2_CalcIsAttackCritical(int client, int weapon, char[] weaponname, bool& result) { if(Enabled && IsBoss(client) && CheckRoundState()==FF2RoundState_RoundRunning && !TF2_IsPlayerCritBuffed(client) && !BossCrits) { @@ -5983,10 +5989,10 @@ public Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[], &boo return Plugin_Continue; } -stock GetClientWithMostQueuePoints(bool:omit[]) +stock int GetClientWithMostQueuePoints(bool[] omit) { - new winner; - for(new client=1; client<=MaxClients; client++) + int winner; + for(int client=1; client<=MaxClients; client++) { if(IsValidClient(client) && GetClientQueuePoints(client)>=GetClientQueuePoints(winner) && !omit[client]) { @@ -5999,9 +6005,9 @@ stock GetClientWithMostQueuePoints(bool:omit[]) return winner; } -stock LastBossIndex() +stock int LastBossIndex() { - for(new client=1; client<=MaxClients; client++) + for(int client=1; client<=MaxClients; client++) { if(!Boss[client]) { @@ -6011,9 +6017,9 @@ stock LastBossIndex() return 0; } -stock Operate(Handle:sumArray, &bracket, Float:value, Handle:_operator) +stock void Operate(Handle sumArray, int& bracket, float value, Handle _operator) { - new Float:sum=GetArrayCell(sumArray, bracket); + float sum=GetArrayCell(sumArray, bracket); switch(GetArrayCell(_operator, bracket)) { case Operator_Add: @@ -6050,7 +6056,7 @@ stock Operate(Handle:sumArray, &bracket, Float:value, Handle:_operator) SetArrayCell(_operator, bracket, Operator_None); } -stock OperateString(Handle:sumArray, &bracket, String:value[], size, Handle:_operator) +stock void OperateString(Handle sumArray, int& bracket, char[] value, int size, Handle _operator) { if(!StrEqual(value, "")) //Make sure 'value' isn't blank { @@ -6081,16 +6087,16 @@ stock OperateString(Handle:sumArray, &bracket, String:value[], size, Handle:_ope * @param defaultValue The default value to return in case of error * @return The value of the formula, or `defaultValue` in case of error */ -stock ParseFormula(boss, const String:key[], defaultValue) +stock int ParseFormula(int boss, const char[] key, int defaultValue) { - decl String:formula[1024], String:bossName[64]; - new Handle:kv=GetArrayCell(bossesArrayShadow, character[boss]); + char formula[1024], bossName[64]; + Handle kv=GetArrayCell(bossesArrayShadow, character[boss]); KvRewind(kv); KvGetString(kv, "name", bossName, sizeof(bossName), "=Failed name="); - decl String:keyPortions[5][128]; - new portions=ExplodeString(key, ">", keyPortions, sizeof(keyPortions), 128); - for(new i=1; i", keyPortions, sizeof(keyPortions), 128); + for(int i=1; i=0) { - decl String:bossName[64]; + char bossName[64]; KvRewind(kv); KvGetString(kv, "name", bossName, sizeof(bossName)); PrintToServer("[FF2 Bosses] Character %s has a duplicate sound '%s'!", bossName, match); @@ -6364,20 +6371,20 @@ stock bool:FindSound(const String:sound[], String:file[], length, boss=0, bool:a return true; } -ForceTeamWin(TFTeam:team) +void ForceTeamWin(TFTeam team) { - new entity=FindEntityByClassname2(-1, "team_control_point_master"); + int entity=FindEntityByClassname2(-1, "team_control_point_master"); if(!IsValidEntity(entity)) { entity=CreateEntityByName("team_control_point_master"); DispatchSpawn(entity); AcceptEntityInput(entity, "Enable"); } - SetVariantInt(_:team); + SetVariantInt(view_as(team)); AcceptEntityInput(entity, "SetWinner"); } -public bool:PickCharacter(boss, companion) +public bool PickCharacter(int boss, int companion) { if(boss==companion) { @@ -6385,12 +6392,12 @@ public bool:PickCharacter(boss, companion) Incoming[boss]=-1; if(character[boss]!=-1) //We've already picked a boss through Command_SetNextBoss { - new Action:action; + Action action; Call_StartForward(OnBossSelected); Call_PushCell(boss); - new newCharacter=character[boss]; + int newCharacter=character[boss]; Call_PushCellRef(newCharacter); - decl String:newName[64]; + char newName[64]; KvRewind(GetArrayCell(bossesArray, character[boss])); KvGetString(GetArrayCell(bossesArray, character[boss]), "name", newName, sizeof(newName)); Call_PushStringEx(newName, sizeof(newName), SM_PARAM_STRING_UTF8 | SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); @@ -6400,9 +6407,9 @@ public bool:PickCharacter(boss, companion) { if(newName[0]) { - decl String:characterName[64]; - new foundExactMatch=-1, foundPartialMatch=-1; - for(new characterIndex; characterIndex1) { - for(new target; targetMaxClients) { @@ -7352,12 +7359,12 @@ stock bool:IsValidClient(client, bool:replaycheck=true) return true; } -public CvarChangeNextmap(Handle:convar, const String:oldValue[], const String:newValue[]) +public void CvarChangeNextmap(Handle convar, const char[] oldValue, const char[] newValue) { CreateTimer(0.1, Timer_DisplayCharsetVote, _, TIMER_FLAG_NO_MAPCHANGE); } -public Action:Timer_DisplayCharsetVote(Handle:timer) +public Action Timer_DisplayCharsetVote(Handle timer) { if(isCharSetSelected) { @@ -7370,16 +7377,16 @@ public Action:Timer_DisplayCharsetVote(Handle:timer) return Plugin_Continue; } - new Handle:menu=CreateMenu(Handler_VoteCharset, MenuAction:MENU_ACTIONS_ALL); + Handle menu=CreateMenu(Handler_VoteCharset, view_as(MENU_ACTIONS_ALL)); SetMenuTitle(menu, "%t", "Vote for Character Set"); //"Please vote for the character set for the next map." - decl String:config[PLATFORM_MAX_PATH], String:charset[64]; + char config[PLATFORM_MAX_PATH], charset[64]; BuildPath(Path_SM, config, sizeof(config), "%s/%s", FF2_SETTINGS, BOSS_CONFIG); - new Handle:Kv=CreateKeyValues(""); + Handle Kv=CreateKeyValues(""); FileToKeyValues(Kv, config); AddMenuItem(menu, "Random", "Random"); - new total, charsets; + int total, charsets; do { total++; @@ -7399,19 +7406,19 @@ public Action:Timer_DisplayCharsetVote(Handle:timer) if(charsets>1) //We have enough to call a vote { FF2CharSet=charsets; //Temporary so that if the vote result is random we know how many valid charsets are in the validCharset array - new Handle:voteDuration=FindConVar("sm_mapvote_voteduration"); + Handle voteDuration=FindConVar("sm_mapvote_voteduration"); VoteMenuToAll(menu, voteDuration ? GetConVarInt(voteDuration) : 20); } return Plugin_Continue; } -public Handler_VoteCharset(Handle:menu, MenuAction:action, param1, param2) +public int Handler_VoteCharset(Handle menu, MenuAction action, int param1, int param2) { if(action==MenuAction_VoteEnd) { FF2CharSet=param1 ? param1-1 : validCharsets[GetRandomInt(1, FF2CharSet)]-1; //If param1 is 0 then we need to find a random charset - decl String:nextmap[32]; + char nextmap[32]; GetConVarString(cvarNextmap, nextmap, sizeof(nextmap)); GetMenuItem(menu, param1, FF2CharSetString, sizeof(FF2CharSetString)); CPrintToChatAll("{olive}[FF2]{default} %t", "Character Set Next Map", nextmap, FF2CharSetString); //"The character set for {1} will be {2}." @@ -7423,20 +7430,20 @@ public Handler_VoteCharset(Handle:menu, MenuAction:action, param1, param2) } } -public Action:Command_Nextmap(client, args) +public Action Command_Nextmap(int client, int args) { if(FF2CharSetString[0]) { - decl String:nextmap[42]; + char nextmap[42]; GetConVarString(cvarNextmap, nextmap, sizeof(nextmap)); CPrintToChat(client, "{olive}[FF2]{default} %t", "Character Set Next Map", nextmap, FF2CharSetString); } return Plugin_Handled; } -public Action:Command_Say(client, args) +public Action Command_Say(int client, int args) { - decl String:chat[128]; + char chat[128]; if(GetCmdArgString(chat, sizeof(chat))<1 || !client) { return Plugin_Continue; @@ -7450,7 +7457,7 @@ public Action:Command_Say(client, args) return Plugin_Continue; } -stock FindEntityByClassname2(startEnt, const String:classname[]) +stock int FindEntityByClassname2(int startEnt, const char[] classname) { while(startEnt>-1 && !IsValidEntity(startEnt)) { @@ -7459,13 +7466,13 @@ stock FindEntityByClassname2(startEnt, const String:classname[]) return FindEntityByClassname(startEnt, classname); } -public Action:Timer_UseBossCharge(Handle:timer, Handle:data) +public Action Timer_UseBossCharge(Handle timer, Handle data) { BossCharge[ReadPackCell(data)][ReadPackCell(data)]=ReadPackFloat(data); return Plugin_Continue; } -stock RemoveShield(client, attacker, Float:position[3]) +stock void RemoveShield(int client, int attacker, float position[3]) { TF2_RemoveWearable(client, shield[client]); EmitSoundToClient(client, "player/spy_shield_break.wav", _, _, _, _, 0.7, _, _, position, _, false); @@ -7478,47 +7485,47 @@ stock RemoveShield(client, attacker, Float:position[3]) //Natives aren't inlined because of https://github.com/50DKP/FF2-Official/issues/263 -public bool:IsFF2Enabled() +public bool IsFF2Enabled() { return Enabled; } -public Native_IsFF2Enabled(Handle:plugin, numParams) +public int Native_IsFF2Enabled(Handle plugin, int numParams) { return IsFF2Enabled(); } -public RegisterSubplugin(String:pluginName[]) +public void RegisterSubplugin(char[] pluginName) { PushArrayString(subpluginArray, pluginName); } -public Native_RegisterSubplugin(Handle:plugin, numParams) +public int Native_RegisterSubplugin(Handle plugin, int numParams) { - decl String:pluginName[64]; + char pluginName[64]; GetNativeString(1, pluginName, sizeof(pluginName)); RegisterSubplugin(pluginName); } -public UnregisterSubplugin(String:pluginName[]) +public void UnregisterSubplugin(char[] pluginName) { - new index=FindStringInArray(subpluginArray, pluginName); + int index=FindStringInArray(subpluginArray, pluginName); if(index>=0) { RemoveFromArray(subpluginArray, index); } } -public Native_UnregisterSubplugin(Handle:plugin, numParams) +public int Native_UnregisterSubplugin(Handle plugin, int numParams) { - decl String:pluginName[64]; + char pluginName[64]; GetNativeString(1, pluginName, sizeof(pluginName)); UnregisterSubplugin(pluginName); } -public bool:GetFF2Version() +public bool GetFF2Version() { - new version[3]; //Blame the compiler for this mess -.- + int version[3]; //Blame the compiler for this mess -.- version[0]=StringToInt(MAJOR_REVISION); version[1]=StringToInt(MINOR_REVISION); version[2]=StringToInt(STABLE_REVISION); @@ -7530,17 +7537,17 @@ public bool:GetFF2Version() #endif } -public Native_GetFF2Version(Handle:plugin, numParams) +public int Native_GetFF2Version(Handle plugin, int numParams) { return GetFF2Version(); } -public Native_GetRoundState(Handle:plugin, numParams) +public int Native_GetRoundState(Handle plugin, int numParams) { - return _:CheckRoundState(); + return view_as(CheckRoundState()); } -public GetBossUserId(boss) +public int GetBossUserId(int boss) { if(boss>=0 && boss<=MaxClients && IsValidClient(Boss[boss])) { @@ -7549,16 +7556,16 @@ public GetBossUserId(boss) return -1; } -public Native_GetBossUserId(Handle:plugin, numParams) +public int Native_GetBossUserId(Handle plugin, int numParams) { return GetBossUserId(GetNativeCell(1)); } -public GetBossIndex(client) +public int GetBossIndex(int client) { if(client>0 && client<=MaxClients) { - for(new boss; boss<=MaxClients; boss++) + for(int boss; boss<=MaxClients; boss++) { if(Boss[boss]==client) { @@ -7569,22 +7576,22 @@ public GetBossIndex(client) return -1; } -public Native_GetBossIndex(Handle:plugin, numParams) +public int Native_GetBossIndex(Handle plugin, int numParams) { return GetBossIndex(GetNativeCell(1)); } -public TFTeam:GetBossTeam() +public TFTeam GetBossTeam() { return BossTeam; } -public Native_GetBossTeam(Handle:plugin, numParams) +public int Native_GetBossTeam(Handle plugin, int numParams) { - return _:GetBossTeam(); + return view_as(GetBossTeam()); } -public bool:GetBossName(boss, String:bossName[], length) +public bool GetBossName(int boss, char[] bossName, int length) { if(boss>=0 && boss<=MaxClients && character[boss]>=0 && character[boss]=0 && boss<=MaxClients && character[boss]>=0 && character[boss](GetBossKV(GetNativeCell(1))); } -public GetBossHealth(boss) +public int GetBossHealth(int boss) { return BossHealth[boss]; } -public Native_GetBossHealth(Handle:plugin, numParams) +public int Native_GetBossHealth(Handle plugin, int numParams) { return GetBossHealth(GetNativeCell(1)); } -public SetBossHealth(boss, health) +public int SetBossHealth(int boss, int health) { BossHealth[boss]=health; } -public Native_SetBossHealth(Handle:plugin, numParams) +public int Native_SetBossHealth(Handle plugin, int numParams) { SetBossHealth(GetNativeCell(1), GetNativeCell(2)); } -public GetBossMaxHealth(boss) +public int GetBossMaxHealth(int boss) { return BossHealthMax[boss]; } -public Native_GetBossMaxHealth(Handle:plugin, numParams) +public int Native_GetBossMaxHealth(Handle plugin, int numParams) { return GetBossMaxHealth(GetNativeCell(1)); } -public SetBossMaxHealth(boss, health) +public int SetBossMaxHealth(int boss, int health) { BossHealthMax[boss]=health; } -public Native_SetBossMaxHealth(Handle:plugin, numParams) +public int Native_SetBossMaxHealth(Handle plugin, int numParams) { SetBossMaxHealth(GetNativeCell(1), GetNativeCell(2)); } -public GetBossLives(boss) +public int GetBossLives(int boss) { return BossLives[boss]; } -public Native_GetBossLives(Handle:plugin, numParams) +public int Native_GetBossLives(Handle plugin, int numParams) { return GetBossLives(GetNativeCell(1)); } -public SetBossLives(boss, lives) +public int SetBossLives(int boss, int lives) { BossLives[boss]=lives; } -public Native_SetBossLives(Handle:plugin, numParams) +public int Native_SetBossLives(Handle plugin, int numParams) { SetBossLives(GetNativeCell(1), GetNativeCell(2)); } -public GetBossMaxLives(boss) +public int GetBossMaxLives(int boss) { return BossLivesMax[boss]; } -public Native_GetBossMaxLives(Handle:plugin, numParams) +public int Native_GetBossMaxLives(Handle plugin, int numParams) { return GetBossMaxLives(GetNativeCell(1)); } -public SetBossMaxLives(boss, lives) +public int SetBossMaxLives(int boss, int lives) { BossLivesMax[boss]=lives; } -public Native_SetBossMaxLives(Handle:plugin, numParams) +public int Native_SetBossMaxLives(Handle plugin, int numParams) { SetBossMaxLives(GetNativeCell(1), GetNativeCell(2)); } -public Float:GetBossCharge(boss, slot) +public float GetBossCharge(int boss, int slot) { return BossCharge[boss][slot]; } -public Native_GetBossCharge(Handle:plugin, numParams) +public int Native_GetBossCharge(Handle plugin, int numParams) { - return _:GetBossCharge(GetNativeCell(1), GetNativeCell(2)); + return view_as(GetBossCharge(GetNativeCell(1), GetNativeCell(2))); } -public SetBossCharge(boss, slot, Float:charge) //FIXME: This duplicates logic found in Timer_UseBossCharge +public int SetBossCharge(int boss, int slot, float charge) //FIXME: This duplicates logic found in Timer_UseBossCharge { BossCharge[boss][slot]=charge; } -public Native_SetBossCharge(Handle:plugin, numParams) +public int Native_SetBossCharge(Handle plugin, int numParams) { - SetBossCharge(GetNativeCell(1), GetNativeCell(2), Float:GetNativeCell(3)); + SetBossCharge(GetNativeCell(1), GetNativeCell(2), float(GetNativeCell(3))); } -public GetBossRageDamage(boss) +public int GetBossRageDamage(int boss) { return BossRageDamage[boss]; } -public Native_GetBossRageDamage(Handle:plugin, numParams) +public int Native_GetBossRageDamage(Handle plugin, int numParams) { return GetBossRageDamage(GetNativeCell(1)); } -public SetBossRageDamage(boss, damage) +public int SetBossRageDamage(int boss, int damage) { BossRageDamage[boss]=damage; } -public Native_SetBossRageDamage(Handle:plugin, numParams) +public int Native_SetBossRageDamage(Handle plugin, int numParams) { SetBossRageDamage(GetNativeCell(1), GetNativeCell(2)); } -public Native_SetSoundFlags(Handle:plugin, numParams) +public int Native_SetSoundFlags(Handle plugin, int numParams) { SetSoundFlags(GetNativeCell(1), GetNativeCell(2)); } -public Native_ClearSoundFlags(Handle:plugin, numParams) +public int Native_ClearSoundFlags(Handle plugin, int numParams) { ClearSoundFlags(GetNativeCell(1), GetNativeCell(2)); } -public Native_CheckSoundFlags(Handle:plugin, numParams) +public int Native_CheckSoundFlags(Handle plugin, int numParams) { return CheckSoundFlags(GetNativeCell(1), GetNativeCell(2)); } -public GetBossRageDistance(boss, const String:pluginName[], const String:abilityName[]) +public int GetBossRageDistance(int boss, const char[] pluginName, const char[] abilityName) { if(!GetArrayCell(bossesArrayShadow, character[boss])) //Invalid boss { @@ -7769,10 +7776,10 @@ public GetBossRageDistance(boss, const String:pluginName[], const String:ability if(HasAbility(boss, pluginName, abilityName)) { - decl String:key[128]; + char key[128]; Format(key, sizeof(key), "%s > %s > distance", pluginName, abilityName); - new distance; + int distance; if((distance=ParseFormula(boss, key, -1))<0) //Distance doesn't exist, return the global rage distance instead { KvRewind(GetArrayCell(bossesArrayShadow, character[boss])); @@ -7783,42 +7790,42 @@ public GetBossRageDistance(boss, const String:pluginName[], const String:ability return 0; } -public Native_GetBossRageDistance(Handle:plugin, numParams) +public int Native_GetBossRageDistance(Handle plugin, int numParams) { - decl String:pluginName[64], String:abilityName[64]; + char pluginName[64], abilityName[64]; GetNativeString(2, pluginName, sizeof(pluginName)); GetNativeString(3, abilityName, sizeof(abilityName)); return GetBossRageDistance(GetNativeCell(1), pluginName, abilityName); } -public GetClientDamage(client) +public int GetClientDamage(int client) { return Damage[client]; } -public Native_GetClientDamage(Handle:plugin, numParams) +public int Native_GetClientDamage(Handle plugin, int numParams) { return GetClientDamage(GetNativeCell(1)); } -public SetClientDamage(client, damage) +public int SetClientDamage(int client, int damage) { Damage[client]=damage; } -public Native_SetClientDamage(Handle:plugin, numParams) +public int Native_SetClientDamage(Handle plugin, int numParams) { SetClientDamage(GetNativeCell(1), GetNativeCell(2)); } -public bool:HasAbility(boss, const String:pluginName[], const String:abilityName[]) +public bool HasAbility(int boss, const char[] pluginName, const char[] abilityName) { if(boss==-1 || character[boss]==-1 || !GetArrayCell(bossesArrayShadow, character[boss])) //Invalid boss { return false; } - new Handle:kv=GetArrayCell(bossesArrayShadow, character[boss]); + Handle kv=GetArrayCell(bossesArrayShadow, character[boss]); KvRewind(kv); if(KvJumpToKey(kv, "abilities") && KvJumpToKey(kv, pluginName) && KvJumpToKey(kv, abilityName)) { @@ -7827,63 +7834,63 @@ public bool:HasAbility(boss, const String:pluginName[], const String:abilityName return false; } -public Native_HasAbility(Handle:plugin, numParams) +public int Native_HasAbility(Handle plugin, int numParams) { - decl String:pluginName[64], String:abilityName[64]; + char pluginName[64], abilityName[64]; GetNativeString(2, pluginName, sizeof(pluginName)); GetNativeString(3, abilityName, sizeof(abilityName)); return HasAbility(GetNativeCell(1), pluginName, abilityName); } -public GetAbilityArgumentWrapper(boss, const String:pluginName[], const String:abilityName[], const String:argument[], defaultValue) +public int GetAbilityArgumentWrapper(int boss, const char[] pluginName, const char[] abilityName, const char[] argument, int defaultValue) { return GetAbilityArgument(boss, pluginName, abilityName, argument, defaultValue); } -public Native_GetAbilityArgument(Handle:plugin, numParams) +public int Native_GetAbilityArgument(Handle plugin, int numParams) { - decl String:pluginName[64], String:abilityName[64], String:argument[64]; + char pluginName[64], abilityName[64], argument[64]; GetNativeString(2, pluginName, sizeof(pluginName)); GetNativeString(3, abilityName, sizeof(abilityName)); GetNativeString(4, argument, sizeof(argument)); return GetAbilityArgumentWrapper(GetNativeCell(1), pluginName, abilityName, argument, GetNativeCell(5)); } -public Float:GetAbilityArgumentFloatWrapper(boss, const String:pluginName[], const String:abilityName[], const String:argument[], Float:defaultValue) +public float GetAbilityArgumentFloatWrapper(int boss, const char[] pluginName, const char[] abilityName, const char[] argument, float defaultValue) { return GetAbilityArgumentFloat(boss, pluginName, abilityName, argument, defaultValue); } -public Native_GetAbilityArgumentFloat(Handle:plugin, numParams) +public int Native_GetAbilityArgumentFloat(Handle plugin, int numParams) { - decl String:pluginName[64], String:abilityName[64], String:argument[64]; + char pluginName[64], abilityName[64], argument[64]; GetNativeString(2, pluginName, sizeof(pluginName)); GetNativeString(3, abilityName, sizeof(abilityName)); GetNativeString(4, argument, sizeof(argument)); - return _:GetAbilityArgumentFloatWrapper(GetNativeCell(1), pluginName, abilityName, argument, Float:GetNativeCell(5)); + return view_as(GetAbilityArgumentFloatWrapper(GetNativeCell(1), pluginName, abilityName, argument, view_as(GetNativeCell(5)))); } -public GetAbilityArgumentStringWrapper(boss, const String:pluginName[], const String:abilityName[], const String:argument[], String:abilityString[], length, const String:defaultValue[]) +public int GetAbilityArgumentStringWrapper(int boss, const char[] pluginName, const char[] abilityName, const char[] argument, char[] abilityString, int length, const char[] defaultValue) { GetAbilityArgumentString(boss, pluginName, abilityName, argument, abilityString, length, defaultValue); } -public Native_GetAbilityArgumentString(Handle:plugin, numParams) +public int Native_GetAbilityArgumentString(Handle plugin, int numParams) { - decl String:pluginName[64], String:abilityName[64], String:defaultValue[64], String:argument[64]; + char pluginName[64], abilityName[64], defaultValue[64], argument[64]; GetNativeString(2, pluginName, sizeof(pluginName)); GetNativeString(3, abilityName, sizeof(abilityName)); GetNativeString(4, argument, sizeof(argument)); GetNativeString(7, defaultValue, sizeof(defaultValue)); - new length=GetNativeCell(6); - decl String:abilityString[length]; + int length=GetNativeCell(6); + char[] abilityString=new char[length]; GetAbilityArgumentStringWrapper(GetNativeCell(1), pluginName, abilityName, argument, abilityString, length, defaultValue); SetNativeString(5, abilityString, length); } -bool:UseAbility(boss, const String:pluginName[], const String:abilityName[], slot, buttonMode=0) +bool UseAbility(int boss, const char[] pluginName, const char[] abilityName, int slot, int buttonMode=0) { - new Action:action; + Action action; Call_StartForward(PreAbility); Call_PushCell(boss); Call_PushString(pluginName); @@ -7916,7 +7923,7 @@ bool:UseAbility(boss, const String:pluginName[], const String:abilityName[], slo else { SetHudTextParams(-1.0, 0.88, 0.15, 255, 255, 255, 255); - new button; + int button; switch(buttonMode) { case 2: @@ -7933,7 +7940,7 @@ bool:UseAbility(boss, const String:pluginName[], const String:abilityName[], slo if(GetClientButtons(Boss[boss]) & button) { - for(new timer; timer<=1; timer++) + for(int timer; timer<=1; timer++) { if(BossInfoTimer[boss][timer]!=INVALID_HANDLE) { @@ -7946,7 +7953,7 @@ bool:UseAbility(boss, const String:pluginName[], const String:abilityName[], slo { Call_PushCell(2); //Ready Call_Finish(); - new Float:charge=100.0*0.2/GetAbilityArgumentFloat(boss, pluginName, abilityName, "charge", 1.5); + float charge=100.0*0.2/GetAbilityArgumentFloat(boss, pluginName, abilityName, "charge", 1.5); if(BossCharge[boss][slot]+charge<100.0) { BossCharge[boss][slot]+=charge; @@ -7965,13 +7972,13 @@ bool:UseAbility(boss, const String:pluginName[], const String:abilityName[], slo } else if(BossCharge[boss][slot]>0.3) { - new Float:angles[3]; + float angles[3]; GetClientEyeAngles(Boss[boss], angles); if(angles[0]<-45.0) { Call_PushCell(3); //In use Call_Finish(); - new Handle:data; + Handle data; CreateDataTimer(0.1, Timer_UseBossCharge, data); WritePackCell(data, boss); WritePackCell(data, slot); @@ -8000,77 +8007,77 @@ bool:UseAbility(boss, const String:pluginName[], const String:abilityName[], slo return true; } -public Native_UseAbility(Handle:plugin, numParams) +public int Native_UseAbility(Handle plugin, int numParams) { - decl String:pluginName[64], String:abilityName[64]; + char pluginName[64], abilityName[64]; GetNativeString(2, pluginName, sizeof(pluginName)); GetNativeString(3, abilityName, sizeof(abilityName)); UseAbility(GetNativeCell(1), pluginName, abilityName, GetNativeCell(4), GetNativeCell(5)); } -public GetFF2Flags(client) +public int GetFF2Flags(int client) { return FF2Flags[client]; } -public Native_GetFF2Flags(Handle:plugin, numParams) +public int Native_GetFF2Flags(Handle plugin, int numParams) { return GetFF2Flags(GetNativeCell(1)); } -public SetFF2Flags(client, flags) +public int SetFF2Flags(int client, int flags) { FF2Flags[client]=flags; } -public Native_SetFF2Flags(Handle:plugin, numParams) +public int Native_SetFF2Flags(Handle plugin, int numParams) { SetFF2Flags(GetNativeCell(1), GetNativeCell(2)); } -public Native_GetQueuePoints(Handle:plugin, numParams) +public int Native_GetQueuePoints(Handle plugin, int numParams) { return GetClientQueuePoints(GetNativeCell(1)); } -public Native_SetQueuePoints(Handle:plugin, numParams) +public int Native_SetQueuePoints(Handle plugin, int numParams) { SetClientQueuePoints(GetNativeCell(1), GetNativeCell(2)); } -public Native_StartMusic(Handle:plugin, numParams) +public int Native_StartMusic(Handle plugin, int numParams) { StartMusic(GetNativeCell(1)); } -public Native_StopMusic(Handle:plugin, numParams) +public int Native_StopMusic(Handle plugin, int numParams) { StopMusic(GetNativeCell(1)); } -public Native_FindSound(Handle:plugin, numParams) +public int Native_FindSound(Handle plugin, int numParams) { - decl String:kv[64]; + char kv[64]; GetNativeString(1, kv, sizeof(kv)); - new length=GetNativeCell(3); - decl String:sound[length]; - new bool:soundExists=FindSound(kv, sound, length, GetNativeCell(4), bool:GetNativeCell(5), GetNativeCell(6)); + int length=GetNativeCell(3); + char[] sound=new char[length]; + bool soundExists=FindSound(kv, sound, length, GetNativeCell(4), view_as(GetNativeCell(5)), GetNativeCell(6)); SetNativeString(2, sound, length); return soundExists; } -public Float:GetClientGlow(client) +public float GetClientGlow(int client) { return GlowTimer[client]; } -public Native_GetClientGlow(Handle:plugin, numParams) +public int Native_GetClientGlow(Handle plugin, int numParams) { - return _:GetClientGlow(GetNativeCell(1)); + return view_as(GetClientGlow(GetNativeCell(1))); } -SetClientGlow(client, Float:time1, Float:time2=-1.0) +void SetClientGlow(int client, float time1, float time2=-1.0) { if(IsValidClient(client)) { @@ -8092,17 +8099,17 @@ SetClientGlow(client, Float:time1, Float:time2=-1.0) } } -public Native_SetClientGlow(Handle:plugin, numParams) +public int Native_SetClientGlow(Handle plugin, int numParams) { SetClientGlow(GetNativeCell(1), GetNativeCell(2), GetNativeCell(3)); } -public Native_Debug(Handle:plugin, numParams) +public int Native_Debug(Handle plugin, int numParams) { return GetConVarBool(cvarDebug); } -public OnEntityCreated(entity, const String:classname[]) +public void OnEntityCreated(int entity, const char[] classname) { if(GetConVarBool(cvarHealthBar)) { @@ -8128,7 +8135,7 @@ public OnEntityCreated(entity, const String:classname[]) } } -public OnEntityDestroyed(entity) +public void OnEntityDestroyed(int entity) { if(entity==g_Monoculus) { @@ -8140,23 +8147,23 @@ public OnEntityDestroyed(entity) } } -public Action:Spawn_Koth(entity) +public Action Spawn_Koth(int entity) { DispatchSpawn(CreateEntityByName("tf_logic_arena")); return Plugin_Stop; //Stop koth logic from being created } -public OnItemSpawned(entity) +public void OnItemSpawned(int entity) { SDKHook(entity, SDKHook_StartTouch, OnPickup); SDKHook(entity, SDKHook_Touch, OnPickup); } -public Action:OnPickup(entity, client) //Thanks friagram! +public Action OnPickup(int entity, int client) //Thanks friagram! { if(IsBoss(client)) { - decl String:classname[32]; + char classname[32]; GetEntityClassname(entity, classname, sizeof(classname)); if(!StrContains(classname, "item_healthkit") && !(FF2Flags[client] & FF2FLAG_ALLOW_HEALTH_PICKUPS)) { @@ -8170,7 +8177,7 @@ public Action:OnPickup(entity, client) //Thanks friagram! return Plugin_Continue; } -public FF2RoundState:CheckRoundState() +public FF2RoundState CheckRoundState() { switch(GameRules_GetRoundState()) { @@ -8194,7 +8201,7 @@ public FF2RoundState:CheckRoundState() return FF2RoundState_Loading; //Compiler bug-doesn't recognize 'default' as a valid catch-all } -FindHealthBar() +void FindHealthBar() { healthBar=FindEntityByClassname(-1, HEALTHBAR_CLASS); if(!IsValidEntity(healthBar)) @@ -8203,7 +8210,7 @@ FindHealthBar() } } -public HealthbarEnableChanged(Handle:convar, const String:oldValue[], const String:newValue[]) +public void HealthbarEnableChanged(Handle convar, const char[] oldValue, const char[] newValue) { if(Enabled && GetConVarBool(cvarHealthBar) && IsValidEntity(healthBar)) { @@ -8215,15 +8222,15 @@ public HealthbarEnableChanged(Handle:convar, const String:oldValue[], const Stri } } -UpdateHealthBar() +void UpdateHealthBar() { if(!Enabled || !GetConVarBool(cvarHealthBar) || IsValidEntity(g_Monoculus) || !IsValidEntity(healthBar) || CheckRoundState()==FF2RoundState_Loading) { return; } - new healthAmount, maxHealthAmount, bosses, healthPercent; - for(new boss; boss<=MaxClients; boss++) + int healthAmount, maxHealthAmount, bosses, healthPercent; + for(int boss; boss<=MaxClients; boss++) { if(IsValidClient(Boss[boss]) && IsPlayerAlive(Boss[boss])) { From 8d698b1f28d9abeb7b95ef8fda308125cb14e159 Mon Sep 17 00:00:00 2001 From: naydef Date: Wed, 4 Oct 2017 15:15:43 +0300 Subject: [PATCH 04/12] Convert subplugins to new syntax --- .../freak_fortress_2/default_abilities.sp | 204 ++++++------- .../freak_fortress_2/easter_abilities.sp | 64 +++-- .../freak_fortress_2/ff2_1st_set_abilities.sp | 269 +++++++++--------- .../freak_fortress_2/rage_overlay.sp | 24 +- .../freak_fortress_2/special_noanims.sp | 50 ++-- 5 files changed, 311 insertions(+), 300 deletions(-) diff --git a/addons/sourcemod/scripting/freak_fortress_2/default_abilities.sp b/addons/sourcemod/scripting/freak_fortress_2/default_abilities.sp index b4740980..325dd6ff 100644 --- a/addons/sourcemod/scripting/freak_fortress_2/default_abilities.sp +++ b/addons/sourcemod/scripting/freak_fortress_2/default_abilities.sp @@ -7,10 +7,12 @@ #include #include +#pragma newdecls required + #define PLUGIN_NAME "default abilities" #define PLUGIN_VERSION "2.0.0" -public Plugin:myinfo= +public Plugin myinfo= { name="Freak Fortress 2: Default Abilities", author="RainBolt Dash", @@ -18,25 +20,25 @@ public Plugin:myinfo= version=PLUGIN_VERSION, }; -new Handle:OnSuperJump; -new Handle:OnRage; -new Handle:OnWeighdown; +Handle OnSuperJump; +Handle OnRage; +Handle OnWeighdown; -new Handle:gravityDatapack[MAXPLAYERS+1]; +Handle gravityDatapack[MAXPLAYERS+1]; -new Handle:jumpHUD; +Handle jumpHUD; -new bool:enableSuperDuperJump[MAXPLAYERS+1]; -new Float:UberRageCount[MAXPLAYERS+1]; -new TFTeam:BossTeam=TFTeam_Blue; +bool enableSuperDuperJump[MAXPLAYERS+1]; +float UberRageCount[MAXPLAYERS+1]; +TFTeam BossTeam=TFTeam_Blue; -new Handle:cvarOldJump; -new Handle:cvarBaseJumperStun; +Handle cvarOldJump; +Handle cvarBaseJumperStun; -new bool:oldJump; -new bool:removeBaseJumperOnStun; +bool oldJump; +bool removeBaseJumperOnStun; -public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max) +public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) { OnSuperJump=CreateGlobalForward("FF2_OnSuperJump", ET_Hook, Param_Cell, Param_CellByRef); //Boss, super duper jump OnRage=CreateGlobalForward("FF2_OnRage", ET_Hook, Param_Cell, Param_CellByRef); //Boss, distance @@ -44,7 +46,7 @@ public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max) return APLRes_Success; } -public OnPluginStart() +public void OnPluginStart() { cvarOldJump=CreateConVar("ff2_oldjump", "0", "Use old VSH jump equations", _, true, 0.0, true, 1.0); cvarBaseJumperStun=CreateConVar("ff2_base_jumper_stun", "0", "Whether or not the Base Jumper should be disabled when a player gets stunned", _, true, 0.0, true, 1.0); @@ -65,29 +67,29 @@ public OnPluginStart() FF2_RegisterSubplugin(PLUGIN_NAME); } -public OnConfigsExecuted() +public void OnConfigsExecuted() { oldJump=GetConVarBool(cvarOldJump); removeBaseJumperOnStun=GetConVarBool(cvarBaseJumperStun); } -public CvarChange(Handle:convar, const String:oldValue[], const String:newValue[]) +public void CvarChange(Handle convar, const char[] oldValue, const char[] newValue) { if(convar==cvarOldJump) { - oldJump=bool:StringToInt(newValue); + oldJump=view_as(StringToInt(newValue)); } else if(convar==cvarBaseJumperStun) { - removeBaseJumperOnStun=bool:StringToInt(newValue); + removeBaseJumperOnStun=view_as(StringToInt(newValue)); } } -public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast) +public Action OnRoundStart(Handle event, const char[] name, bool dontBroadcast) { if(FF2_IsFF2Enabled()) { - for(new client; clientMaxClients) { SetEntProp(sentry, Prop_Send, "m_bDisabled", 0); @@ -273,11 +275,11 @@ public Action:Timer_EnableSentry(Handle:timer, any:sentryid) return Plugin_Continue; } -Charge_BraveJump(const String:abilityName[], boss, slot, status) +void Charge_BraveJump(const char[] abilityName, int boss, int slot, int status) { - new client=GetClientOfUserId(FF2_GetBossUserId(boss)); - new Float:charge=FF2_GetBossCharge(boss, slot); - new Float:multiplier=FF2_GetAbilityArgumentFloat(boss, PLUGIN_NAME, abilityName, "multiplier", 1.0); + int client=GetClientOfUserId(FF2_GetBossUserId(boss)); + float charge=FF2_GetBossCharge(boss, slot); + float multiplier=FF2_GetAbilityArgumentFloat(boss, PLUGIN_NAME, abilityName, "multiplier", 1.0); switch(status) { @@ -301,8 +303,8 @@ Charge_BraveJump(const String:abilityName[], boss, slot, status) } case 3: { - new bool:superJump=enableSuperDuperJump[boss]; - new Action:action; + bool superJump=enableSuperDuperJump[boss]; + Action action; Call_StartForward(OnSuperJump); Call_PushCell(boss); Call_PushCellRef(superJump); @@ -316,7 +318,7 @@ Charge_BraveJump(const String:abilityName[], boss, slot, status) enableSuperDuperJump[client]=superJump; } - new Float:position[3], Float:velocity[3]; + float position[3], velocity[3]; GetEntPropVector(client, Prop_Send, "m_vecOrigin", position); GetEntPropVector(client, Prop_Data, "m_vecVelocity", velocity); @@ -337,7 +339,7 @@ Charge_BraveJump(const String:abilityName[], boss, slot, status) } else { - new Float:angles[3]; + float angles[3]; GetClientEyeAngles(client, angles); if(enableSuperDuperJump[boss]) { @@ -355,7 +357,7 @@ Charge_BraveJump(const String:abilityName[], boss, slot, status) } TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, velocity); - decl String:sound[PLATFORM_MAX_PATH]; + char sound[PLATFORM_MAX_PATH]; if(FF2_FindSound("ability", sound, sizeof(sound), boss, true, slot)) { if(FF2_CheckSoundFlags(client, FF2SOUND_MUTEVOICE)) @@ -364,7 +366,7 @@ Charge_BraveJump(const String:abilityName[], boss, slot, status) EmitSoundToAll(sound, client, _, _, _, _, _, client, position); } - for(new target=1; target<=MaxClients; target++) + for(int target=1; target<=MaxClients; target++) { if(IsClientInGame(target) && target!=client && FF2_CheckSoundFlags(target, FF2SOUND_MUTEVOICE)) { @@ -377,10 +379,10 @@ Charge_BraveJump(const String:abilityName[], boss, slot, status) } } -Charge_Teleport(const String:abilityName[], boss, slot, status) +void Charge_Teleport(const char[] abilityName, int boss, int slot, int status) { - new client=GetClientOfUserId(FF2_GetBossUserId(boss)); - new Float:charge=FF2_GetBossCharge(boss, slot); + int client=GetClientOfUserId(FF2_GetBossUserId(boss)); + float charge=FF2_GetBossCharge(boss, slot); switch(status) { case 1: @@ -395,8 +397,8 @@ Charge_Teleport(const String:abilityName[], boss, slot, status) } case 3: { - new Action:action; - new bool:superJump=enableSuperDuperJump[boss]; + Action action; + bool superJump=enableSuperDuperJump[boss]; Call_StartForward(OnSuperJump); Call_PushCell(boss); Call_PushCellRef(superJump); @@ -420,9 +422,9 @@ Charge_Teleport(const String:abilityName[], boss, slot, status) return; } - new tries; - new bool:otherTeamIsAlive; - for(new target=1; target<=MaxClients; target++) + int tries; + bool otherTeamIsAlive; + for(int target=1; target<=MaxClients; target++) { if(IsClientInGame(target) && IsPlayerAlive(target) && target!=client && !(FF2_GetFF2Flags(target) & FF2FLAG_ALLOWSPAWNINBOSSTEAM)) { @@ -431,7 +433,7 @@ Charge_Teleport(const String:abilityName[], boss, slot, status) } } - new target; + int target; do { tries++; @@ -443,7 +445,7 @@ Charge_Teleport(const String:abilityName[], boss, slot, status) } while(otherTeamIsAlive && (!IsValidEntity(target) || target==client || (FF2_GetFF2Flags(target) & FF2FLAG_ALLOWSPAWNINBOSSTEAM) || !IsPlayerAlive(target))); - decl String:particle[PLATFORM_MAX_PATH]; + char particle[PLATFORM_MAX_PATH]; FF2_GetAbilityArgumentString(boss, PLUGIN_NAME, abilityName, "particle", particle, sizeof(particle)); if(strlen(particle)>0) { @@ -451,7 +453,7 @@ Charge_Teleport(const String:abilityName[], boss, slot, status) CreateTimer(3.0, RemoveEntity, EntIndexToEntRef(AttachParticle(client, particle, _, false)), TIMER_FLAG_NO_MAPCHANGE); } - new Float:position[3]; + float position[3]; GetEntPropVector(target, Prop_Data, "m_vecOrigin", position); if(IsValidEntity(target)) { @@ -459,7 +461,7 @@ Charge_Teleport(const String:abilityName[], boss, slot, status) SetEntPropFloat(client, Prop_Send, "m_flNextAttack", GetGameTime() + (enableSuperDuperJump ? 4.0:2.0)); if(GetEntProp(target, Prop_Send, "m_bDucked")) { - new Float:temp[3]={24.0, 24.0, 62.0}; //Compiler won't accept directly putting it into SEPV -.- + float temp[3]={24.0, 24.0, 62.0}; //Compiler won't accept directly putting it into SEPV -.- SetEntPropVector(client, Prop_Send, "m_vecMaxs", temp); SetEntProp(client, Prop_Send, "m_bDucked", 1); SetEntityFlags(client, GetEntityFlags(client)|FL_DUCKING); @@ -478,7 +480,7 @@ Charge_Teleport(const String:abilityName[], boss, slot, status) } } - decl String:sound[PLATFORM_MAX_PATH]; + char sound[PLATFORM_MAX_PATH]; if(FF2_FindSound("ability", sound, sizeof(sound), boss, true, slot)) { if(FF2_CheckSoundFlags(client, FF2SOUND_MUTEVOICE)) @@ -487,7 +489,7 @@ Charge_Teleport(const String:abilityName[], boss, slot, status) EmitSoundToAll(sound, client, _, _, _, _, _, client, position); } - for(new enemy=1; enemy<=MaxClients; enemy++) + for(int enemy=1; enemy<=MaxClients; enemy++) { if(IsClientInGame(enemy) && enemy!=client && FF2_CheckSoundFlags(enemy, FF2SOUND_MUTEVOICE)) { @@ -500,16 +502,16 @@ Charge_Teleport(const String:abilityName[], boss, slot, status) } } -public Action:Timer_ResetCharge(Handle:timer, any:boss) //FIXME: What. +public Action Timer_ResetCharge(Handle timer, int boss) //FIXME: What. { - new slot=boss%10000; + int slot=boss%10000; boss/=1000; FF2_SetBossCharge(boss, slot, 0.0); } -public Action:Timer_StunBoss(Handle:timer, any:boss) +public Action Timer_StunBoss(Handle timer, int boss) { - new client=GetClientOfUserId(FF2_GetBossUserId(boss)); + int client=GetClientOfUserId(FF2_GetBossUserId(boss)); if(!IsValidEntity(client)) { return; @@ -517,24 +519,24 @@ public Action:Timer_StunBoss(Handle:timer, any:boss) TF2_StunPlayer(client, (enableSuperDuperJump[boss] ? 4.0 : 2.0), 0.0, TF_STUNFLAGS_GHOSTSCARE|TF_STUNFLAG_NOSOUNDOREFFECT, client); } -Charge_WeighDown(boss, slot) //TODO: Create a HUD for this +void Charge_WeighDown(int boss, int slot) //TODO: Create a HUD for this { - new client=GetClientOfUserId(FF2_GetBossUserId(boss)); + int client=GetClientOfUserId(FF2_GetBossUserId(boss)); if(client<=0 || !(GetClientButtons(client) & IN_DUCK)) { return; } - new Float:charge=FF2_GetBossCharge(boss, slot)+0.2; + float charge=FF2_GetBossCharge(boss, slot)+0.2; if(!(GetEntityFlags(client) & FL_ONGROUND)) { if(charge>=4.0) { - new Float:angles[3]; + float angles[3]; GetClientEyeAngles(client, angles); if(angles[0]>60.0) { - new Action:action; + Action action; Call_StartForward(OnWeighdown); Call_PushCell(boss); Call_Finish(action); @@ -543,8 +545,8 @@ Charge_WeighDown(boss, slot) //TODO: Create a HUD for this return; } - new Handle:data; - new Float:velocity[3]; + Handle data; + float velocity[3]; if(gravityDatapack[client]==INVALID_HANDLE) { gravityDatapack[client]=CreateDataTimer(2.0, Timer_ResetGravity, data, TIMER_FLAG_NO_MAPCHANGE); @@ -572,9 +574,9 @@ Charge_WeighDown(boss, slot) //TODO: Create a HUD for this } } -public Action:Timer_ResetGravity(Handle:timer, Handle:data) +public Action Timer_ResetGravity(Handle timer, Handle data) { - new client=GetClientOfUserId(ReadPackCell(data)); + int client=GetClientOfUserId(ReadPackCell(data)); if(client && IsValidEntity(client) && IsClientInGame(client)) { SetEntityGravity(client, ReadPackFloat(data)); @@ -583,9 +585,9 @@ public Action:Timer_ResetGravity(Handle:timer, Handle:data) return Plugin_Continue; } -public Action:OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) +public Action OnPlayerDeath(Handle event, const char[] name, bool dontBroadcast) { - new boss=FF2_GetBossIndex(GetClientOfUserId(GetEventInt(event, "attacker"))); + int boss=FF2_GetBossIndex(GetClientOfUserId(GetEventInt(event, "attacker"))); if(boss!=-1 && FF2_HasAbility(boss, PLUGIN_NAME, "special_dissolve")) { CreateTimer(0.1, Timer_DissolveRagdoll, GetEventInt(event, "userid"), TIMER_FLAG_NO_MAPCHANGE); @@ -593,10 +595,10 @@ public Action:OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcas return Plugin_Continue; } -public Action:Timer_DissolveRagdoll(Handle:timer, any:userid) +public Action Timer_DissolveRagdoll(Handle timer, int userid) { - new client=GetClientOfUserId(userid); - new ragdoll=-1; + int client=GetClientOfUserId(userid); + int ragdoll=-1; if(client && IsClientInGame(client)) { ragdoll=GetEntPropEnt(client, Prop_Send, "m_hRagdoll"); @@ -608,9 +610,9 @@ public Action:Timer_DissolveRagdoll(Handle:timer, any:userid) } } -DissolveRagdoll(ragdoll) +int DissolveRagdoll(int ragdoll) { - new dissolver=CreateEntityByName("env_entity_dissolver"); + int dissolver=CreateEntityByName("env_entity_dissolver"); if(dissolver==-1) { return; @@ -624,21 +626,21 @@ DissolveRagdoll(ragdoll) AcceptEntityInput(dissolver, "Kill"); } -public Action:RemoveEntity(Handle:timer, any:entid) +public Action RemoveEntity(Handle timer, any entid) { - new entity=EntRefToEntIndex(entid); + int entity=EntRefToEntIndex(entid); if(IsValidEntity(entity) && entity>MaxClients) { AcceptEntityInput(entity, "Kill"); } } -stock AttachParticle(entity, String:particleType[], Float:offset=0.0, bool:attach=true) +stock int AttachParticle(int entity, char[] particleType, float offset=0.0, bool attach=true) { - new particle=CreateEntityByName("info_particle_system"); + int particle=CreateEntityByName("info_particle_system"); - decl String:targetName[128]; - new Float:position[3]; + char targetName[128]; + float position[3]; GetEntPropVector(entity, Prop_Send, "m_vecOrigin", position); position[2]+=offset; TeleportEntity(particle, position, NULL_VECTOR, NULL_VECTOR); @@ -661,9 +663,9 @@ stock AttachParticle(entity, String:particleType[], Float:offset=0.0, bool:attac return particle; } -public Action:OnDeflect(Handle:event, const String:name[], bool:dontBroadcast) +public Action OnDeflect(Handle event, const char[] name, bool dontBroadcast) { - new boss=FF2_GetBossIndex(GetClientOfUserId(GetEventInt(event, "userid"))); + int boss=FF2_GetBossIndex(GetClientOfUserId(GetEventInt(event, "userid"))); if(boss!=-1) { if(UberRageCount[boss]>11) @@ -674,7 +676,7 @@ public Action:OnDeflect(Handle:event, const String:name[], bool:dontBroadcast) return Plugin_Continue; } -public Action:FF2_OnTriggerHurt(boss, triggerhurt, &Float:damage) +public Action FF2_OnTriggerHurt(int boss, int triggerhurt, float& damage) { enableSuperDuperJump[boss]=true; if(FF2_GetBossCharge(boss, 1)<0) diff --git a/addons/sourcemod/scripting/freak_fortress_2/easter_abilities.sp b/addons/sourcemod/scripting/freak_fortress_2/easter_abilities.sp index 61c9664c..8f23253e 100644 --- a/addons/sourcemod/scripting/freak_fortress_2/easter_abilities.sp +++ b/addons/sourcemod/scripting/freak_fortress_2/easter_abilities.sp @@ -6,6 +6,8 @@ #include #include +#pragma newdecls required + #define PROJECTILE "replace projectile model" #define OBJECTS "spawn many objects on kill" #define OBJECTS_DEATH "spawn many objects on death" @@ -13,7 +15,7 @@ #define PLUGIN_NAME "easter abilities" #define PLUGIN_VERSION "2.0.0" -public Plugin:myinfo= +public Plugin myinfo= { name="Freak Fortress 2: Easter Abilities", author="Powerlord and FlaminSarge, updated by Wliu", @@ -21,7 +23,7 @@ public Plugin:myinfo= version=PLUGIN_VERSION, }; -public OnPluginStart() +public void OnPluginStart() { HookEvent("player_death", OnPlayerDeath); PrecacheSound("items/pumpkin_pickup.wav"); @@ -29,41 +31,41 @@ public OnPluginStart() FF2_RegisterSubplugin(PLUGIN_NAME); } -/*public Action:FF2_OnBossSelected(boss, &special, String:specialName[]) //Re-enable in v2 or whenever the late-loading forward bug is fixed +/*public Action FF2_OnBossSelected(int boss, int& special, char[] specialName) //Re-enable in v2 or whenever the late-loading forward bug is fixed { if(FF2_HasAbility(boss, PLUGIN_NAME, OBJECTS)) { - decl String:model[PLATFORM_MAX_PATH]; + char model[PLATFORM_MAX_PATH]; FF2_GetAbilityArgumentString(boss, PLUGIN_NAME, OBJECTS, "model", model, sizeof(model)); PrecacheModel(model); } else if(FF2_HasAbility(boss, PLUGIN_NAME, OBJECTS_DEATH)) { - decl String:model[PLATFORM_MAX_PATH]; + char model[PLATFORM_MAX_PATH]; FF2_GetAbilityArgumentString(boss, PLUGIN_NAME, OBJECTS_DEATH, "model", model, sizeof(model)); PrecacheModel(model); } return Plugin_Continue; }*/ -public OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) +public void OnPlayerDeath(Handle event, const char[] name, bool dontBroadcast) { - new client=GetClientOfUserId(GetEventInt(event, "userid")); - new attacker=GetClientOfUserId(GetEventInt(event, "attacker")); + int client=GetClientOfUserId(GetEventInt(event, "userid")); + int attacker=GetClientOfUserId(GetEventInt(event, "attacker")); if(!client || !attacker || !IsClientInGame(client) || !IsClientInGame(attacker)) { return; } - new boss=FF2_GetBossIndex(attacker); + int boss=FF2_GetBossIndex(attacker); if(boss!=-1 && FF2_HasAbility(boss, PLUGIN_NAME, OBJECTS)) { - decl String:classname[PLATFORM_MAX_PATH], String:model[PLATFORM_MAX_PATH]; + char classname[PLATFORM_MAX_PATH], model[PLATFORM_MAX_PATH]; FF2_GetAbilityArgumentString(boss, PLUGIN_NAME, OBJECTS, "classname", classname, sizeof(classname)); FF2_GetAbilityArgumentString(boss, PLUGIN_NAME, OBJECTS, "model", model, sizeof(model)); - new skin=FF2_GetAbilityArgument(boss, PLUGIN_NAME, OBJECTS, "skin"); - new count=FF2_GetAbilityArgument(boss, PLUGIN_NAME, OBJECTS, "count", 14); - new Float:distance=FF2_GetAbilityArgumentFloat(boss, PLUGIN_NAME, OBJECTS, "distance", 30.0); + int skin=FF2_GetAbilityArgument(boss, PLUGIN_NAME, OBJECTS, "skin"); + int count=FF2_GetAbilityArgument(boss, PLUGIN_NAME, OBJECTS, "count", 14); + float distance=FF2_GetAbilityArgumentFloat(boss, PLUGIN_NAME, OBJECTS, "distance", 30.0); SpawnManyObjects(classname, client, model, skin, count, distance); return; } @@ -71,18 +73,18 @@ public OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) boss=FF2_GetBossIndex(client); if(boss!=-1 && FF2_HasAbility(boss, PLUGIN_NAME, OBJECTS_DEATH)) { - decl String:classname[PLATFORM_MAX_PATH], String:model[PLATFORM_MAX_PATH]; + char classname[PLATFORM_MAX_PATH], model[PLATFORM_MAX_PATH]; FF2_GetAbilityArgumentString(boss, PLUGIN_NAME, OBJECTS_DEATH, "classname", classname, sizeof(classname)); FF2_GetAbilityArgumentString(boss, PLUGIN_NAME, OBJECTS_DEATH, "model", model, sizeof(model)); - new skin=FF2_GetAbilityArgument(boss, PLUGIN_NAME, OBJECTS_DEATH, "skin"); - new count=FF2_GetAbilityArgument(boss, PLUGIN_NAME, OBJECTS_DEATH, "count", 14); - new Float:distance=FF2_GetAbilityArgumentFloat(boss, PLUGIN_NAME, OBJECTS_DEATH, "distance", 30.0); + int skin=FF2_GetAbilityArgument(boss, PLUGIN_NAME, OBJECTS_DEATH, "skin"); + int count=FF2_GetAbilityArgument(boss, PLUGIN_NAME, OBJECTS_DEATH, "count", 14); + float distance=FF2_GetAbilityArgumentFloat(boss, PLUGIN_NAME, OBJECTS_DEATH, "distance", 30.0); SpawnManyObjects(classname, client, model, skin, count, distance); return; } } -public OnEntityCreated(entity, const String:classname[]) +public void OnEntityCreated(int entity, const char[] classname) { if(FF2_IsFF2Enabled() && IsValidEntity(entity) && StrContains(classname, "tf_projectile")>=0) { @@ -90,22 +92,22 @@ public OnEntityCreated(entity, const String:classname[]) } } -public OnProjectileSpawned(entity) +public void OnProjectileSpawned(int entity) { - new client=GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity"); + int client=GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity"); if(client>0 && client<=MaxClients && IsClientInGame(client)) { - new boss=FF2_GetBossIndex(client); + int boss=FF2_GetBossIndex(client); if(boss>=0 && FF2_HasAbility(boss, PLUGIN_NAME, PROJECTILE)) { - decl String:projectile[PLATFORM_MAX_PATH]; + char projectile[PLATFORM_MAX_PATH]; FF2_GetAbilityArgumentString(boss, PLUGIN_NAME, PROJECTILE, "classname", projectile, sizeof(projectile)); - decl String:classname[PLATFORM_MAX_PATH]; + char classname[PLATFORM_MAX_PATH]; GetEntityClassname(entity, classname, sizeof(classname)); if(StrEqual(classname, projectile, false)) { - decl String:model[PLATFORM_MAX_PATH]; + char model[PLATFORM_MAX_PATH]; FF2_GetAbilityArgumentString(boss, PLUGIN_NAME, PROJECTILE, "model", model, sizeof(model)); if(IsModelPrecached(model)) { @@ -113,7 +115,7 @@ public OnProjectileSpawned(entity) } else { - decl String:bossName[64]; + char bossName[64]; FF2_GetBossName(boss, bossName, sizeof(bossName)); LogError("[FF2 Easter Abilities] Model %s (used by boss %s for ability %s) isn't precached!", model, bossName, PROJECTILE); } @@ -122,18 +124,18 @@ public OnProjectileSpawned(entity) } } -SpawnManyObjects(String:classname[], client, String:model[], skin=0, amount=14, Float:distance=30.0) +void SpawnManyObjects(char[] classname, int client, char[] model, int skin=0, int amount=14, float distance=30.0) { if(!client || !IsClientInGame(client)) { return; } - new Float:position[3], Float:velocity[3]; - new Float:angle[]={90.0, 0.0, 0.0}; + float position[3], velocity[3]; + float angle[]={90.0, 0.0, 0.0}; GetClientAbsOrigin(client, position); position[2]+=distance; - for(new i; i #include +#pragma newdecls required + #define CBS_MAX_ARROWS 9 #define SOUND_SLOW_MO_START "replay/enterperformancemode.wav" //Used when Ninja Spy enters slow mo @@ -17,7 +19,7 @@ #define PLUGIN_NAME "1st set abilities" #define PLUGIN_VERSION "2.0.0" -public Plugin:myinfo= +public Plugin myinfo= { name="Freak Fortress 2: Abilities of 1st set", author="RainBolt Dash", @@ -27,29 +29,29 @@ public Plugin:myinfo= #define FLAG_ONSLOWMO (1<<0) -new FF2Flags[MAXPLAYERS+1]; -new CloneOwnerIndex[MAXPLAYERS+1]=-1; +int FF2Flags[MAXPLAYERS+1]; +int CloneOwnerIndex[MAXPLAYERS+1]=-1; -new Handle:SlowMoTimer; -new oldTarget; +Handle SlowMoTimer; +int oldTarget; -new Handle:OnRage; +Handle OnRage; -new Handle:cvarTimeScale; -new Handle:cvarCheats; -new Handle:cvarKAC; -new TFTeam:BossTeam=TFTeam_Blue; +Handle cvarTimeScale; +Handle cvarCheats; +Handle cvarKAC; +TFTeam BossTeam=TFTeam_Blue; -public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max) +public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) { OnRage=CreateGlobalForward("FF2_OnRage", ET_Hook, Param_Cell, Param_CellByRef); //Boss, distance return APLRes_Success; } -public OnPluginStart() +public void OnPluginStart() { - new version[3]; + int version[3]; FF2_GetFF2Version(version); if(version[0]==1 && (version[1]<10 || (version[1]==10 && version[2]<3))) { @@ -69,19 +71,19 @@ public OnPluginStart() FF2_RegisterSubplugin(PLUGIN_NAME); } -public OnMapStart() +public void OnMapStart() { PrecacheSound(SOUND_SLOW_MO_START, true); PrecacheSound(SOUND_SLOW_MO_END, true); PrecacheSound(SOUND_DEMOPAN_RAGE, true); } -public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast) +public Action OnRoundStart(Handle event, const char[] name, bool dontBroadcast) { if(FF2_IsFF2Enabled()) { CreateTimer(0.3, Timer_GetBossTeam, TIMER_FLAG_NO_MAPCHANGE); - for(new client=1; client<=MaxClients; client++) + for(int client=1; client<=MaxClients; client++) { FF2Flags[client]=0; CloneOwnerIndex[client]=-1; @@ -101,11 +103,11 @@ public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast return Plugin_Continue; }*/ -public Action:OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast) +public Action OnRoundEnd(Handle event, const char[] name, bool dontBroadcast) { if(FF2_IsFF2Enabled()) { - for(new client=1; client<=MaxClients; client++) + for(int client=1; client<=MaxClients; client++) { if(FF2Flags[client] & FLAG_ONSLOWMO) { @@ -127,7 +129,7 @@ public Action:OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast) return Plugin_Continue; } -public OnClientDisconnect(client) +public void OnClientDisconnect(int client) { FF2Flags[client]=0; if(CloneOwnerIndex[client]!=-1) @@ -137,7 +139,7 @@ public OnClientDisconnect(client) } } -public Action:Timer_GetBossTeam(Handle:timer) +public Action Timer_GetBossTeam(Handle timer) { if(cvarKAC && GetConVarBool(cvarKAC)) { @@ -147,7 +149,7 @@ public Action:Timer_GetBossTeam(Handle:timer) return Plugin_Continue; } -public FF2_OnAbility(boss, const String:pluginName[], const String:abilityName[], slot, status) +public void FF2_OnAbility(int boss, const char[] pluginName, const char[] abilityName, int slot, int status) { if(!StrEqual(pluginName, PLUGIN_NAME, false)) { @@ -158,10 +160,10 @@ public FF2_OnAbility(boss, const String:pluginName[], const String:abilityName[] { if(!boss) { - new distance=FF2_GetBossRageDistance(boss, PLUGIN_NAME, abilityName); - new newDistance=distance; + int distance=FF2_GetBossRageDistance(boss, PLUGIN_NAME, abilityName); + int newDistance=distance; - new Action:action; + Action action; Call_StartForward(OnRage); Call_PushCell(boss); Call_PushCellRef(newDistance); @@ -181,8 +183,8 @@ public FF2_OnAbility(boss, const String:pluginName[], const String:abilityName[] { if(status) { - new client=GetClientOfUserId(FF2_GetBossUserId(boss)); - new Float:charge=FF2_GetBossCharge(boss, 0); + int client=GetClientOfUserId(FF2_GetBossUserId(boss)); + float charge=FF2_GetBossCharge(boss, 0); SetEntPropFloat(client, Prop_Send, "m_flChargeMeter", 100.0); TF2_AddCondition(client, TFCond_Charging, 0.25); if(charge>10.0 && charge<90.0) @@ -206,7 +208,7 @@ public FF2_OnAbility(boss, const String:pluginName[], const String:abilityName[] else if(StrEqual(abilityName, "explosive dance", false)) { SetEntityMoveType(GetClientOfUserId(FF2_GetBossUserId(boss)), MOVETYPE_NONE); - new Handle:data; + Handle data; CreateDataTimer(0.15, Timer_Prepare_Explosion_Rage, data); WritePackString(data, abilityName); WritePackCell(data, boss); @@ -218,31 +220,31 @@ public FF2_OnAbility(boss, const String:pluginName[], const String:abilityName[] } } -Rage_Clone(const String:abilityName[], boss) +void Rage_Clone(const char[] abilityName, int boss) { - new Handle:bossKV[8]; - decl String:bossName[32]; - new bool:changeModel=bool:FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "custom model"); - new weaponMode=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "allow weapons"); - decl String:model[PLATFORM_MAX_PATH]; + Handle bossKV[8]; + char bossName[32]; + bool changeModel=view_as(FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "custom model")); + int weaponMode=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "allow weapons"); + char model[PLATFORM_MAX_PATH]; FF2_GetAbilityArgumentString(boss, PLUGIN_NAME, abilityName, "model", model, sizeof(model)); - new class=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "class"); - new Float:ratio=FF2_GetAbilityArgumentFloat(boss, PLUGIN_NAME, abilityName, "ratio", 0.0); - new String:classname[64]="tf_weapon_bottle"; + int playerclass=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "class"); + float ratio=FF2_GetAbilityArgumentFloat(boss, PLUGIN_NAME, abilityName, "ratio", 0.0); + char classname[64]="tf_weapon_bottle"; FF2_GetAbilityArgumentString(boss, PLUGIN_NAME, abilityName, "classname", classname, sizeof(classname)); - new index=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "index", 191); - new String:attributes[64]="68 ; -1"; + int index=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "index", 191); + char attributes[64]="68 ; -1"; FF2_GetAbilityArgumentString(boss, PLUGIN_NAME, abilityName, "attributes", attributes, sizeof(attributes)); - new ammo=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "ammo", -1); - new clip=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "clip", -1); - new health=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "health", 0); + int ammo=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "ammo", -1); + int clip=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "clip", -1); + int health=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "health", 0); - new Float:position[3], Float:velocity[3]; + float position[3], velocity[3]; GetEntPropVector(GetClientOfUserId(FF2_GetBossUserId(boss)), Prop_Data, "m_vecOrigin", position); FF2_GetBossName(boss, bossName, sizeof(bossName)); - new maxKV; + int maxKV; for(maxKV=0; maxKV<8; maxKV++) { if(!(bossKV[maxKV]=FF2_GetBossKV(maxKV))) @@ -251,13 +253,13 @@ Rage_Clone(const String:abilityName[], boss) } } - new alive, dead; - new Handle:players=CreateArray(); - for(new target=1; target<=MaxClients; target++) + int alive, dead; + Handle players=CreateArray(); + for(int target=1; target<=MaxClients; target++) { if(IsClientInGame(target)) { - new TFTeam:team=TF2_GetClientTeam(target); + TFTeam team=TF2_GetClientTeam(target); if(team>TFTeam_Spectator && team!=TFTeam_Blue) { if(IsPlayerAlive(target)) @@ -273,10 +275,10 @@ Rage_Clone(const String:abilityName[], boss) } } - new totalMinions=(ratio ? RoundToCeil(alive*ratio) : MaxClients); //If ratio is 0, use MaxClients instead - new config=GetRandomInt(0, maxKV-1); - new clone, temp; - for(new i=1; i<=dead && i<=totalMinions; i++) + int totalMinions=(ratio ? RoundToCeil(alive*ratio) : MaxClients); //If ratio is 0, use MaxClients instead + int config=GetRandomInt(0, maxKV-1); + int clone, temp; + for(int i=1; i<=dead && i<=totalMinions; i++) { temp=GetRandomInt(0, GetArraySize(players)-1); clone=GetArrayCell(players, temp); @@ -286,7 +288,7 @@ Rage_Clone(const String:abilityName[], boss) TF2_ChangeClientTeam(clone, BossTeam); TF2_RespawnPlayer(clone); CloneOwnerIndex[clone]=boss; - TF2_SetPlayerClass(clone, (class ? (TFClassType:class) : (TFClassType:KvGetNum(bossKV[config], "class", 0))), _, false); + TF2_SetPlayerClass(clone, (playerclass ? (view_as(playerclass)) : (view_as(KvGetNum(bossKV[config], "class", 0)))), _, false); if(changeModel) { @@ -307,7 +309,7 @@ Rage_Clone(const String:abilityName[], boss) } case 1: { - new weapon; + int weapon; TF2_RemoveAllWeapons(clone); if(classname[0]=='\0') { @@ -365,14 +367,14 @@ Rage_Clone(const String:abilityName[], boss) SDKHook(clone, SDKHook_OnTakeDamage, SaveMinion); CreateTimer(4.0, Timer_Enable_Damage, GetClientUserId(clone), TIMER_FLAG_NO_MAPCHANGE); - new Handle:data; + Handle data; CreateDataTimer(0.1, Timer_EquipModel, data, TIMER_FLAG_NO_MAPCHANGE); WritePackCell(data, GetClientUserId(clone)); WritePackString(data, model); } CloseHandle(players); - new entity, owner; + int entity, owner; while((entity=FindEntityByClassname(entity, "tf_wearable"))!=-1) { if((owner=GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity"))<=MaxClients && owner>0 && TF2_GetClientTeam(owner)==BossTeam) @@ -398,13 +400,13 @@ Rage_Clone(const String:abilityName[], boss) } } -public Action:Timer_EquipModel(Handle:timer, any:pack) +public Action Timer_EquipModel(Handle timer, Handle pack) { ResetPack(pack); - new client=GetClientOfUserId(ReadPackCell(pack)); + int client=GetClientOfUserId(ReadPackCell(pack)); if(client && IsClientInGame(client) && IsPlayerAlive(client)) { - decl String:model[PLATFORM_MAX_PATH]; + char model[PLATFORM_MAX_PATH]; ReadPackString(pack, model, PLATFORM_MAX_PATH); SetVariantString(model); AcceptEntityInput(client, "SetCustomModel"); @@ -412,9 +414,9 @@ public Action:Timer_EquipModel(Handle:timer, any:pack) } } -public Action:Timer_Enable_Damage(Handle:timer, any:userid) +public Action Timer_Enable_Damage(Handle timer, int userid) { - new client=GetClientOfUserId(userid); + int client=GetClientOfUserId(userid); if(client) { SetEntProp(client, Prop_Data, "m_takedamage", 2); @@ -424,16 +426,17 @@ public Action:Timer_Enable_Damage(Handle:timer, any:userid) return Plugin_Continue; } -public Action:SaveMinion(client, &attacker, &inflictor, &Float:damage, &damagetype, &weapon, Float:damageForce[3], Float:damagePosition[3]) +public Action SaveMinion(int client, int& attacker, int& inflictor, float& damage, int& damagetype, int& weapon, float damageForce[3], float damagePosition[3]) { if(attacker>MaxClients) { - decl String:edict[64]; + char edict[64]; if(GetEntityClassname(attacker, edict, sizeof(edict)) && StrEqual(edict, "trigger_hurt", false)) { - new target, Float:position[3]; - new bool:otherTeamIsAlive; - for(new clone=1; clone<=MaxClients; clone++) + int target; + float position[3]; + bool otherTeamIsAlive; + for(int clone=1; clone<=MaxClients; clone++) { if(IsValidEntity(clone) && IsClientInGame(clone) && IsPlayerAlive(clone) && TF2_GetClientTeam(clone)!=BossTeam) { @@ -442,7 +445,7 @@ public Action:SaveMinion(client, &attacker, &inflictor, &Float:damage, &damagety } } - new tries; + int tries; do { tries++; @@ -463,7 +466,7 @@ public Action:SaveMinion(client, &attacker, &inflictor, &Float:damage, &damagety return Plugin_Continue; } -public Action:Timer_Demopan_Rage(Handle:timer, any:count) //TODO: Make this rage configurable +public Action Timer_Demopan_Rage(Handle timer, int count) //TODO: Make this rage configurable { if(count==13) //Rage has finished-reset it in 6 seconds (trade_0 is 100% transparent apparently) { @@ -471,11 +474,11 @@ public Action:Timer_Demopan_Rage(Handle:timer, any:count) //TODO: Make this rag } else { - decl String:overlay[PLATFORM_MAX_PATH]; + char overlay[PLATFORM_MAX_PATH]; Format(overlay, sizeof(overlay), "r_screenoverlay \"freak_fortress_2/demopan/trade_%i\"", count); SetCommandFlags("r_screenoverlay", GetCommandFlags("r_screenoverlay") & ~FCVAR_CHEAT); //Allow normal players to use r_screenoverlay - for(new client=1; client<=MaxClients; client++) + for(int client=1; client<=MaxClients; client++) { if(IsClientInGame(client) && IsPlayerAlive(client) && TF2_GetClientTeam(client)!=BossTeam) { @@ -497,16 +500,16 @@ public Action:Timer_Demopan_Rage(Handle:timer, any:count) //TODO: Make this rag return Plugin_Continue; } -Rage_Bow(boss) +void Rage_Bow(int boss) { - new client=GetClientOfUserId(FF2_GetBossUserId(boss)); + int client=GetClientOfUserId(FF2_GetBossUserId(boss)); TF2_RemoveWeaponSlot(client, TFWeaponSlot_Primary); - new weapon=SpawnWeapon(client, "tf_weapon_compound_bow", 1005, 100, 5, "6 ; 0.5 ; 37 ; 0.0 ; 280 ; 19"); + int weapon=SpawnWeapon(client, "tf_weapon_compound_bow", 1005, 100, 5, "6 ; 0.5 ; 37 ; 0.0 ; 280 ; 19"); SetEntPropEnt(client, Prop_Send, "m_hActiveWeapon", weapon); - new TFTeam:team=(FF2_GetBossTeam()==TFTeam_Blue ? TFTeam_Red : TFTeam_Blue); + TFTeam team=(FF2_GetBossTeam()==TFTeam_Blue ? TFTeam_Red : TFTeam_Blue); - new otherTeamAlivePlayers; - for(new target=1; target<=MaxClients; target++) + int otherTeamAlivePlayers; + for(int target=1; target<=MaxClients; target++) { if(IsClientInGame(target) && TF2_GetClientTeam(target)==team && IsPlayerAlive(target)) { @@ -517,26 +520,26 @@ Rage_Bow(boss) FF2_SetAmmo(client, weapon, ((otherTeamAlivePlayers>=CBS_MAX_ARROWS) ? CBS_MAX_ARROWS : otherTeamAlivePlayers)-1, 1); //Put one arrow in the clip } -public Action:Timer_Prepare_Explosion_Rage(Handle:timer, Handle:data) +public Action Timer_Prepare_Explosion_Rage(Handle timer, Handle data) { - new boss=ReadPackCell(data); - new client=GetClientOfUserId(FF2_GetBossUserId(boss)); + int boss=ReadPackCell(data); + int client=GetClientOfUserId(FF2_GetBossUserId(boss)); - decl String:abilityName[64]; + char abilityName[64]; ReadPackString(data, abilityName, sizeof(abilityName)); CreateTimer(0.13, Timer_Rage_Explosive_Dance, boss, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); - new Float:position[3]; + float position[3]; GetEntPropVector(client, Prop_Data, "m_vecOrigin", position); - new String:sound[PLATFORM_MAX_PATH]; + char sound[PLATFORM_MAX_PATH]; FF2_GetAbilityArgumentString(boss, PLUGIN_NAME, abilityName, "sound", sound, PLATFORM_MAX_PATH); if(strlen(sound)) { EmitSoundToAll(sound, client, _, _, _, _, _, client, position); EmitSoundToAll(sound, client, _, _, _, _, _, client, position); - for(new target=1; target<=MaxClients; target++) + for(int target=1; target<=MaxClients; target++) { if(IsClientInGame(target) && target!=client) { @@ -548,20 +551,20 @@ public Action:Timer_Prepare_Explosion_Rage(Handle:timer, Handle:data) return Plugin_Continue; } -public Action:Timer_Rage_Explosive_Dance(Handle:timer, any:boss) +public Action Timer_Rage_Explosive_Dance(Handle timer, int boss) { - static count; - new client=GetClientOfUserId(FF2_GetBossUserId(boss)); + static int count; + int client=GetClientOfUserId(FF2_GetBossUserId(boss)); count++; if(count<=35 && IsPlayerAlive(client)) { SetEntityMoveType(boss, MOVETYPE_NONE); - new Float:bossPosition[3], Float:explosionPosition[3]; + float bossPosition[3], explosionPosition[3]; GetEntPropVector(client, Prop_Send, "m_vecOrigin", bossPosition); explosionPosition[2]=bossPosition[2]; - for(new i; i<5; i++) + for(int i; i<5; i++) { - new explosion=CreateEntityByName("env_explosion"); + int explosion=CreateEntityByName("env_explosion"); DispatchKeyValueFloat(explosion, "DamageForce", 180.0); SetEntProp(explosion, Prop_Data, "m_iMagnitude", 280, 4); @@ -612,16 +615,16 @@ public Action:Timer_Rage_Explosive_Dance(Handle:timer, any:boss) return Plugin_Continue; } -Rage_Slowmo(boss, const String:abilityName[]) +void Rage_Slowmo(int boss, const char[] abilityName) { FF2_SetFF2Flags(boss, FF2_GetFF2Flags(boss)|FF2FLAG_CHANGECVAR); SetConVarFloat(cvarTimeScale, FF2_GetAbilityArgumentFloat(boss, PLUGIN_NAME, abilityName, "timescale", 0.1)); - new Float:duration=FF2_GetAbilityArgumentFloat(boss, PLUGIN_NAME, abilityName, "duration", 1.0)+1.0; + float duration=FF2_GetAbilityArgumentFloat(boss, PLUGIN_NAME, abilityName, "duration", 1.0)+1.0; SlowMoTimer=CreateTimer(duration, Timer_StopSlowMo, boss, TIMER_FLAG_NO_MAPCHANGE); FF2Flags[boss]=FF2Flags[boss]|FLAG_ONSLOWMO; UpdateClientCheatValue(1); - new client=GetClientOfUserId(FF2_GetBossUserId(boss)); + int client=GetClientOfUserId(FF2_GetBossUserId(boss)); if(client) { CreateTimer(duration, Timer_RemoveEntity, EntIndexToEntRef(AttachParticle(client, BossTeam==TFTeam_Blue ? "scout_dodge_blue" : "scout_dodge_red", 75.0)), TIMER_FLAG_NO_MAPCHANGE); @@ -631,7 +634,7 @@ Rage_Slowmo(boss, const String:abilityName[]) EmitSoundToAll(SOUND_SLOW_MO_START, _, _, _, _, _, _, _, _, _, false); } -public Action:Timer_StopSlowMo(Handle:timer, any:boss) +public Action Timer_StopSlowMo(Handle timer, int boss) { SlowMoTimer=INVALID_HANDLE; oldTarget=0; @@ -647,9 +650,9 @@ public Action:Timer_StopSlowMo(Handle:timer, any:boss) return Plugin_Continue; } -public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:velocity[3], Float:angles[3], &weapon) +public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float velocity[3], float angles[3], int& weapon) { - new boss=FF2_GetBossIndex(client); + int boss=FF2_GetBossIndex(client); if(boss==-1 || !(FF2Flags[boss] & FLAG_ONSLOWMO)) { return Plugin_Continue; @@ -657,22 +660,22 @@ public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:velocity[3], Floa if(buttons & IN_ATTACK) { - new Float:bossPosition[3], Float:endPosition[3], Float:eyeAngles[3]; + float bossPosition[3], endPosition[3], eyeAngles[3]; GetEntPropVector(client, Prop_Send, "m_vecOrigin", bossPosition); bossPosition[2]+=65; GetClientEyeAngles(client, eyeAngles); - new Handle:trace=TR_TraceRayFilterEx(bossPosition, eyeAngles, MASK_SOLID, RayType_Infinite, TraceRayDontHitSelf); + Handle trace=TR_TraceRayFilterEx(bossPosition, eyeAngles, MASK_SOLID, RayType_Infinite, TraceRayDontHitSelf); TR_GetEndPosition(endPosition, trace); endPosition[2]+=100; SubtractVectors(endPosition, bossPosition, velocity); NormalizeVector(velocity, velocity); ScaleVector(velocity, 2012.0); TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, velocity); - new target=TR_GetEntityIndex(trace); + int target=TR_GetEntityIndex(trace); if(target && target<=MaxClients) { - new Handle:data; + Handle data; CreateDataTimer(0.15, Timer_Rage_SlowMo_Attack, data); WritePackCell(data, GetClientUserId(client)); WritePackCell(data, GetClientUserId(target)); @@ -683,13 +686,13 @@ public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:velocity[3], Floa return Plugin_Continue; } -public Action:Timer_Rage_SlowMo_Attack(Handle:timer, Handle:data) +public Action Timer_Rage_SlowMo_Attack(Handle timer, Handle data) { - new client=GetClientOfUserId(ReadPackCell(data)); - new target=GetClientOfUserId(ReadPackCell(data)); + int client=GetClientOfUserId(ReadPackCell(data)); + int target=GetClientOfUserId(ReadPackCell(data)); if(client && target && IsClientInGame(client) && IsClientInGame(target)) { - new Float:clientPosition[3], Float:targetPosition[3]; + float clientPosition[3], targetPosition[3]; GetEntPropVector(client, Prop_Send, "m_vecOrigin", clientPosition); GetEntPropVector(target, Prop_Send, "m_vecOrigin", targetPosition); if(GetVectorDistance(clientPosition, targetPosition)<=1500 && target!=oldTarget) @@ -703,7 +706,7 @@ public Action:Timer_Rage_SlowMo_Attack(Handle:timer, Handle:data) } } -public bool:TraceRayDontHitSelf(entity, mask) +public bool TraceRayDontHitSelf(int entity, int mask) { if(!entity || entity>MaxClients) { @@ -782,23 +785,23 @@ public bool:TraceRayDontHitSelf(entity, mask) } */ -public Action:OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) +public Action OnPlayerDeath(Handle event, const char[] name, bool dontBroadcast) { - new attacker=GetClientOfUserId(GetEventInt(event, "attacker")); - new client=GetClientOfUserId(GetEventInt(event, "userid")); - new boss=FF2_GetBossIndex(attacker); + int attacker=GetClientOfUserId(GetEventInt(event, "attacker")); + int client=GetClientOfUserId(GetEventInt(event, "userid")); + int boss=FF2_GetBossIndex(attacker); if(boss!=-1) { if(FF2_HasAbility(boss, PLUGIN_NAME, "spawn model on kill")) { - decl String:model[PLATFORM_MAX_PATH]; + char model[PLATFORM_MAX_PATH]; FF2_GetAbilityArgumentString(boss, PLUGIN_NAME, "spawn model on kill", "model", model, sizeof(model)); if(model[0]!='\0') //Because you never know when someone is careless and doesn't specify a model... { if(!IsModelPrecached(model)) //Make sure the boss author precached the model (similar to above) { - new String:bossName[64]; + char bossName[64]; FF2_GetBossName(boss, bossName, sizeof(bossName)); if(!FileExists(model, true)) { @@ -815,7 +818,7 @@ public Action:OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcas CreateTimer(0.01, Timer_RemoveRagdoll, GetEventInt(event, "userid"), TIMER_FLAG_NO_MAPCHANGE); } - new prop=CreateEntityByName("prop_physics_override"); + int prop=CreateEntityByName("prop_physics_override"); if(IsValidEntity(prop)) { SetEntityModel(prop, model); @@ -824,11 +827,11 @@ public Action:OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcas SetEntProp(prop, Prop_Send, "m_usSolidFlags", 16); DispatchSpawn(prop); - new Float:position[3]; + float position[3]; GetEntPropVector(client, Prop_Send, "m_vecOrigin", position); position[2]+=20; TeleportEntity(prop, position, NULL_VECTOR, NULL_VECTOR); - new Float:duration=FF2_GetAbilityArgumentFloat(boss, PLUGIN_NAME, "drop prop", "duration", 0.0); + float duration=FF2_GetAbilityArgumentFloat(boss, PLUGIN_NAME, "drop prop", "duration", 0.0); if(duration>0.5) { CreateTimer(duration, Timer_RemoveEntity, EntIndexToEntRef(prop), TIMER_FLAG_NO_MAPCHANGE); @@ -842,7 +845,7 @@ public Action:OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcas if(GetEntPropEnt(attacker, Prop_Send, "m_hActiveWeapon")==GetPlayerWeaponSlot(attacker, TFWeaponSlot_Melee)) { TF2_RemoveWeaponSlot(attacker, TFWeaponSlot_Melee); - new weapon; + int weapon; switch(GetRandomInt(0, 2)) { case 0: @@ -866,7 +869,7 @@ public Action:OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcas boss=FF2_GetBossIndex(client); if(boss!=-1 && FF2_HasAbility(boss, PLUGIN_NAME, "spawn clones") && FF2_GetAbilityArgument(boss, PLUGIN_NAME, "spawn clones", "die on boss death", 1) && !(GetEventInt(event, "death_flags") & TF_DEATHFLAG_DEADRINGER)) { - for(new target=1; target<=MaxClients; target++) + for(int target=1; target<=MaxClients; target++) { if(CloneOwnerIndex[target]==boss) { @@ -889,25 +892,25 @@ public Action:OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcas return Plugin_Continue; } -public Action:Timer_RemoveRagdoll(Handle:timer, any:userid) +public Action Timer_RemoveRagdoll(Handle timer, int userid) { - new client=GetClientOfUserId(userid); - new ragdoll; + int client=GetClientOfUserId(userid); + int ragdoll; if(client>0 && (ragdoll=GetEntPropEnt(client, Prop_Send, "m_hRagdoll"))>MaxClients) { AcceptEntityInput(ragdoll, "Kill"); } } -stock SpawnWeapon(client, String:name[], index, level, quality, String:attribute[]) +stock int SpawnWeapon(int client, char[] name, int index, int level, int quality, char[] attribute) { - new Handle:weapon=TF2Items_CreateItem(OVERRIDE_ALL|FORCE_GENERATION); + Handle weapon=TF2Items_CreateItem(OVERRIDE_ALL|FORCE_GENERATION); TF2Items_SetClassname(weapon, name); TF2Items_SetItemIndex(weapon, index); TF2Items_SetLevel(weapon, level); TF2Items_SetQuality(weapon, quality); - new String:attributes[32][32]; - new count = ExplodeString(attribute, ";", attributes, 32, 32); + char attributes[32][32]; + int count = ExplodeString(attribute, ";", attributes, 32, 32); if(count%2!=0) { count--; @@ -916,10 +919,10 @@ stock SpawnWeapon(client, String:name[], index, level, quality, String:attribute if(count>0) { TF2Items_SetNumAttributes(weapon, count/2); - new i2=0; - for(new i=0; iMaxClients) { AcceptEntityInput(entity, "Kill"); } } -stock AttachParticle(entity, String:particleType[], Float:offset=0.0, bool:attach=true) +stock int AttachParticle(int entity, char[] particleType, float offset=0.0, bool attach=true) { - new particle=CreateEntityByName("info_particle_system"); + int particle=CreateEntityByName("info_particle_system"); - decl String:targetName[128]; - new Float:position[3]; + char targetName[128]; + float position[3]; GetEntPropVector(entity, Prop_Send, "m_vecOrigin", position); position[2]+=offset; TeleportEntity(particle, position, NULL_VECTOR, NULL_VECTOR); @@ -981,9 +984,9 @@ stock AttachParticle(entity, String:particleType[], Float:offset=0.0, bool:attac return particle; } -stock UpdateClientCheatValue(value) +stock void UpdateClientCheatValue(int value) { - for(new client=1; client<=MaxClients; client++) + for(int client=1; client<=MaxClients; client++) { if(IsClientInGame(client) && !IsFakeClient(client)) { diff --git a/addons/sourcemod/scripting/freak_fortress_2/rage_overlay.sp b/addons/sourcemod/scripting/freak_fortress_2/rage_overlay.sp index 2db7eee7..61203665 100644 --- a/addons/sourcemod/scripting/freak_fortress_2/rage_overlay.sp +++ b/addons/sourcemod/scripting/freak_fortress_2/rage_overlay.sp @@ -10,12 +10,14 @@ rage_overlay: slot - slot (def.0) #include #include -new TFTeam:BossTeam=TFTeam_Blue; +#pragma newdecls required + +TFTeam BossTeam=TFTeam_Blue; #define PLUGIN_NAME "rage overlay" #define PLUGIN_VERSION "2.0.0" -public Plugin:myinfo= +public Plugin myinfo= { name="Freak Fortress 2: rage_overlay", author="Jery0987, RainBolt Dash", @@ -23,14 +25,14 @@ public Plugin:myinfo= version=PLUGIN_VERSION, }; -public OnPluginStart() +public void OnPluginStart() { HookEvent("teamplay_round_start", OnRoundStart); FF2_RegisterSubplugin(PLUGIN_NAME); } -public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast) +public Action OnRoundStart(Handle event, const char[] name, bool dontBroadcast) { if(FF2_IsFF2Enabled()) { @@ -39,13 +41,13 @@ public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast return Plugin_Continue; } -public Action:Timer_GetBossTeam(Handle:hTimer) +public Action Timer_GetBossTeam(Handle hTimer) { BossTeam=FF2_GetBossTeam(); return Plugin_Continue; } -public FF2_OnAbility(boss, const String:pluginName[], const String:abilityName[], slot, status) +public void FF2_OnAbility(int boss, const char[] pluginName, const char[] abilityName, int slot, int status) { if(!StrEqual(pluginName, PLUGIN_NAME, false)) { @@ -58,13 +60,13 @@ public FF2_OnAbility(boss, const String:pluginName[], const String:abilityName[] } } -Rage_Overlay(boss, const String:abilityName[]) +void Rage_Overlay(int boss, const char[] abilityName) { - decl String:overlay[PLATFORM_MAX_PATH]; + char overlay[PLATFORM_MAX_PATH]; FF2_GetAbilityArgumentString(boss, PLUGIN_NAME, abilityName, "overlay", overlay, sizeof(overlay)); Format(overlay, PLATFORM_MAX_PATH, "r_screenoverlay \"%s\"", overlay); SetCommandFlags("r_screenoverlay", GetCommandFlags("r_screenoverlay") & ~FCVAR_CHEAT); - for(new target=1; target<=MaxClients; target++) + for(int target=1; target<=MaxClients; target++) { if(IsClientInGame(target) && IsPlayerAlive(target) && TF2_GetClientTeam(target)!=BossTeam) { @@ -76,10 +78,10 @@ Rage_Overlay(boss, const String:abilityName[]) SetCommandFlags("r_screenoverlay", GetCommandFlags("r_screenoverlay") & FCVAR_CHEAT); } -public Action:Timer_Remove_Overlay(Handle:timer) +public Action Timer_Remove_Overlay(Handle timer) { SetCommandFlags("r_screenoverlay", GetCommandFlags("r_screenoverlay") & ~FCVAR_CHEAT); - for(new target=1; target<=MaxClients; target++) + for(int target=1; target<=MaxClients; target++) { if(IsClientInGame(target) && IsPlayerAlive(target) && TF2_GetClientTeam(target)!=BossTeam) { diff --git a/addons/sourcemod/scripting/freak_fortress_2/special_noanims.sp b/addons/sourcemod/scripting/freak_fortress_2/special_noanims.sp index 47c4df10..74aa590f 100644 --- a/addons/sourcemod/scripting/freak_fortress_2/special_noanims.sp +++ b/addons/sourcemod/scripting/freak_fortress_2/special_noanims.sp @@ -18,10 +18,12 @@ rage_new_weapon: slot - slot (def.0) #include #include +#pragma newdecls required + #define PLUGIN_NAME "noanims and new weapon" #define PLUGIN_VERSION "2.0.0" -public Plugin:myinfo= +public Plugin myinfo= { name="Freak Fortress 2: special_noanims", author="RainBolt Dash, Wliu", @@ -29,9 +31,9 @@ public Plugin:myinfo= version=PLUGIN_VERSION }; -public OnPluginStart() +public void OnPluginStart() { - new version[3]; + int version[3]; FF2_GetFF2Version(version); if(version[0]==1 && (version[1]<10 || (version[1]==10 && version[2]<3))) { @@ -43,7 +45,7 @@ public OnPluginStart() FF2_RegisterSubplugin(PLUGIN_NAME); } -public FF2_OnAbility(boss, const String:pluginName[], const String:abilityName[], slot, status) +public void FF2_OnAbility(int boss, const char[] pluginName, const char[] abilityName, int slot, int status) { if(!StrEqual(pluginName, PLUGIN_NAME, false)) { @@ -56,7 +58,7 @@ public FF2_OnAbility(boss, const String:pluginName[], const String:abilityName[] } } -public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast) +public Action OnRoundStart(Handle event, const char[] name, bool dontBroadcast) { if(FF2_IsFF2Enabled()) { @@ -66,10 +68,10 @@ public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast return Plugin_Continue; } -public Action:Timer_Disable_Anims(Handle:timer) +public Action Timer_Disable_Anims(Handle timer) { - new client; - for(new boss; (client=GetClientOfUserId(FF2_GetBossUserId(boss)))>0; boss++) + int client; + for(int boss; (client=GetClientOfUserId(FF2_GetBossUserId(boss)))>0; boss++) { if(FF2_HasAbility(boss, PLUGIN_NAME, "no animations")) { @@ -80,23 +82,23 @@ public Action:Timer_Disable_Anims(Handle:timer) return Plugin_Continue; } -Rage_New_Weapon(boss, const String:abilityName[]) +void Rage_New_Weapon(int boss, const char[] abilityName) { - new client=GetClientOfUserId(FF2_GetBossUserId(boss)); + int client=GetClientOfUserId(FF2_GetBossUserId(boss)); if(!client || !IsClientInGame(client) || !IsPlayerAlive(client)) { return; } - decl String:classname[64], String:attributes[256]; + char classname[64], attributes[256]; FF2_GetAbilityArgumentString(boss, PLUGIN_NAME, abilityName, "classname", classname, sizeof(classname)); FF2_GetAbilityArgumentString(boss, PLUGIN_NAME, abilityName, "attributes", attributes, sizeof(attributes)); - new slot=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "slot"); + int slot=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "slot"); TF2_RemoveWeaponSlot(client, slot); - new index=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "index"); - new weapon=SpawnWeapon(client, classname, index, 101, 5, attributes); + int index=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "index"); + int weapon=SpawnWeapon(client, classname, index, 101, 5, attributes); if(StrEqual(classname, "tf_weapon_builder") && index!=735) //PDA, normal sapper { SetEntProp(weapon, Prop_Send, "m_aBuildableObjectTypes", 1, _, 0); @@ -119,23 +121,23 @@ Rage_New_Weapon(boss, const String:abilityName[]) SetEntPropEnt(client, Prop_Send, "m_hActiveWeapon", weapon); } - new ammo=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "ammo", 0); - new clip=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "clip", 0); + int ammo=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "ammo", 0); + int clip=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "clip", 0); if(ammo || clip) { FF2_SetAmmo(client, weapon, ammo, clip); } } -stock SpawnWeapon(client, String:name[], index, level, quality, String:attribute[]) +stock int SpawnWeapon(int client, char[] name, int index, int level, int quality, char[] attribute) { - new Handle:weapon=TF2Items_CreateItem(OVERRIDE_ALL|FORCE_GENERATION); + Handle weapon=TF2Items_CreateItem(OVERRIDE_ALL|FORCE_GENERATION); TF2Items_SetClassname(weapon, name); TF2Items_SetItemIndex(weapon, index); TF2Items_SetLevel(weapon, level); TF2Items_SetQuality(weapon, quality); - new String:attributes[32][32]; - new count=ExplodeString(attribute, ";", attributes, 32, 32); + char attributes[32][32]; + int count=ExplodeString(attribute, ";", attributes, 32, 32); if(count%2!=0) { count--; @@ -144,10 +146,10 @@ stock SpawnWeapon(client, String:name[], index, level, quality, String:attribute if(count>0) { TF2Items_SetNumAttributes(weapon, count/2); - new i2=0; - for(new i=0; i Date: Wed, 4 Oct 2017 15:56:03 +0300 Subject: [PATCH 05/12] Fix compile --- addons/sourcemod/scripting/freak_fortress_2.sp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sourcemod/scripting/freak_fortress_2.sp b/addons/sourcemod/scripting/freak_fortress_2.sp index 89af1547..05547cee 100644 --- a/addons/sourcemod/scripting/freak_fortress_2.sp +++ b/addons/sourcemod/scripting/freak_fortress_2.sp @@ -677,7 +677,7 @@ public void EnableFF2() #if defined _steamtools_included if(steamtools) { - decl String:gameDesc[64]; + char gameDesc[64]; Format(gameDesc, sizeof(gameDesc), "Freak Fortress 2 (%s)", PLUGIN_VERSION); Steam_SetGameDescription(gameDesc); } From 333224cccd85d25d24589094e3166e925294a1d9 Mon Sep 17 00:00:00 2001 From: naydef Date: Wed, 4 Oct 2017 15:58:49 +0300 Subject: [PATCH 06/12] Fix compile again --- addons/sourcemod/scripting/include/freak_fortress_2.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/sourcemod/scripting/include/freak_fortress_2.inc b/addons/sourcemod/scripting/include/freak_fortress_2.inc index 243639c9..110a6162 100644 --- a/addons/sourcemod/scripting/include/freak_fortress_2.inc +++ b/addons/sourcemod/scripting/include/freak_fortress_2.inc @@ -1,6 +1,7 @@ //Freak Fortress 2 include file. #include #include +#include #define FF2FLAG_UBERREADY (1<<1) //Used when medic says "I'm charged!" #define FF2FLAG_ISBUFFED (1<<2) //Used when soldier uses the Battalion's Backup From 53e1994f3e4ef41975e1b7e841cd09992f3c64f8 Mon Sep 17 00:00:00 2001 From: naydef Date: Wed, 4 Oct 2017 16:31:31 +0300 Subject: [PATCH 07/12] Fix hhh teleport not working correctly --- addons/sourcemod/scripting/freak_fortress_2.sp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sourcemod/scripting/freak_fortress_2.sp b/addons/sourcemod/scripting/freak_fortress_2.sp index 05547cee..d2dbb337 100644 --- a/addons/sourcemod/scripting/freak_fortress_2.sp +++ b/addons/sourcemod/scripting/freak_fortress_2.sp @@ -7723,7 +7723,7 @@ public int SetBossCharge(int boss, int slot, float charge) //FIXME: This duplic public int Native_SetBossCharge(Handle plugin, int numParams) { - SetBossCharge(GetNativeCell(1), GetNativeCell(2), float(GetNativeCell(3))); + SetBossCharge(GetNativeCell(1), GetNativeCell(2), view_as(GetNativeCell(3))); } public int GetBossRageDamage(int boss) From 75bdc3591cfe53704bccf0f6e61f07ff5de189b3 Mon Sep 17 00:00:00 2001 From: naydef Date: Fri, 20 Oct 2017 14:16:20 +0300 Subject: [PATCH 08/12] Make subplugins use OO api and include file --- .../freak_fortress_2/default_abilities.sp | 46 ++++---- .../freak_fortress_2/easter_abilities.sp | 6 +- .../freak_fortress_2/ff2_1st_set_abilities.sp | 111 +++++++++--------- .../freak_fortress_2/rage_overlay.sp | 6 +- .../freak_fortress_2/special_noanims.sp | 6 +- .../scripting/include/freak_fortress_2.inc | 10 +- 6 files changed, 92 insertions(+), 93 deletions(-) diff --git a/addons/sourcemod/scripting/freak_fortress_2/default_abilities.sp b/addons/sourcemod/scripting/freak_fortress_2/default_abilities.sp index 325dd6ff..12d4a581 100644 --- a/addons/sourcemod/scripting/freak_fortress_2/default_abilities.sp +++ b/addons/sourcemod/scripting/freak_fortress_2/default_abilities.sp @@ -32,8 +32,8 @@ bool enableSuperDuperJump[MAXPLAYERS+1]; float UberRageCount[MAXPLAYERS+1]; TFTeam BossTeam=TFTeam_Blue; -Handle cvarOldJump; -Handle cvarBaseJumperStun; +ConVar cvarOldJump; +ConVar cvarBaseJumperStun; bool oldJump; bool removeBaseJumperOnStun; @@ -51,8 +51,8 @@ public void OnPluginStart() cvarOldJump=CreateConVar("ff2_oldjump", "0", "Use old VSH jump equations", _, true, 0.0, true, 1.0); cvarBaseJumperStun=CreateConVar("ff2_base_jumper_stun", "0", "Whether or not the Base Jumper should be disabled when a player gets stunned", _, true, 0.0, true, 1.0); - HookConVarChange(cvarOldJump, CvarChange); - HookConVarChange(cvarBaseJumperStun, CvarChange); + cvarOldJump.AddChangeHook(CvarChange); + cvarBaseJumperStun.AddChangeHook(CvarChange); jumpHUD=CreateHudSynchronizer(); @@ -69,11 +69,11 @@ public void OnPluginStart() public void OnConfigsExecuted() { - oldJump=GetConVarBool(cvarOldJump); - removeBaseJumperOnStun=GetConVarBool(cvarBaseJumperStun); + oldJump=cvarOldJump.BoolValue; + removeBaseJumperOnStun=cvarBaseJumperStun.BoolValue; } -public void CvarChange(Handle convar, const char[] oldValue, const char[] newValue) +public void CvarChange(ConVar convar, const char[] oldValue, const char[] newValue) { if(convar==cvarOldJump) { @@ -85,7 +85,7 @@ public void CvarChange(Handle convar, const char[] oldValue, const char[] newVal } } -public Action OnRoundStart(Handle event, const char[] name, bool dontBroadcast) +public Action OnRoundStart(Event event, const char[] name, bool dontBroadcast) { if(FF2_IsFF2Enabled()) { @@ -545,14 +545,14 @@ void Charge_WeighDown(int boss, int slot) //TODO: Create a HUD for this return; } - Handle data; + DataPack data; float velocity[3]; - if(gravityDatapack[client]==INVALID_HANDLE) + if(gravityDatapack[client]==null) { gravityDatapack[client]=CreateDataTimer(2.0, Timer_ResetGravity, data, TIMER_FLAG_NO_MAPCHANGE); - WritePackCell(data, GetClientUserId(client)); - WritePackFloat(data, GetEntityGravity(client)); - ResetPack(data); + data.WriteCell(GetClientUserId(client)); + data.WriteFloat(GetEntityGravity(client)); + data.Reset(); } GetEntPropVector(client, Prop_Data, "m_vecVelocity", velocity); @@ -574,23 +574,23 @@ void Charge_WeighDown(int boss, int slot) //TODO: Create a HUD for this } } -public Action Timer_ResetGravity(Handle timer, Handle data) +public Action Timer_ResetGravity(Handle timer, DataPack data) { - int client=GetClientOfUserId(ReadPackCell(data)); + int client=GetClientOfUserId(data.ReadCell()); if(client && IsValidEntity(client) && IsClientInGame(client)) { - SetEntityGravity(client, ReadPackFloat(data)); + SetEntityGravity(client, data.ReadFloat()); } - gravityDatapack[client]=INVALID_HANDLE; + gravityDatapack[client]=null; return Plugin_Continue; } -public Action OnPlayerDeath(Handle event, const char[] name, bool dontBroadcast) +public Action OnPlayerDeath(Event event, const char[] name, bool dontBroadcast) { - int boss=FF2_GetBossIndex(GetClientOfUserId(GetEventInt(event, "attacker"))); + int boss=FF2_GetBossIndex(GetClientOfUserId(event.GetInt("attacker"))); if(boss!=-1 && FF2_HasAbility(boss, PLUGIN_NAME, "special_dissolve")) { - CreateTimer(0.1, Timer_DissolveRagdoll, GetEventInt(event, "userid"), TIMER_FLAG_NO_MAPCHANGE); + CreateTimer(0.1, Timer_DissolveRagdoll, event.GetInt("userid"), TIMER_FLAG_NO_MAPCHANGE); } return Plugin_Continue; } @@ -626,7 +626,7 @@ int DissolveRagdoll(int ragdoll) AcceptEntityInput(dissolver, "Kill"); } -public Action RemoveEntity(Handle timer, any entid) +public Action RemoveEntity(Handle timer, int entid) { int entity=EntRefToEntIndex(entid); if(IsValidEntity(entity) && entity>MaxClients) @@ -663,9 +663,9 @@ stock int AttachParticle(int entity, char[] particleType, float offset=0.0, bool return particle; } -public Action OnDeflect(Handle event, const char[] name, bool dontBroadcast) +public Action OnDeflect(Event event, const char[] name, bool dontBroadcast) { - int boss=FF2_GetBossIndex(GetClientOfUserId(GetEventInt(event, "userid"))); + int boss=FF2_GetBossIndex(GetClientOfUserId(event.GetInt("userid"))); if(boss!=-1) { if(UberRageCount[boss]>11) diff --git a/addons/sourcemod/scripting/freak_fortress_2/easter_abilities.sp b/addons/sourcemod/scripting/freak_fortress_2/easter_abilities.sp index 8f23253e..9c632e90 100644 --- a/addons/sourcemod/scripting/freak_fortress_2/easter_abilities.sp +++ b/addons/sourcemod/scripting/freak_fortress_2/easter_abilities.sp @@ -48,10 +48,10 @@ public void OnPluginStart() return Plugin_Continue; }*/ -public void OnPlayerDeath(Handle event, const char[] name, bool dontBroadcast) +public void OnPlayerDeath(Event event, const char[] name, bool dontBroadcast) { - int client=GetClientOfUserId(GetEventInt(event, "userid")); - int attacker=GetClientOfUserId(GetEventInt(event, "attacker")); + int client=GetClientOfUserId(event.GetInt("userid")); + int attacker=GetClientOfUserId(event.GetInt("attacker")); if(!client || !attacker || !IsClientInGame(client) || !IsClientInGame(attacker)) { return; diff --git a/addons/sourcemod/scripting/freak_fortress_2/ff2_1st_set_abilities.sp b/addons/sourcemod/scripting/freak_fortress_2/ff2_1st_set_abilities.sp index fd4d130b..54c4f856 100644 --- a/addons/sourcemod/scripting/freak_fortress_2/ff2_1st_set_abilities.sp +++ b/addons/sourcemod/scripting/freak_fortress_2/ff2_1st_set_abilities.sp @@ -37,9 +37,9 @@ int oldTarget; Handle OnRage; -Handle cvarTimeScale; -Handle cvarCheats; -Handle cvarKAC; +ConVar cvarTimeScale; +ConVar cvarCheats; +ConVar cvarKAC; TFTeam BossTeam=TFTeam_Blue; public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) @@ -48,7 +48,6 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max return APLRes_Success; } - public void OnPluginStart() { int version[3]; @@ -78,7 +77,7 @@ public void OnMapStart() PrecacheSound(SOUND_DEMOPAN_RAGE, true); } -public Action OnRoundStart(Handle event, const char[] name, bool dontBroadcast) +public Action OnRoundStart(Event event, const char[] name, bool dontBroadcast) { if(FF2_IsFF2Enabled()) { @@ -92,18 +91,18 @@ public Action OnRoundStart(Handle event, const char[] name, bool dontBroadcast) return Plugin_Continue; } -/*public Action:FF2_OnBossSelected(boss, &special, String:specialName[]) //Re-enable in v2 or whenever the late-loading forward bug is fixed +/*public Action FF2_OnBossSelected(int boss, int &special, char[] specialName) //Re-enable in v2 or whenever the late-loading forward bug is fixed { if(FF2_HasAbility(boss, PLUGIN_NAME, "spawn model on kill")) { - decl String:model[PLATFORM_MAX_PATH]; + char model[PLATFORM_MAX_PATH]; FF2_GetAbilityArgumentString(boss, PLUGIN_NAME, "spawn model on kill", "model", model, sizeof(model)); PrecacheModel(model); } return Plugin_Continue; }*/ -public Action OnRoundEnd(Handle event, const char[] name, bool dontBroadcast) +public Action OnRoundEnd(Event event, const char[] name, bool dontBroadcast) { if(FF2_IsFF2Enabled()) { @@ -115,7 +114,7 @@ public Action OnRoundEnd(Handle event, const char[] name, bool dontBroadcast) { KillTimer(SlowMoTimer); } - Timer_StopSlowMo(INVALID_HANDLE, -1); + Timer_StopSlowMo(null, -1); return Plugin_Continue; } @@ -141,9 +140,9 @@ public void OnClientDisconnect(int client) public Action Timer_GetBossTeam(Handle timer) { - if(cvarKAC && GetConVarBool(cvarKAC)) + if(cvarKAC && cvarKAC.BoolValue) { - SetConVarBool(cvarKAC, false); + cvarKAC.BoolValue=false; } BossTeam=FF2_GetBossTeam(); return Plugin_Continue; @@ -208,11 +207,11 @@ public void FF2_OnAbility(int boss, const char[] pluginName, const char[] abilit else if(StrEqual(abilityName, "explosive dance", false)) { SetEntityMoveType(GetClientOfUserId(FF2_GetBossUserId(boss)), MOVETYPE_NONE); - Handle data; + DataPack data; CreateDataTimer(0.15, Timer_Prepare_Explosion_Rage, data); - WritePackString(data, abilityName); - WritePackCell(data, boss); - ResetPack(data); + data.WriteString(abilityName); + data.WriteCell(boss); + data.Reset(); } else if(StrEqual(abilityName, "slow mo", false)) { @@ -222,7 +221,7 @@ public void FF2_OnAbility(int boss, const char[] pluginName, const char[] abilit void Rage_Clone(const char[] abilityName, int boss) { - Handle bossKV[8]; + KeyValues bossKV[8]; char bossName[32]; bool changeModel=view_as(FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "custom model")); int weaponMode=FF2_GetAbilityArgument(boss, PLUGIN_NAME, abilityName, "allow weapons"); @@ -254,7 +253,7 @@ void Rage_Clone(const char[] abilityName, int boss) } int alive, dead; - Handle players=CreateArray(); + ArrayList players=CreateArray(); for(int target=1; target<=MaxClients; target++) { if(IsClientInGame(target)) @@ -268,7 +267,7 @@ void Rage_Clone(const char[] abilityName, int boss) } else if(FF2_GetBossIndex(target)==-1) //Don't let dead bosses become clones { - PushArrayCell(players, target); + players.Push(target); dead++; } } @@ -280,21 +279,21 @@ void Rage_Clone(const char[] abilityName, int boss) int clone, temp; for(int i=1; i<=dead && i<=totalMinions; i++) { - temp=GetRandomInt(0, GetArraySize(players)-1); - clone=GetArrayCell(players, temp); - RemoveFromArray(players, temp); + temp=GetRandomInt(0, players.Length-1); + clone=players.Get(temp); + players.Erase(temp); FF2_SetFF2Flags(clone, FF2_GetFF2Flags(clone)|FF2FLAG_ALLOWSPAWNINBOSSTEAM|FF2FLAG_CLASSTIMERDISABLED); TF2_ChangeClientTeam(clone, BossTeam); TF2_RespawnPlayer(clone); CloneOwnerIndex[clone]=boss; - TF2_SetPlayerClass(clone, (playerclass ? (view_as(playerclass)) : (view_as(KvGetNum(bossKV[config], "class", 0)))), _, false); + TF2_SetPlayerClass(clone, (playerclass ? (view_as(playerclass)) : (view_as(bossKV[config].GetNum("class", 0)))), _, false); if(changeModel) { if(model[0]=='\0') { - KvGetString(bossKV[config], "model", model, sizeof(model)); + bossKV[config].GetString("model", model, sizeof(model)); } SetVariantString(model); AcceptEntityInput(clone, "SetCustomModel"); @@ -367,12 +366,12 @@ void Rage_Clone(const char[] abilityName, int boss) SDKHook(clone, SDKHook_OnTakeDamage, SaveMinion); CreateTimer(4.0, Timer_Enable_Damage, GetClientUserId(clone), TIMER_FLAG_NO_MAPCHANGE); - Handle data; + DataPack data; CreateDataTimer(0.1, Timer_EquipModel, data, TIMER_FLAG_NO_MAPCHANGE); - WritePackCell(data, GetClientUserId(clone)); - WritePackString(data, model); + data.WriteCell(GetClientUserId(clone)); + data.WriteString(model); } - CloseHandle(players); + delete players; int entity, owner; while((entity=FindEntityByClassname(entity, "tf_wearable"))!=-1) @@ -400,14 +399,14 @@ void Rage_Clone(const char[] abilityName, int boss) } } -public Action Timer_EquipModel(Handle timer, Handle pack) +public Action Timer_EquipModel(Handle timer, DataPack pack) { - ResetPack(pack); - int client=GetClientOfUserId(ReadPackCell(pack)); + pack.Reset(); + int client=GetClientOfUserId(pack.ReadCell()); if(client && IsClientInGame(client) && IsPlayerAlive(client)) { char model[PLATFORM_MAX_PATH]; - ReadPackString(pack, model, PLATFORM_MAX_PATH); + pack.ReadString(model, PLATFORM_MAX_PATH); SetVariantString(model); AcceptEntityInput(client, "SetCustomModel"); SetEntProp(client, Prop_Send, "m_bUseClassAnimations", 1); @@ -520,13 +519,13 @@ void Rage_Bow(int boss) FF2_SetAmmo(client, weapon, ((otherTeamAlivePlayers>=CBS_MAX_ARROWS) ? CBS_MAX_ARROWS : otherTeamAlivePlayers)-1, 1); //Put one arrow in the clip } -public Action Timer_Prepare_Explosion_Rage(Handle timer, Handle data) +public Action Timer_Prepare_Explosion_Rage(Handle timer, DataPack data) { - int boss=ReadPackCell(data); + int boss=data.ReadCell(); int client=GetClientOfUserId(FF2_GetBossUserId(boss)); char abilityName[64]; - ReadPackString(data, abilityName, sizeof(abilityName)); + data.ReadString(abilityName, sizeof(abilityName)); CreateTimer(0.13, Timer_Rage_Explosive_Dance, boss, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); @@ -618,7 +617,7 @@ public Action Timer_Rage_Explosive_Dance(Handle timer, int boss) void Rage_Slowmo(int boss, const char[] abilityName) { FF2_SetFF2Flags(boss, FF2_GetFF2Flags(boss)|FF2FLAG_CHANGECVAR); - SetConVarFloat(cvarTimeScale, FF2_GetAbilityArgumentFloat(boss, PLUGIN_NAME, abilityName, "timescale", 0.1)); + cvarTimeScale.FloatValue=FF2_GetAbilityArgumentFloat(boss, PLUGIN_NAME, abilityName, "timescale", 0.1); float duration=FF2_GetAbilityArgumentFloat(boss, PLUGIN_NAME, abilityName, "duration", 1.0)+1.0; SlowMoTimer=CreateTimer(duration, Timer_StopSlowMo, boss, TIMER_FLAG_NO_MAPCHANGE); FF2Flags[boss]=FF2Flags[boss]|FLAG_ONSLOWMO; @@ -636,9 +635,9 @@ void Rage_Slowmo(int boss, const char[] abilityName) public Action Timer_StopSlowMo(Handle timer, int boss) { - SlowMoTimer=INVALID_HANDLE; + SlowMoTimer=null; oldTarget=0; - SetConVarFloat(cvarTimeScale, 1.0); + cvarTimeScale.FloatValue=1.0; UpdateClientCheatValue(0); if(boss!=-1) { @@ -675,21 +674,21 @@ public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float veloc int target=TR_GetEntityIndex(trace); if(target && target<=MaxClients) { - Handle data; + DataPack data; CreateDataTimer(0.15, Timer_Rage_SlowMo_Attack, data); - WritePackCell(data, GetClientUserId(client)); - WritePackCell(data, GetClientUserId(target)); - ResetPack(data); + data.WriteCell(GetClientUserId(client)); + data.WriteCell(GetClientUserId(target)); + data.Reset(); } - CloseHandle(trace); + delete trace; } return Plugin_Continue; } -public Action Timer_Rage_SlowMo_Attack(Handle timer, Handle data) +public Action Timer_Rage_SlowMo_Attack(Handle timer, DataPack data) { - int client=GetClientOfUserId(ReadPackCell(data)); - int target=GetClientOfUserId(ReadPackCell(data)); + int client=GetClientOfUserId(data.ReadCell()); + int target=GetClientOfUserId(data.ReadCell()); if(client && target && IsClientInGame(client) && IsClientInGame(target)) { float clientPosition[3], targetPosition[3]; @@ -721,13 +720,13 @@ public bool TraceRayDontHitSelf(int entity, int mask) } //Unused single rocket shoot charge -/*Charge_RocketSpawn(const String:abilityName[],index,slot,action) +/*Charge_RocketSpawn(const char[] abilityName, int index, int slot, int action) { if(FF2_GetBossCharge(index,0)<10) return; - new boss=GetClientOfUserId(FF2_GetBossUserId(index)); - new Float:see=FF2_GetAbilityArgumentFloat(index,PLUGIN_NAME,abilityName,1,5.0); - new Float:charge=FF2_GetBossCharge(index,slot); + int boss=GetClientOfUserId(FF2_GetBossUserId(index)); + float see=FF2_GetAbilityArgumentFloat(index,PLUGIN_NAME,abilityName,1,5.0); + float charge=FF2_GetBossCharge(index,slot); switch(action) { case 2: @@ -785,10 +784,10 @@ public bool TraceRayDontHitSelf(int entity, int mask) } */ -public Action OnPlayerDeath(Handle event, const char[] name, bool dontBroadcast) +public Action OnPlayerDeath(Event event, const char[] name, bool dontBroadcast) { - int attacker=GetClientOfUserId(GetEventInt(event, "attacker")); - int client=GetClientOfUserId(GetEventInt(event, "userid")); + int attacker=GetClientOfUserId(event.GetInt("attacker")); + int client=GetClientOfUserId(event.GetInt("userid")); int boss=FF2_GetBossIndex(attacker); if(boss!=-1) @@ -815,7 +814,7 @@ public Action OnPlayerDeath(Handle event, const char[] name, bool dontBroadcast) if(FF2_GetAbilityArgument(boss, PLUGIN_NAME, "spawn model on kill", "remove ragdoll", 0)) { - CreateTimer(0.01, Timer_RemoveRagdoll, GetEventInt(event, "userid"), TIMER_FLAG_NO_MAPCHANGE); + CreateTimer(0.01, Timer_RemoveRagdoll, event.GetInt("userid"), TIMER_FLAG_NO_MAPCHANGE); } int prop=CreateEntityByName("prop_physics_override"); @@ -867,7 +866,7 @@ public Action OnPlayerDeath(Handle event, const char[] name, bool dontBroadcast) } boss=FF2_GetBossIndex(client); - if(boss!=-1 && FF2_HasAbility(boss, PLUGIN_NAME, "spawn clones") && FF2_GetAbilityArgument(boss, PLUGIN_NAME, "spawn clones", "die on boss death", 1) && !(GetEventInt(event, "death_flags") & TF_DEATHFLAG_DEADRINGER)) + if(boss!=-1 && FF2_HasAbility(boss, PLUGIN_NAME, "spawn clones") && FF2_GetAbilityArgument(boss, PLUGIN_NAME, "spawn clones", "die on boss death", 1) && !(event.GetInt("death_flags") & TF_DEATHFLAG_DEADRINGER)) { for(int target=1; target<=MaxClients; target++) { @@ -937,7 +936,7 @@ stock int SpawnWeapon(int client, char[] name, int index, int level, int quality TF2Items_SetNumAttributes(weapon, 0); } - if(weapon==INVALID_HANDLE) + if(weapon==null) { return -1; } @@ -990,7 +989,7 @@ stock void UpdateClientCheatValue(int value) { if(IsClientInGame(client) && !IsFakeClient(client)) { - SendConVarValue(client, cvarCheats, value ? "1" : "0"); + cvarCheats.ReplicateToClient(client, value ? "1" : "0"); } } } diff --git a/addons/sourcemod/scripting/freak_fortress_2/rage_overlay.sp b/addons/sourcemod/scripting/freak_fortress_2/rage_overlay.sp index 61203665..6da5b327 100644 --- a/addons/sourcemod/scripting/freak_fortress_2/rage_overlay.sp +++ b/addons/sourcemod/scripting/freak_fortress_2/rage_overlay.sp @@ -27,12 +27,12 @@ public Plugin myinfo= public void OnPluginStart() { - HookEvent("teamplay_round_start", OnRoundStart); + HookEvent("teamplay_round_start", OnRoundStart, EventHookMode_PostNoCopy); FF2_RegisterSubplugin(PLUGIN_NAME); } -public Action OnRoundStart(Handle event, const char[] name, bool dontBroadcast) +public Action OnRoundStart(Event event, const char[] name, bool dontBroadcast) { if(FF2_IsFF2Enabled()) { @@ -64,7 +64,7 @@ void Rage_Overlay(int boss, const char[] abilityName) { char overlay[PLATFORM_MAX_PATH]; FF2_GetAbilityArgumentString(boss, PLUGIN_NAME, abilityName, "overlay", overlay, sizeof(overlay)); - Format(overlay, PLATFORM_MAX_PATH, "r_screenoverlay \"%s\"", overlay); + Format(overlay, sizeof(overlay), "r_screenoverlay \"%s\"", overlay); SetCommandFlags("r_screenoverlay", GetCommandFlags("r_screenoverlay") & ~FCVAR_CHEAT); for(int target=1; target<=MaxClients; target++) { diff --git a/addons/sourcemod/scripting/freak_fortress_2/special_noanims.sp b/addons/sourcemod/scripting/freak_fortress_2/special_noanims.sp index 74aa590f..ee472468 100644 --- a/addons/sourcemod/scripting/freak_fortress_2/special_noanims.sp +++ b/addons/sourcemod/scripting/freak_fortress_2/special_noanims.sp @@ -40,7 +40,7 @@ public void OnPluginStart() SetFailState("This subplugin depends on at least FF2 v1.10.3"); } - HookEvent("teamplay_round_start", OnRoundStart); + HookEvent("teamplay_round_start", OnRoundStart, EventHookMode_PostNoCopy); FF2_RegisterSubplugin(PLUGIN_NAME); } @@ -164,13 +164,13 @@ stock int SpawnWeapon(int client, char[] name, int index, int level, int quality TF2Items_SetNumAttributes(weapon, 0); } - if(weapon==INVALID_HANDLE) + if(weapon==null) { return -1; } int entity=TF2Items_GiveNamedItem(client, weapon); - CloseHandle(weapon); + delete weapon; EquipPlayerWeapon(client, entity); return entity; } diff --git a/addons/sourcemod/scripting/include/freak_fortress_2.inc b/addons/sourcemod/scripting/include/freak_fortress_2.inc index 110a6162..1a4bea0d 100644 --- a/addons/sourcemod/scripting/include/freak_fortress_2.inc +++ b/addons/sourcemod/scripting/include/freak_fortress_2.inc @@ -109,9 +109,9 @@ native bool FF2_GetBossName(int boss=0, char[] bossName, int length); * Gets a Boss's KV handle * * @param boss Boss's index - * @return Boss's KV handle or INVALID_HANDLE if boss index is invalid + * @return Boss's KV handle or null if boss index is invalid */ -native Handle FF2_GetBossKV(int boss=0); +native KeyValues FF2_GetBossKV(int boss=0); /** * Gets the current health value of the Boss @@ -629,7 +629,7 @@ stock void FF2_ShowHudText(int client, int channel, const char[] buffer, any...) * @param maxStringLength Maximum length of each string buffer. * @return Number of strings retrieved. */ -stock int ExplodeStringIntoArrayList(const char[] text, const char[] split, Handle list, int maxStringLength) +stock int ExplodeStringIntoArrayList(const char[] text, const char[] split, ArrayList list, int maxStringLength) { int reloc_idx, index, total; char[] temp=new char[maxStringLength]; @@ -642,11 +642,11 @@ stock int ExplodeStringIntoArrayList(const char[] text, const char[] split, Hand while((index=SplitString(text[reloc_idx], split, temp, maxStringLength))!=-1) { reloc_idx+=index; - PushArrayString(list, temp); + list.PushString(temp); total++; } - PushArrayString(list, text[reloc_idx]); + list.PushString(text[reloc_idx]); total++; return total; From 1782a593d092cf72c09fd401ae292075e1cfecbf Mon Sep 17 00:00:00 2001 From: naydef Date: Sat, 21 Oct 2017 15:25:57 +0300 Subject: [PATCH 09/12] Even more changes --- .../sourcemod/scripting/freak_fortress_2.sp | 1235 ++++++++--------- 1 file changed, 611 insertions(+), 624 deletions(-) diff --git a/addons/sourcemod/scripting/freak_fortress_2.sp b/addons/sourcemod/scripting/freak_fortress_2.sp index d2dbb337..1e408eaf 100644 --- a/addons/sourcemod/scripting/freak_fortress_2.sp +++ b/addons/sourcemod/scripting/freak_fortress_2.sp @@ -109,43 +109,43 @@ bool bossHasRightMouseAbility[MAXPLAYERS+1]; int timeleft; -Handle cvarVersion; -Handle cvarPointDelay; -Handle cvarAnnounce; -Handle cvarEnabled; -Handle cvarAliveToEnable; -Handle cvarPointType; -Handle cvarCrits; -Handle cvarArenaRounds; -Handle cvarCircuitStun; -Handle cvarSpecForceBoss; -Handle cvarCountdownPlayers; -Handle cvarCountdownTime; -Handle cvarCountdownHealth; -Handle cvarCountdownResult; -Handle cvarEnableEurekaEffect; -Handle cvarForceBossTeam; -Handle cvarHealthBar; -Handle cvarLastPlayerGlow; -Handle cvarBossTeleporter; -Handle cvarBossSuicide; -Handle cvarShieldCrits; -Handle cvarCaberDetonations; -Handle cvarUpdater; -Handle cvarDebug; -Handle cvarPreroundBossDisconnect; - -Handle bossesArray; -Handle bossesArrayShadow; // FIXME: ULTRA HACKY HACK -Handle voicesArray; // TODO: Rename this or remove it in favor of something else -Handle subpluginArray; -Handle chancesArray; +ConVar cvarVersion; +ConVar cvarPointDelay; +ConVar cvarAnnounce; +ConVar cvarEnabled; +ConVar cvarAliveToEnable; +ConVar cvarPointType; +ConVar cvarCrits; +ConVar cvarArenaRounds; +ConVar cvarCircuitStun; +ConVar cvarSpecForceBoss; +ConVar cvarCountdownPlayers; +ConVar cvarCountdownTime; +ConVar cvarCountdownHealth; +ConVar cvarCountdownResult; +ConVar cvarEnableEurekaEffect; +ConVar cvarForceBossTeam; +ConVar cvarHealthBar; +ConVar cvarLastPlayerGlow; +ConVar cvarBossTeleporter; +ConVar cvarBossSuicide; +ConVar cvarShieldCrits; +ConVar cvarCaberDetonations; +ConVar cvarUpdater; +ConVar cvarDebug; +ConVar cvarPreroundBossDisconnect; + +ArrayList bossesArray; +ArrayList bossesArrayShadow; // FIXME: ULTRA HACKY HACK +ArrayList voicesArray; // TODO: Rename this or remove it in favor of something else +ArrayList subpluginArray; +ArrayList chancesArray; Handle FF2Cookie_QueuePoints; Handle FF2Cookie_MuteSound; Handle FF2Cookie_DisplayInfo; -Handle changelogMenu; +Menu changelogMenu; Handle jumpHUD; Handle rageHUD; @@ -193,7 +193,7 @@ float tf_feign_death_activate_damage_scale; float tf_feign_death_damage_scale; char mp_humans_must_join_team[16]; -Handle cvarNextmap; +ConVar cvarNextmap; int FF2CharSet; int validCharsets[64]; @@ -209,7 +209,7 @@ static bool executed2; int changeGamemode; //Handle kvWeaponSpecials; -Handle kvWeaponMods; +KeyValues kvWeaponMods; enum FF2RoundState { @@ -400,25 +400,26 @@ public void OnPluginStart() AddCommandListener(OnJoinTeam, "autoteam"); //Used to make sure players don't kill themselves and change team AddCommandListener(OnChangeClass, "joinclass"); //Used to make sure bosses don't change class - HookConVarChange(cvarEnabled, CvarChange); - HookConVarChange(cvarPointDelay, CvarChange); - HookConVarChange(cvarAnnounce, CvarChange); - HookConVarChange(cvarPointType, CvarChange); - HookConVarChange(cvarPointDelay, CvarChange); - HookConVarChange(cvarAliveToEnable, CvarChange); - HookConVarChange(cvarCrits, CvarChange); - HookConVarChange(cvarCircuitStun, CvarChange); - HookConVarChange(cvarHealthBar, HealthbarEnableChanged); - HookConVarChange(cvarCountdownPlayers, CvarChange); - HookConVarChange(cvarCountdownTime, CvarChange); - HookConVarChange(cvarCountdownHealth, CvarChange); - HookConVarChange(cvarLastPlayerGlow, CvarChange); - HookConVarChange(cvarSpecForceBoss, CvarChange); - HookConVarChange(cvarBossTeleporter, CvarChange); - HookConVarChange(cvarShieldCrits, CvarChange); - HookConVarChange(cvarCaberDetonations, CvarChange); - HookConVarChange(cvarUpdater, CvarChange); - HookConVarChange(cvarNextmap=FindConVar("sm_nextmap"), CvarChangeNextmap); + cvarEnabled.AddChangeHook(CvarChange); + cvarPointDelay.AddChangeHook(CvarChange); + cvarAnnounce.AddChangeHook(CvarChange); + cvarPointType.AddChangeHook(CvarChange); + cvarAliveToEnable.AddChangeHook(CvarChange); + cvarCrits.AddChangeHook(CvarChange); + cvarCircuitStun.AddChangeHook(CvarChange); + cvarHealthBar.AddChangeHook(HealthbarEnableChanged); + cvarCountdownPlayers.AddChangeHook(CvarChange); + cvarCountdownTime.AddChangeHook(CvarChange); + cvarCountdownHealth.AddChangeHook(CvarChange); + cvarLastPlayerGlow.AddChangeHook(CvarChange); + cvarSpecForceBoss.AddChangeHook(CvarChange); + cvarBossTeleporter.AddChangeHook(CvarChange); + cvarShieldCrits.AddChangeHook(CvarChange); + cvarCaberDetonations.AddChangeHook(CvarChange); + cvarUpdater.AddChangeHook(CvarChange); + cvarNextmap=FindConVar("sm_nextmap"); + cvarNextmap.AddChangeHook(CvarChangeNextmap); + RegConsoleCmd("ff2", FF2Panel); RegConsoleCmd("ff2_hp", Command_GetHPCmd); @@ -462,7 +463,7 @@ public void OnPluginStart() voicesArray=CreateArray(); char oldVersion[64]; - GetConVarString(cvarVersion, oldVersion, sizeof(oldVersion)); + cvarVersion.GetString(oldVersion, sizeof(oldVersion)); if(!StrEqual(oldVersion, PLUGIN_VERSION, false)) { PrintToServer("[FF2] Warning: Your config may be outdated. Back up tf/cfg/sourcemod/freak_fortress_2.cfg and delete it, and this plugin will generate a new one that you can then modify to your original values."); @@ -516,7 +517,7 @@ public void OnLibraryAdded(const char[] name) #endif #if defined _updater_included && !defined DEV_REVISION - if(StrEqual(name, "updater") && GetConVarBool(cvarUpdater)) + if(StrEqual(name, "updater") && cvarUpdater.BoolValue) { Updater_AddPlugin(UPDATE_URL); } @@ -542,16 +543,16 @@ public void OnLibraryRemoved(const char[] name) public void OnConfigsExecuted() { - tf_arena_use_queue=GetConVarInt(FindConVar("tf_arena_use_queue")); - mp_teams_unbalance_limit=GetConVarInt(FindConVar("mp_teams_unbalance_limit")); - tf_arena_first_blood=GetConVarInt(FindConVar("tf_arena_first_blood")); - mp_forcecamera=GetConVarInt(FindConVar("mp_forcecamera")); - tf_dropped_weapon_lifetime=view_as(GetConVarInt(FindConVar("tf_dropped_weapon_lifetime"))); - tf_feign_death_activate_damage_scale=GetConVarFloat(FindConVar("tf_feign_death_activate_damage_scale")); - tf_feign_death_damage_scale=GetConVarFloat(FindConVar("tf_feign_death_damage_scale")); - GetConVarString(FindConVar("mp_humans_must_join_team"), mp_humans_must_join_team, sizeof(mp_humans_must_join_team)); + tf_arena_use_queue=FindConVar("tf_arena_use_queue").IntValue; + mp_teams_unbalance_limit=FindConVar("mp_teams_unbalance_limit").IntValue; + tf_arena_first_blood=FindConVar("tf_arena_first_blood").IntValue; + mp_forcecamera=FindConVar("mp_forcecamera").IntValue; + tf_dropped_weapon_lifetime=FindConVar("tf_dropped_weapon_lifetime").BoolValue; + tf_feign_death_activate_damage_scale=FindConVar("tf_feign_death_activate_damage_scale").FloatValue; + tf_feign_death_damage_scale=FindConVar("tf_feign_death_damage_scale").FloatValue; + FindConVar("mp_humans_must_join_team").GetString(mp_humans_must_join_team, sizeof(mp_humans_must_join_team)); - if(IsFF2Map() && GetConVarBool(cvarEnabled)) + if(IsFF2Map() && cvarEnabled.BoolValue) { EnableFF2(); } @@ -561,7 +562,7 @@ public void OnConfigsExecuted() } #if defined _updater_included && !defined DEV_REVISION - if(LibraryExists("updater") && GetConVarBool(cvarUpdater)) + if(LibraryExists("updater") && cvarUpdater.BoolValue) { Updater_AddPlugin(UPDATE_URL); } @@ -571,26 +572,26 @@ public void OnConfigsExecuted() public void OnMapStart() { HPTime=0.0; - doorCheckTimer=INVALID_HANDLE; + doorCheckTimer=null; RoundCount=0; for(int client; client<=MaxClients; client++) { KSpreeTimer[client]=0.0; FF2Flags[client]=0; Incoming[client]=-1; - MusicTimer[client]=INVALID_HANDLE; + MusicTimer[client]=null; } for(int index; index(GetArrayCell(bossesArray, index))!=null) { - CloseHandle(GetArrayCell(bossesArray, index)); + CloseHandle(GetArrayCell(bossesArray, index)); // Use CloseHandle(), because GetArrayCell return any: type SetArrayCell(bossesArray, index, INVALID_HANDLE); } - if(GetArrayCell(bossesArrayShadow, index)!=INVALID_HANDLE) + if(view_as(GetArrayCell(bossesArrayShadow, index))!=null) { - CloseHandle(GetArrayCell(bossesArrayShadow, index)); + CloseHandle(GetArrayCell(bossesArrayShadow, index)); // Use CloseHandle(), because GetArrayCell return any: type SetArrayCell(bossesArrayShadow, index, INVALID_HANDLE); } } @@ -617,13 +618,14 @@ public void EnableFF2() char config[PLATFORM_MAX_PATH]; BuildPath(Path_SM, config, sizeof(config), "%s/%s", FF2_SETTINGS, WEAPONS_CONFIG); - if(kvWeaponMods!=INVALID_HANDLE) + if(kvWeaponMods!=null) { - CloseHandle(kvWeaponMods); + delete kvWeaponMods; } - kvWeaponMods=CreateKeyValues("FF2Weapons"); - if(!FileToKeyValues(kvWeaponMods, config)) + kvWeaponMods=new KeyValues("FF2Weapons"); + + if(!kvWeaponMods.ImportFromFile(config)) { LogError("[FF2 Configs] Failed to load weapon configuration file!"); Enabled=false; @@ -635,30 +637,30 @@ public void EnableFF2() //Cache cvars SetConVarString(FindConVar("ff2_version"), PLUGIN_VERSION); - Announce=GetConVarFloat(cvarAnnounce); - PointType=GetConVarInt(cvarPointType); - PointDelay=GetConVarInt(cvarPointDelay); - AliveToEnable=GetConVarInt(cvarAliveToEnable); - BossCrits=GetConVarBool(cvarCrits); - arenaRounds=GetConVarInt(cvarArenaRounds); - circuitStun=GetConVarFloat(cvarCircuitStun); - countdownHealth=GetConVarInt(cvarCountdownHealth); - countdownPlayers=GetConVarInt(cvarCountdownPlayers); - countdownTime=GetConVarInt(cvarCountdownTime); - lastPlayerGlow=GetConVarBool(cvarLastPlayerGlow); - bossTeleportation=GetConVarBool(cvarBossTeleporter); - shieldCrits=GetConVarInt(cvarShieldCrits); - allowedDetonations=GetConVarInt(cvarCaberDetonations); + Announce=cvarAnnounce.FloatValue; + PointType=cvarPointType.IntValue; + PointDelay=cvarPointDelay.IntValue; + AliveToEnable=cvarAliveToEnable.IntValue; + BossCrits=cvarCrits.BoolValue; + arenaRounds=cvarArenaRounds.IntValue; + circuitStun=cvarCircuitStun.FloatValue; + countdownHealth=cvarCountdownHealth.IntValue; + countdownPlayers=cvarCountdownPlayers.IntValue; + countdownTime=cvarCountdownTime.IntValue; + lastPlayerGlow=cvarLastPlayerGlow.BoolValue; + bossTeleportation=cvarBossTeleporter.BoolValue; + shieldCrits=cvarShieldCrits.IntValue; + allowedDetonations=cvarCaberDetonations.IntValue; //Set some Valve cvars to what we want them to be - SetConVarInt(FindConVar("tf_arena_use_queue"), 0); - SetConVarInt(FindConVar("mp_teams_unbalance_limit"), 0); - SetConVarInt(FindConVar("tf_arena_first_blood"), 0); - SetConVarInt(FindConVar("mp_forcecamera"), 0); - SetConVarInt(FindConVar("tf_dropped_weapon_lifetime"), 0); - SetConVarFloat(FindConVar("tf_feign_death_activate_damage_scale"), 0.3); - SetConVarFloat(FindConVar("tf_feign_death_damage_scale"), 0.0); - SetConVarString(FindConVar("mp_humans_must_join_team"), "any"); + FindConVar("tf_arena_use_queue").SetInt(0); + FindConVar("mp_teams_unbalance_limit").SetInt(0); + FindConVar("tf_arena_first_blood").SetInt(0); + FindConVar("mp_forcecamera").SetInt(0); + FindConVar("tf_dropped_weapon_lifetime").SetInt(0); + FindConVar("tf_feign_death_activate_damage_scale").SetFloat(0.3); + FindConVar("tf_feign_death_damage_scale").SetFloat(0.0); + FindConVar("mp_humans_must_join_team").SetString("any"); float time=Announce; if(time>1.0) @@ -671,7 +673,7 @@ public void EnableFF2() FindCharacters(); strcopy(FF2CharSetString, 2, ""); - bMedieval=FindEntityByClassname(-1, "tf_logic_medieval")!=-1 || view_as(GetConVarInt(FindConVar("tf_medieval"))); + bMedieval=FindEntityByClassname(-1, "tf_logic_medieval")!=-1 || FindConVar("tf_medieval").BoolValue; FindHealthBar(); #if defined _steamtools_included @@ -691,36 +693,34 @@ public void DisableFF2() Enabled=false; Enabled2=false; - SetConVarInt(FindConVar("tf_arena_use_queue"), tf_arena_use_queue); - SetConVarInt(FindConVar("mp_teams_unbalance_limit"), mp_teams_unbalance_limit); - SetConVarInt(FindConVar("tf_arena_first_blood"), tf_arena_first_blood); - SetConVarInt(FindConVar("mp_forcecamera"), mp_forcecamera); - SetConVarInt(FindConVar("tf_dropped_weapon_lifetime"), tf_dropped_weapon_lifetime); - SetConVarFloat(FindConVar("tf_feign_death_activate_damage_scale"), tf_feign_death_activate_damage_scale); - SetConVarFloat(FindConVar("tf_feign_death_damage_scale"), tf_feign_death_damage_scale); - SetConVarString(FindConVar("mp_humans_must_join_team"), mp_humans_must_join_team); + FindConVar("tf_arena_use_queue").SetInt(tf_arena_use_queue); + FindConVar("mp_teams_unbalance_limit").SetInt(mp_teams_unbalance_limit); + FindConVar("tf_arena_first_blood").SetInt(tf_arena_first_blood); + FindConVar("mp_forcecamera").SetInt(mp_forcecamera); + FindConVar("tf_dropped_weapon_lifetime").SetInt(tf_dropped_weapon_lifetime); + FindConVar("tf_feign_death_activate_damage_scale").SetFloat(tf_feign_death_activate_damage_scale); + FindConVar("tf_feign_death_damage_scale").SetFloat(tf_feign_death_damage_scale); + FindConVar("mp_humans_must_join_team").SetString(mp_humans_must_join_team); - if(doorCheckTimer!=INVALID_HANDLE) + if(doorCheckTimer!=null) { KillTimer(doorCheckTimer); - doorCheckTimer=INVALID_HANDLE; + doorCheckTimer=null; } for(int client=1; client<=MaxClients; client++) { if(IsValidClient(client)) { - if(BossInfoTimer[client][1]!=INVALID_HANDLE) + if(BossInfoTimer[client][1]!=null) { - KillTimer(BossInfoTimer[client][1]); - BossInfoTimer[client][1]=INVALID_HANDLE; + delete BossInfoTimer[client][1]; } } - if(MusicTimer[client]!=INVALID_HANDLE) + if(MusicTimer[client]!=null) { - KillTimer(MusicTimer[client]); - MusicTimer[client]=INVALID_HANDLE; + delete MusicTimer[client]; } bossHasReloadAbility[client]=false; @@ -751,8 +751,8 @@ public void FindCharacters() return; } - Handle kv=CreateKeyValues(""); - FileToKeyValues(kv, config); + KeyValues kv=new KeyValues(""); + kv.ImportFromFile(config); Action action; Call_StartForward(OnLoadCharacterSet); @@ -765,10 +765,10 @@ public void FindCharacters() { int i; - KvRewind(kv); - while(KvGotoNextKey(kv)) + kv.Rewind(); + while(kv.GotoNextKey()) { - KvGetSectionName(kv, config, sizeof(config)); + kv.GetSectionName(config, sizeof(config)); if(StrEqual(config, charset)) { FF2CharSet=i; @@ -780,15 +780,15 @@ public void FindCharacters() } } - KvRewind(kv); - KvJumpToKey(kv, FF2CharSetString); // This *should* always return true + kv.Rewind(); + kv.JumpToKey(FF2CharSetString); // This *should* always return true - if(KvGotoFirstSubKey(kv, false)) + if(kv.GotoFirstSubKey(false)) { int index; do { - KvGetSectionName(kv, config, sizeof(config)); + kv.GetSectionName(config, sizeof(config)); int chance=KvGetNum(kv, NULL_STRING, -1); if(chance<0) @@ -816,7 +816,7 @@ public void FindCharacters() return; } - CloseHandle(kv); + delete kv; if(FileExists("sound/saxton_hale/9000.wav", true)) { @@ -846,38 +846,38 @@ stock void ParseChangelog() return; } - Handle kv=CreateKeyValues("Changelog"); - FileToKeyValues(kv, changelog); + KeyValues kv=new KeyValues("Changelog"); + kv.ImportFromFile(changelog); changelogMenu=CreateMenu(Handler_ChangelogMenu); - SetMenuTitle(changelogMenu, "%t", "Changelog"); + changelogMenu.SetTitle("%t", "Changelog"); int i, j; - if(KvGotoFirstSubKey(kv)) + if(kv.GotoFirstSubKey()) { char version[64], text[256], temp[70]; do { - KvGetSectionName(kv, version, sizeof(version)); + kv.GetSectionName(version, sizeof(version)); Format(temp, sizeof(temp), "%i", i); - AddMenuItem(changelogMenu, temp, version, ITEMDRAW_DISABLED); + changelogMenu.AddItem(temp, version, ITEMDRAW_DISABLED); i++; - if(KvGotoFirstSubKey(kv, false)) + if(kv.GotoFirstSubKey(false)) { j=0; do { - KvGetString(kv, NULL_STRING, text, sizeof(text)); + kv.GetString(NULL_STRING, text, sizeof(text)); Format(temp, sizeof(temp), "%s %i", version, j); - AddMenuItem(changelogMenu, temp, text, ITEMDRAW_DISABLED); + changelogMenu.AddItem(temp, text, ITEMDRAW_DISABLED); j++; } - while(KvGotoNextKey(kv, false)); - KvGoBack(kv); + while(kv.GotoNextKey(false)); + kv.GoBack(); } } - while(KvGotoNextKey(kv)); + while(kv.GotoNextKey()); } else { @@ -895,56 +895,56 @@ public void LoadCharacter(const char[] characterName) return; } - Handle kv=CreateKeyValues("character"); + KeyValues kv=new KeyValues("character"); PushArrayCell(bossesArray, kv); - FileToKeyValues(kv, config); + kv.ImportFromFile(config); - kv=CreateKeyValues("character"); + kv=new KeyValues("character"); PushArrayCell(bossesArrayShadow, kv); - FileToKeyValues(kv, config); + kv.ImportFromFile(config); - int version=KvGetNum(kv, "version", 1); + int version=kv.GetNum("version", 1); if(version!=StringToInt(MAJOR_REVISION)) { LogError("[FF2 Bosses] Character %s is only compatible with FF2 v%i!", characterName, version); return; } - if(KvJumpToKey(kv, "abilities")) + if(kv.JumpToKey("abilities")) { - if(KvGotoFirstSubKey(kv)) + if(kv.GotoFirstSubKey()) { char pluginName[64]; do { - KvGetSectionName(kv, pluginName, sizeof(pluginName)); + kv.GetSectionName(pluginName, sizeof(pluginName)); if(FindStringInArray(subpluginArray, pluginName)<0) { LogError("[FF2 Bosses] Character %s needs plugin %s!", characterName, pluginName); return; } } - while(KvGotoNextKey(kv)); + while(kv.GotoNextKey()); } } - KvRewind(kv); + kv.Rewind(); char file[PLATFORM_MAX_PATH], section[64]; char extensions[][]={".mdl", ".dx80.vtx", ".dx90.vtx", ".sw.vtx", ".vvd"}; - KvSetString(kv, "filename", characterName); - KvGetString(kv, "name", config, sizeof(config)); - PushArrayCell(voicesArray, KvGetNum(kv, "block voice", 0)); - KvGotoFirstSubKey(kv); + kv.SetString("filename", characterName); + kv.GetString("name", config, sizeof(config)); + PushArrayCell(voicesArray, kv.GetNum("block voice", 0)); + kv.GotoFirstSubKey(); - while(KvGotoNextKey(kv)) + while(kv.GotoNextKey()) { - KvGetSectionName(kv, section, sizeof(section)); + kv.GetSectionName(section, sizeof(section)); if(StrEqual(section, "downloads")) { - while(KvGotoNextKey(kv)) + while(kv.GotoNextKey()) { - KvGetSectionName(kv, file, sizeof(file)); - if(KvGetNum(kv, "model")) + kv.GetSectionName(file, sizeof(file)); + if(kv.GetNum("model")) { for(int extension; extension(GetEventInt(event, "team"))==BossTeam)) + if((view_as(event.GetInt("team"))==BossTeam)) { bossWin=true; if(FindSound("win", sound, sizeof(sound))) @@ -1662,7 +1658,7 @@ public Action OnRoundEnd(Handle event, const char[] name, bool dontBroadcast) } StopMusic(); - DrawGameTimer=INVALID_HANDLE; + DrawGameTimer=null; bool isBossAlive; for(int boss; boss<=MaxClients; boss++) @@ -1693,10 +1689,9 @@ public Action OnRoundEnd(Handle event, const char[] name, bool dontBroadcast) for(int timer; timer<=1; timer++) { - if(BossInfoTimer[boss][timer]!=INVALID_HANDLE) + if(BossInfoTimer[boss][timer]!=null) { - KillTimer(BossInfoTimer[boss][timer]); - BossInfoTimer[boss][timer]=INVALID_HANDLE; + delete BossInfoTimer[boss][timer]; } } } @@ -1806,10 +1801,10 @@ public Action OnRoundEnd(Handle event, const char[] name, bool dontBroadcast) return Plugin_Continue; } -public Action OnBroadcast(Handle event, const char[] name, bool dontBroadcast) +public Action OnBroadcast(Event event, const char[] name, bool dontBroadcast) { char sound[PLATFORM_MAX_PATH]; - GetEventString(event, "sound", sound, sizeof(sound)); + event.GetString("sound", sound, sizeof(sound)); if(!StrContains(sound, "Game.Your", false) || StrEqual(sound, "Game.Stalemate", false)) { return Plugin_Handled; @@ -1835,8 +1830,8 @@ public Action Timer_CalcQueuePoints(Handle timer) if(IsValidClient(client)) { damage=Damage[client]; - Handle event=CreateEvent("player_escort_score", true); - SetEventInt(event, "player", client); + Event event=CreateEvent("player_escort_score", true); + event.SetInt("player", client); int points; while(damage-600>0) @@ -1844,8 +1839,8 @@ public Action Timer_CalcQueuePoints(Handle timer) damage-=600; points++; } - SetEventInt(event, "points", points); - FireEvent(event); + event.SetInt("points", points); + event.Fire(); if(IsBoss(client)) { @@ -1979,16 +1974,14 @@ public Action Timer_PrepareBGM(Handle timer, int userid) StopMusic(client); RequestFrame(PlayBGM, client); // Naydef: We might start playing the music before it gets stopped } - else if(MusicTimer[client]!=INVALID_HANDLE) + else if(MusicTimer[client]!=null) { - KillTimer(MusicTimer[client]); - MusicTimer[client]=INVALID_HANDLE; + delete MusicTimer[client]; } } - else if(MusicTimer[client]!=INVALID_HANDLE) + else if(MusicTimer[client]!=null) { - KillTimer(MusicTimer[client]); - MusicTimer[client]=INVALID_HANDLE; + delete MusicTimer[client]; } } } @@ -1999,10 +1992,9 @@ public Action Timer_PrepareBGM(Handle timer, int userid) StopMusic(client); RequestFrame(PlayBGM, client); // Naydef: We might start playing the music before it gets stopped } - else if(MusicTimer[client]!=INVALID_HANDLE) + else if(MusicTimer[client]!=null) { - KillTimer(MusicTimer[client]); - MusicTimer[client]=INVALID_HANDLE; + delete MusicTimer[client]; return Plugin_Stop; } } @@ -2011,53 +2003,53 @@ public Action Timer_PrepareBGM(Handle timer, int userid) void PlayBGM(int client) { - Handle kv=GetArrayCell(bossesArray, character[0]); - KvRewind(kv); - if(KvJumpToKey(kv, "sounds")) + KeyValues kv=GetArrayCell(bossesArray, character[0]); + kv.Rewind(); + if(kv.JumpToKey("sounds")) { - Handle musicArray=CreateArray(PLATFORM_MAX_PATH); - Handle timeArray=CreateArray(); + ArrayList musicArray=CreateArray(PLATFORM_MAX_PATH); + ArrayList timeArray=CreateArray(); char music[PLATFORM_MAX_PATH]; - KvGotoFirstSubKey(kv); + kv.GotoFirstSubKey(); do { - KvGetSectionName(kv, music, sizeof(music)); - int time=KvGetNum(kv, "time"); + kv.GetSectionName(music, sizeof(music)); + int time=kv.GetNum("time"); if(time>0) { - if(FindStringInArray(musicArray, music)>=0) + if(musicArray.FindString(music)>=0) { char bossName[64]; - KvRewind(kv); - KvGetString(kv, "name", bossName, sizeof(bossName)); + kv.Rewind(); + kv.GetString("name", bossName, sizeof(bossName)); PrintToServer("[FF2 Bosses] Character %s has a duplicate sound '%s'!", bossName, music); continue; // We ignore all duplicates } - PushArrayString(musicArray, music); - PushArrayCell(timeArray, time); + musicArray.PushString(music); + timeArray.Push(time); } else if(time<0) { char bossName[64]; - KvRewind(kv); - KvGetString(kv, "name", bossName, sizeof(bossName)); + kv.Rewind(); + kv.GetString("name", bossName, sizeof(bossName)); PrintToServer("[FF2 Bosses] Character %s has an invalid time for sound '%s'!", bossName, music); } } - while(KvGotoNextKey(kv)); + while(kv.GotoNextKey()); - if(!GetArraySize(musicArray)) // No music found, exiting! + if(!musicArray.Length) // No music found, exiting! { return; } - int index=GetRandomInt(0, GetArraySize(musicArray)-1); + int index=GetRandomInt(0, musicArray.Length-1); Action action; Call_StartForward(OnMusic); char temp[PLATFORM_MAX_PATH]; char buffer[PLATFORM_MAX_PATH]; - int time2=GetArrayCell(timeArray, index); - GetArrayString(musicArray, index, temp, sizeof(temp)); + int time2=timeArray.Get(index); + musicArray.GetString(index, temp, sizeof(temp)); Call_PushCell(client); Call_PushStringEx(temp, sizeof(temp), SM_PARAM_STRING_UTF8 | SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); Call_PushCellRef(time2); @@ -2070,18 +2062,18 @@ void PlayBGM(int client) } case Plugin_Changed: { - SetArrayString(musicArray, index, temp); - SetArrayCell(timeArray, index, time2); + musicArray.SetString(index, temp); + timeArray.Set(index, time2); } } - GetArrayString(musicArray, index, buffer, sizeof(buffer)); + musicArray.GetString(index, buffer, sizeof(buffer)); Format(temp, sizeof(temp), "sound/%s", buffer); if(FileExists(temp, true)) { if(CheckSoundFlags(client, FF2SOUND_MUTEMUSIC)) { - GetArrayString(musicArray, index, currentBGM[client], sizeof(music)); + musicArray.GetString(index, currentBGM[client], sizeof(music)); EmitSoundToClient(client, currentBGM[client]); MusicTimer[client]=CreateTimer(float(GetArrayCell(timeArray, index)), Timer_PrepareBGM, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE); } @@ -2089,8 +2081,8 @@ void PlayBGM(int client) else { char bossName[64]; - KvRewind(kv); - KvGetString(kv, "name", bossName, sizeof(bossName)); + kv.Rewind(); + kv.GetString("name", bossName, sizeof(bossName)); PrintToServer("[FF2 Bosses] Character %s is missing BGM file '%s'!", bossName, music); } } @@ -2130,10 +2122,9 @@ void StopMusic(int client=0, bool permanent=false) { StopSound(client, SNDCHAN_AUTO, currentBGM[client]); - if(MusicTimer[client]!=INVALID_HANDLE) + if(MusicTimer[client]!=null) { - KillTimer(MusicTimer[client]); - MusicTimer[client]=INVALID_HANDLE; + delete MusicTimer[client]; } } @@ -2149,10 +2140,9 @@ void StopMusic(int client=0, bool permanent=false) StopSound(client, SNDCHAN_AUTO, currentBGM[client]); StopSound(client, SNDCHAN_AUTO, currentBGM[client]); - if(MusicTimer[client]!=INVALID_HANDLE) + if(MusicTimer[client]!=null) { - KillTimer(MusicTimer[client]); - MusicTimer[client]=INVALID_HANDLE; + delete MusicTimer[client]; } strcopy(currentBGM[client], PLATFORM_MAX_PATH, ""); @@ -2288,7 +2278,7 @@ public Action MessageTimer(Handle timer) AcceptEntityInput(entity, "Unlock"); } - if(doorCheckTimer==INVALID_HANDLE) + if(doorCheckTimer==null) { doorCheckTimer=CreateTimer(5.0, Timer_CheckDoors, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); } @@ -2356,31 +2346,31 @@ void EquipBoss(int boss) TF2_RemoveAllWeapons(client); char classname[64], attributes[256], bossName[64]; - Handle kv=GetArrayCell(bossesArray, character[boss]); - KvRewind(kv); - KvGetString(kv, "name", bossName, sizeof(bossName), "=Failed Name="); - if(KvJumpToKey(kv, "weapons")) + KeyValues kv=GetArrayCell(bossesArray, character[boss]); + kv.Rewind(); + kv.GetString("name", bossName, sizeof(bossName), "=Failed Name="); + if(kv.JumpToKey("weapons")) { - KvGotoFirstSubKey(kv); + kv.GotoFirstSubKey(); do { char sectionName[32]; - KvGetSectionName(kv, sectionName, sizeof(sectionName)); + kv.GetSectionName(sectionName, sizeof(sectionName)); int index=StringToInt(sectionName); //NOTE: StringToInt returns 0 on failure which corresponds to tf_weapon_bat, //so there's no way to distinguish between an invalid string and 0. //Blocked on bug 6438: https://bugs.alliedmods.net/show_bug.cgi?id=6438 if(index>=0) { - KvJumpToKey(kv, sectionName); - KvGetString(kv, "classname", classname, sizeof(classname)); + kv.JumpToKey(sectionName); + kv.GetString("classname", classname, sizeof(classname)); if(classname[0]=='\0') { LogError("[FF2 Bosses] No classname specified for weapon %i (character %s)!", index, bossName); continue; } - KvGetString(kv, "attributes", attributes, sizeof(attributes)); + kv.GetString("attributes", attributes, sizeof(attributes)); if(attributes[0]!='\0') { Format(attributes, sizeof(attributes), "68 ; %i ; 2 ; 3.1 ; %s", TF2_GetPlayerClass(client)==TFClass_Scout ? 1 : 2 , attributes); @@ -2412,7 +2402,7 @@ void EquipBoss(int boss) SetEntProp(weapon, Prop_Send, "m_aBuildableObjectTypes", 1, _, 3); } - if(!KvGetNum(kv, "show", 0)) + if(!kv.GetNum("show", 0)) { SetEntPropFloat(weapon, Prop_Send, "m_flModelScale", 0.001); } @@ -2423,11 +2413,11 @@ void EquipBoss(int boss) LogError("[FF2 Bosses] Invalid weapon index %s specified for character %s!", sectionName, bossName); } } - while(KvGotoNextKey(kv)); + while(kv.GotoNextKey()); } - KvRewind(kv); - TFClassType playerclass=view_as(KvGetNum(kv, "class", 1)); + kv.Rewind(); + TFClassType playerclass=view_as(kv.GetNum("class", 1)); if(TF2_GetPlayerClass(client)!=playerclass) { TF2_SetPlayerClass(client, playerclass, _, !GetEntProp(client, Prop_Send, "m_iDesiredPlayerClass") ? true : false); @@ -2454,8 +2444,8 @@ public Action MakeBoss(Handle timer, int boss) } } - Handle kv=GetArrayCell(bossesArray, character[boss]); - KvRewind(kv); + KeyValues kv=GetArrayCell(bossesArray, character[boss]); + kv.Rewind(); if(TF2_GetClientTeam(client)!=BossTeam) { AssignTeam(client, BossTeam); @@ -2469,10 +2459,10 @@ public Action MakeBoss(Handle timer, int boss) SetEntProp(client, Prop_Send, "m_bGlowEnabled", 0); TF2_RemovePlayerDisguise(client); - TF2_SetPlayerClass(client, view_as(KvGetNum(kv, "class", 1)), _, !GetEntProp(client, Prop_Send, "m_iDesiredPlayerClass") ? true : false); + TF2_SetPlayerClass(client, view_as(kv.GetNum("class", 1)), _, !GetEntProp(client, Prop_Send, "m_iDesiredPlayerClass") ? true : false); SDKHook(client, SDKHook_GetMaxHealth, OnGetMaxHealth); //Temporary: Used to prevent boss overheal - switch(KvGetNum(kv, "pickups", 0)) //Check if the boss is allowed to pickup health/ammo + switch(kv.GetNum("pickups", 0)) //Check if the boss is allowed to pickup health/ammo { case 1: { @@ -2537,29 +2527,29 @@ public Action MakeBoss(Handle timer, int boss) /*Soon(TM) void CreateWeaponModsKeyValues() { - if(kvWeaponSpecials!=INVALID_HANDLE) + if(kvWeaponSpecials!=null) { - CloseHandle(kvWeaponSpecials); + delete kvWeaponSpecials; } - kvWeaponSpecials=CreateKeyValues("WeaponSpecials"); + kvWeaponSpecials=KeyValues("WeaponSpecials"); for(int i=0; i-1) { flags|=OVERRIDE_ITEM_LEVEL; @@ -2615,7 +2604,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe level=1; } - int quality=KvGetNum(kvWeaponMods, "quality", -1); + int quality=kvWeaponMods.GetNum("quality", -1); if(quality>-1) { flags|=OVERRIDE_ITEM_QUALITY; @@ -2633,18 +2622,17 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe int entity=TF2Items_GiveNamedItem(client, weapon); EquipPlayerWeapon(client, entity); - CloseHandle(weapon); - weapon=INVALID_HANDLE; + delete weapon; - KvGoBack(kvWeaponMods); + kvWeaponMods.GoBack(); } - if(KvJumpToKey(kvWeaponMods, "add")) + if(kvWeaponMods.JumpToKey("add")) { Debug("\tEntered add"); char attributes[32][8]; int attribCount; - for(int key; KvGotoNextKey(kvWeaponMods); key+=2) + for(int key; kvWeaponMods.GotoNextKey(); key+=2) { if(key>=32) { @@ -2653,8 +2641,8 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe } attribCount++; - KvGetSectionName(kvWeaponMods, attributes[key], 8); - KvGetString(kvWeaponMods, attributes[key], attributes[key+1], 8); + kvWeaponMods.GetSectionName(attributes[key], 8); + kvWeaponMods.GetString(attributes[key], attributes[key+1], 8); Debug("\t\tAttribute set %i is %s ; %s", attribCount, attributes[key], attributes[key+1]); } @@ -2680,17 +2668,17 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe } } } - KvGoBack(kvWeaponMods); + kvWeaponMods.GoBack(); } - if(KvJumpToKey(kvWeaponMods, "remove")) + if(kvWeaponMods.JumpToKey("remove")) { Debug("\tEntered remove"); char attributes[16][8]; int entity=FindEntityByClassname(-1, classname); - for(int key; KvGotoNextKey(kvWeaponMods) && key<16; key++) + for(int key; kvWeaponMods.GotoNextKey() && key<16; key++) { - KvGetSectionName(kvWeaponMods, attributes[key], 8); + kvWeaponMods.GetSectionName(attributes[key], 8); int attribute=StringToInt(attributes[key]); if(!attribute) //StringToInt will return 0 on failure, which probably means the attribute was specified by name, not index { @@ -2716,26 +2704,26 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe Debug("\t\tRemoved attribute %i", attribute); } } - KvGoBack(kvWeaponMods); + kvWeaponMods.GoBack(); } - /*if(KvJumpToKey(kvWeaponMods, "remove")) //TODO: remove-all (TF2Attrib) + /*if(kvWeaponMods.JumpToKey("remove")) //TODO: remove-all (TF2Attrib) { Debug("\tEntered remove"); - if(KvGotoFirstSubKey(kvWeaponMods, false)) + if(kvWeaponMods.GotoFirstSubKey(false)) { Debug("\t\tEntered first subkey"); int attributes[64]; int attribCount=1; - attributes[0]=KvGetNum(kvWeaponMods, "1"); + attributes[0]=kvWeaponMods.GetNum("1"); Debug("\t\tKeyvalues classname>removeattribs: First attrib was %i", attributes[0]); - for(int key=2; KvGotoNextKey(kvWeaponMods, false); key++) + for(int key=2; kvWeaponMods.GotoNextKey(false); key++) { char temp[4]; IntToString(key, temp, sizeof(temp)); - attributes[key]=KvGetNum(kvWeaponMods, temp); + attributes[key]=kvWeaponMods.GetNum(temp); Debug("\t\tKeyvalues classname>removeattribs: Got attrib %i", attributes[key]); attribCount++; } @@ -2749,8 +2737,8 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe if(!attributes[attribute]) { LogError("[FF2 Weapons] Bad weapon attribute passed for weapon %s", classname); - CloseHandle(weapon); - weapon=INVALID_HANDLE; + delete weapon; + weapon=null; return Plugin_Stop; } @@ -2768,25 +2756,25 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe { LogError("[FF2 Weapons] There was nothing under \"remove\" for classname %s!", classname); } - KvGoBack(kvWeaponMods); + kvWeaponMods.GoBack(); }*/ - /*if(KvJumpToKey(kvWeaponMods, "add")) //TODO: Preserve attributes + /*if(kvWeaponMods.JumpToKey("add")) //TODO: Preserve attributes { - if(KvGotoFirstSubKey(kvWeaponMods, false)) + if(kvWeaponMods.GotoFirstSubKey(false)) { Debug("\t\tEntered first subkey"); char attributes[64][64]; int attribCount=1; - KvGetSectionName(kvWeaponMods, attributes[0], sizeof(attributes)); - KvGetString(kvWeaponMods, attributes[0], attributes[1], sizeof(attributes)); + kvWeaponMods.GetSectionName(attributes[0], sizeof(attributes)); + kvWeaponMods.GetString(attributes[0], attributes[1], sizeof(attributes)); Debug("\t\tFirst attrib set was %s ; %s", attributes[0], attributes[1]); - for(int key=3; KvGotoNextKey(kvWeaponMods); key+=2) + for(int key=3; kvWeaponMods.GotoNextKey(); key+=2) { - KvGetSectionName(kvWeaponMods, attributes[key], sizeof(attributes)); - KvGetString(kvWeaponMods, attributes[key], attributes[key+1], sizeof(attributes)); + kvWeaponMods.GetSectionName(attributes[key], sizeof(attributes)); + kvWeaponMods.GetString(attributes[key], attributes[key+1], sizeof(attributes)); Debug("\t\tGot attrib set %s ; %s", attributes[key], attributes[key+1]); attribCount++; } @@ -2806,8 +2794,8 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe if(attrib==0) { LogError("[FF2 Weapons] Bad weapon attribute passed for weapon %s: %s ; %s", classname, attributes[attribute], attributes[attribute+1]); - CloseHandle(weapon); - weapon=INVALID_HANDLE; + delete weapon; + weapon=null; return Plugin_Stop; } @@ -2824,7 +2812,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe { LogError("[FF2 Weapons] There was nothing under \"Addattribs\" for classname %s!", classname); } - KvGoBack(kvWeaponMods); + kvWeaponMods.GoBack(); }*/ } @@ -2832,8 +2820,8 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe { Debug("Keyvalues differentClass: Gave weapon!"); TF2Items_GiveNamedItem(client, weapon); - CloseHandle(weapon); - weapon=INVALID_HANDLE; + delete weapon; + weapon=null; return Plugin_Stop; }*/ } @@ -2843,7 +2831,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe case 38, 457: //Axtinguisher, Postal Pummeler { Handle itemOverride=PrepareItemHandle(item, _, _, "", false); - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2856,7 +2844,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe //58: 220% self damage force //144: NOPE //207: +33% damage to self - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2865,7 +2853,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe case 40, 1146: //Backburner, Festive Backburner { Handle itemOverride=PrepareItemHandle(item, _, _, "165 ; 1.0"); - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2877,7 +2865,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe //85: +50% time needed to regen cloak //157: +1 second needed to fully disguise //253: +1 second needed to fully cloak - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2891,7 +2879,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe //128: Only when weapon is active //191: -7 health/second //772: Holsters 50% slower - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2902,7 +2890,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe Handle itemOverride=PrepareItemHandle(item, _, _, "2 ; 1.5 ; 76 ; 2"); //2: +50% damage //76: +100% ammo - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2911,7 +2899,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe /*case 132, 266, 482: //Eyelander, HHHH, Nessie's Nine Iron - commented out because { Handle itemOverride=PrepareItemHandle(item, _, _, "202 ; 0.5 ; 125 ; -15", false); - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2920,7 +2908,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe case 226: //Battalion's Backup { Handle itemOverride=PrepareItemHandle(item, _, _, "140 ; 10.0"); - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2929,7 +2917,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe case 231: //Darwin's Danger Shield { Handle itemOverride=PrepareItemHandle(item, _, _, "26 ; 50"); //+50 health - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2940,7 +2928,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe Handle itemOverride=PrepareItemHandle(item, _, _, "2 ; 1.2 ; 17 ; 0.15"); //2: +20% damage //17: +15% uber on hit - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2952,7 +2940,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe //205: -80% damage from ranged while active //206: +100% damage from melee while active //772: Holsters 100% slower - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2966,7 +2954,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe //114: Mini-crits targets launched airborne by explosions, grapple hooks or enemy attacks //179: Minicrits become crits //547: Deploys 40% faster - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2980,7 +2968,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe { Handle itemOverride=PrepareItemHandle(item, _, _, "279 ; 2.0"); //279: 2 ornaments - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2992,7 +2980,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe //199: Holsters 100% faster //547: Deploys 100% faster //Other attributes: Because TF2Items doesn't feel like stripping the Holiday Punch's attributes for some reason - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -3010,7 +2998,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe //532: Hype decays //651: Fire rate increases as health decreases //709: Weapon spread increases as health decreases - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -3020,7 +3008,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe { Handle itemOverride=PrepareItemHandle(item, _, _, "179 ; 1"); //179: Crit instead of mini-critting - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -3043,7 +3031,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe //114: Mini-crits targets launched airborne by explosions, grapple hooks or enemy attacks } - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -3055,7 +3043,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe Handle itemOverride=PrepareItemHandle(item, _, _, "17 ; 0.05 ; 144 ; 1", false); //17: 5% uber on hit //144: Sets weapon mode - *possibly* the overdose speed effect - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -3070,7 +3058,7 @@ public Action TF2Items_OnGiveNamedItem(int client, char[] classname, int iItemDe //199: Deploys 25% faster //314: Ubercharge lasts 4 seconds longer (aka 50% longer) //547: Holsters 25% faster - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -3112,7 +3100,7 @@ public Action Timer_NoHonorBound(Handle timer, int userid) * @param attributeList String of attributes in a 'name ; value' pattern (optional) * @param preserve Whether to preserve existing attributes or to overwrite them * - * @return Item handle on success, INVALID_HANDLE on failure + * @return Item handle on success, null on failure */ stock Handle PrepareItemHandle(Handle item, char[] classname="", int index=-1, const char[] attributeList="", bool preserve=true) { @@ -3128,10 +3116,9 @@ stock Handle PrepareItemHandle(Handle item, char[] classname="", int index=-1, c if(attributeList[0]!='\0') // Ignore empty attribute list { LogError("[FF2 Weapons] Unbalanced attributes array '%s' for weapon %s", attributeList, classname); - if(weapon!=INVALID_HANDLE) + if(weapon!=null) { - CloseHandle(weapon); - weapon=INVALID_HANDLE; + delete weapon; } return weapon; } @@ -3143,10 +3130,9 @@ stock Handle PrepareItemHandle(Handle item, char[] classname="", int index=-1, c else if(count % 2) // Unbalanced array, eg "2 ; 10 ; 3" { LogError("[FF2 Weapons] Unbalanced attributes array %s for weapon %s", attributeList, classname); - if(weapon!=INVALID_HANDLE) + if(weapon!=null) { - CloseHandle(weapon); - weapon=INVALID_HANDLE; + delete weapon; } return weapon; } @@ -3157,7 +3143,7 @@ stock Handle PrepareItemHandle(Handle item, char[] classname="", int index=-1, c flags|=PRESERVE_ATTRIBUTES; } - if(weapon==INVALID_HANDLE) + if(weapon==null) { weapon=TF2Items_CreateItem(flags); } @@ -3166,7 +3152,7 @@ stock Handle PrepareItemHandle(Handle item, char[] classname="", int index=-1, c TF2Items_SetFlags(weapon, flags); } - if(item!=INVALID_HANDLE) + if(item!=null) { addattribs=TF2Items_GetNumAttributes(item); if(addattribs>0) @@ -3195,7 +3181,7 @@ stock Handle PrepareItemHandle(Handle item, char[] classname="", int index=-1, c if(weapon!=item) //FlaminSarge: Item might be equal to weapon, so closing item's handle would also close weapon's { - CloseHandle(item); //probably returns false but whatever (rswallen-apparently not) + delete item; //probably returns false but whatever (rswallen-apparently not) } } @@ -3221,8 +3207,7 @@ stock Handle PrepareItemHandle(Handle item, char[] classname="", int index=-1, c if(!attrib) { LogError("[FF2 Weapons] Bad weapon attribute passed: %s ; %s", attributes[i], attributes[i+1]); - CloseHandle(weapon); - weapon=INVALID_HANDLE; + delete weapon; return weapon; } @@ -3394,7 +3379,7 @@ public Action CheckItems(Handle timer, int userid) } case 589: //Eureka Effect { - if(!GetConVarBool(cvarEnableEurekaEffect)) + if(!cvarEnableEurekaEffect.BoolValue) { TF2_RemoveWeaponSlot(client, TFWeaponSlot_Melee); SpawnWeapon(client, "tf_weapon_wrench", 7); @@ -3475,11 +3460,11 @@ stock int FindPlayerBack(int client, int index) return -1; } -public Action OnObjectDestroyed(Handle event, const char[] name, bool dontBroadcast) +public Action OnObjectDestroyed(Event event, const char[] name, bool dontBroadcast) { if(Enabled) { - int attacker=GetClientOfUserId(GetEventInt(event, "attacker")); + int attacker=GetClientOfUserId(event.GetInt("attacker")); if(!GetRandomInt(0, 2) && IsBoss(attacker)) { char sound[PLATFORM_MAX_PATH]; @@ -3493,9 +3478,9 @@ public Action OnObjectDestroyed(Handle event, const char[] name, bool dontBroadc return Plugin_Continue; } -public Action OnUberDeployed(Handle event, const char[] name, bool dontBroadcast) +public Action OnUberDeployed(Event event, const char[] name, bool dontBroadcast) { - int client=GetClientOfUserId(GetEventInt(event, "userid")); + int client=GetClientOfUserId(event.GetInt("userid")); if(Enabled && IsValidClient(client) && IsPlayerAlive(client)) { int medigun=GetPlayerWeaponSlot(client, TFWeaponSlot_Secondary); @@ -3642,9 +3627,9 @@ public Action Command_SetNextBoss(int client, int args) for(int config; config=0) { CReplyToCommand(client, "{olive}[FF2]{default} Charset for nextmap is %s", config); @@ -3827,13 +3812,13 @@ public Action Command_Charset(int client, int args) break; } - if(!KvGotoNextKey(Kv)) + if(!Kv.GotoNextKey()) { CReplyToCommand(client, "{olive}[FF2]{default} Charset not found"); break; } } - CloseHandle(Kv); + delete Kv; return Plugin_Handled; } @@ -3846,8 +3831,8 @@ public Action Command_ReloadSubPlugins(int client, int args) char path[PLATFORM_MAX_PATH], filename[PLATFORM_MAX_PATH]; BuildPath(Path_SM, path, sizeof(path), "plugins/freak_fortress_2"); FileType filetype; - Handle directory=OpenDirectory(path); - while(ReadDirEntry(directory, filename, sizeof(filename), filetype)) + DirectoryListing directory=OpenDirectory(path); + while(directory.GetNext(filename, sizeof(filename), filetype)) { if(filetype==FileType_File && StrContains(filename, ".smx", false)!=-1) { @@ -3957,7 +3942,7 @@ public void OnClientDisconnect(int client) { if(Enabled) { - if(IsBoss(client) && !CheckRoundState() && GetConVarBool(cvarPreroundBossDisconnect)) + if(IsBoss(client) && !CheckRoundState() && cvarPreroundBossDisconnect.BoolValue) { int boss=GetBossIndex(client); bool[] omit=new bool[MaxClients+1]; @@ -3978,14 +3963,13 @@ public void OnClientDisconnect(int client) } } - if(MusicTimer[client]!=INVALID_HANDLE) + if(MusicTimer[client]!=null) { - KillTimer(MusicTimer[client]); - MusicTimer[client]=INVALID_HANDLE; + delete MusicTimer[client]; } } -public Action OnPlayerSpawn(Handle event, const char[] name, bool dontBroadcast) +public Action OnPlayerSpawn(Event event, const char[] name, bool dontBroadcast) { if(Enabled && CheckRoundState()==FF2RoundState_RoundRunning) { @@ -3994,14 +3978,14 @@ public Action OnPlayerSpawn(Handle event, const char[] name, bool dontBroadcast) return Plugin_Continue; } -public Action OnPostInventoryApplication(Handle event, const char[] name, bool dontBroadcast) +public Action OnPostInventoryApplication(Event event, const char[] name, bool dontBroadcast) { if(!Enabled) { return Plugin_Continue; } - int client=GetClientOfUserId(GetEventInt(event, "userid")); + int client=GetClientOfUserId(event.GetInt("userid")); if(!IsValidClient(client)) { return Plugin_Continue; @@ -4348,29 +4332,29 @@ public Action BossTimer(Handle timer) SetClientGlow(client, -0.2); - Handle kv=GetArrayCell(bossesArray, character[boss]); - KvRewind(kv); - if(KvJumpToKey(kv, "abilities")) + KeyValues kv=GetArrayCell(bossesArray, character[boss]); + kv.Rewind(); + if(kv.JumpToKey("abilities")) { char ability[10]; - KvGotoFirstSubKey(kv); + kv.GotoFirstSubKey(); do { char pluginName[64]; - KvGetSectionName(kv, pluginName, sizeof(pluginName)); - KvGotoFirstSubKey(kv); + kv.GetSectionName(pluginName, sizeof(pluginName)); + kv.GotoFirstSubKey(); do { char abilityName[64]; - KvGetSectionName(kv, abilityName, sizeof(abilityName)); - int slot=KvGetNum(kv, "slot", 0); - int buttonmode=KvGetNum(kv, "buttonmode", 0); + kv.GetSectionName(abilityName, sizeof(abilityName)); + int slot=kv.GetNum("slot", 0); + int buttonmode=kv.GetNum("buttonmode", 0); if(slot<1) // We don't care about rage/life-loss abilities here { continue; } - KvGetString(kv, "life", ability, sizeof(ability), ""); + kv.GetString("life", ability, sizeof(ability), ""); if(!ability[0]) // Just a regular ability that doesn't care what life the boss is on { UseAbility(boss, pluginName, abilityName, slot, buttonmode); @@ -4378,11 +4362,11 @@ public Action BossTimer(Handle timer) else // But these do { char temp[3]; - Handle livesArray=CreateArray(sizeof(temp)); + ArrayList livesArray=CreateArray(sizeof(temp)); int count=ExplodeStringIntoArrayList(ability, " ", livesArray, sizeof(temp)); for(int n; n", keyPortions, sizeof(keyPortions), 128); for(int i=1; i=0) + kv.GetSectionName(match, sizeof(match)); + if(soundsArray.FindString(match)>=0) { char bossName[64]; - KvRewind(kv); - KvGetString(kv, "name", bossName, sizeof(bossName)); + kv.Rewind(); + kv.GetString("name", bossName, sizeof(bossName)); PrintToServer("[FF2 Bosses] Character %s has a duplicate sound '%s'!", bossName, match); continue; // We ignore all duplicates } - PushArrayString(soundsArray, match); + soundsArray.PushString(match); } } } - while(KvGotoNextKey(kv)); + while(kv.GotoNextKey()); - if(!GetArraySize(soundsArray)) + if(!soundsArray.Length) { return false; //No sounds matching what we want } - GetArrayString(soundsArray, GetRandomInt(0, GetArraySize(soundsArray)-1), file, length); + soundsArray.GetString(GetRandomInt(0, GetArraySize(soundsArray)-1), file, length); return true; } @@ -6617,7 +6604,7 @@ void FindCompanion(int boss, int players, bool[] omit) stock int SpawnWeapon(int client, char[] classname, int index, int level=1, int quality=0, char[] attributeList="") { Handle weapon=TF2Items_CreateItem(OVERRIDE_ALL|FORCE_GENERATION); - if(weapon==INVALID_HANDLE) + if(weapon==null) { return -1; } @@ -6634,7 +6621,7 @@ stock int SpawnWeapon(int client, char[] classname, int index, int level=1, int if(attributeList[0]!='\0') // Ignore empty attribute list { LogError("[FF2 Weapons] Unbalanced attributes array '%s' for weapon %s", attributeList, classname); - CloseHandle(weapon); + delete weapon; return -1; } else @@ -6645,7 +6632,7 @@ stock int SpawnWeapon(int client, char[] classname, int index, int level=1, int else if(count % 2) // Unbalanced array, eg "2 ; 10 ; 3" { LogError("[FF2 Weapons] Unbalanced attributes array '%s' for weapon %s", attributeList, classname); - CloseHandle(weapon); + delete weapon; return -1; } else @@ -6658,7 +6645,7 @@ stock int SpawnWeapon(int client, char[] classname, int index, int level=1, int if(!attribute) { LogError("[FF2 Weapons] Bad weapon attribute passed: %s ; %s", attributes[i], attributes[i+1]); - CloseHandle(weapon); + delete weapon; return -1; } @@ -6668,12 +6655,12 @@ stock int SpawnWeapon(int client, char[] classname, int index, int level=1, int } int entity=TF2Items_GiveNamedItem(client, weapon); - CloseHandle(weapon); + delete weapon; EquipPlayerWeapon(client, entity); return entity; } -public int HintPanelH(Handle menu, MenuAction action, int client, int selection) +public int HintPanelH(Menu menu, MenuAction action, int client, int selection) { if(IsValidClient(client) && (action==MenuAction_Select || (action==MenuAction_Cancel && selection==MenuCancel_Exit))) { @@ -6682,7 +6669,7 @@ public int HintPanelH(Handle menu, MenuAction action, int client, int selection) return; } -public int QueuePanelH(Handle menu, MenuAction action, int client, int selection) +public int QueuePanelH(Menu menu, MenuAction action, int client, int selection) { if(action==MenuAction_Select && selection==10) { @@ -6703,28 +6690,28 @@ public Action QueuePanelCmd(int client, int args) int items; bool[] added=new bool[MaxClients+1]; - Handle panel=CreatePanel(); + Panel panel=new Panel(); SetGlobalTransTarget(client); Format(text, sizeof(text), "%t", "Boss Queue"); //"Boss Queue" - SetPanelTitle(panel, text); + panel.SetTitle(text); for(int boss; boss<=MaxClients; boss++) //Add the current bosses to the top of the list { if(IsBoss(boss)) { added[boss]=true; //Don't want the bosses to show up again in the actual queue list Format(text, sizeof(text), "%N-%i", boss, GetClientQueuePoints(boss)); - DrawPanelItem(panel, text); + panel.DrawItem(text); items++; } } - DrawPanelText(panel, "---"); + panel.DrawText("---"); do { int target=GetClientWithMostQueuePoints(added); //Get whoever has the highest queue points out of those who haven't been listed yet if(!IsValidClient(target)) //When there's no players left, fill up the rest of the list with blank lines { - DrawPanelItem(panel, ""); + panel.DrawItem(""); items++; continue; } @@ -6732,22 +6719,22 @@ public Action QueuePanelCmd(int client, int args) Format(text, sizeof(text), "%N-%i", target, GetClientQueuePoints(target)); if(client!=target) { - DrawPanelItem(panel, text); + panel.DrawItem(text); items++; } else { - DrawPanelText(panel, text); //DrawPanelText() is white, which allows the client's points to stand out + panel.DrawText(text); //DrawPanelText() is white, which allows the client's points to stand out } added[target]=true; } while(items<9); Format(text, sizeof(text), "%t (%t)", "Your Queue Points", GetClientQueuePoints(client), "Reset Queue Points"); //"Your queue point(s) is {1} (set to 0)" - DrawPanelItem(panel, text); + panel.DrawItem(text); - SendPanelToClient(panel, client, QueuePanelH, MENU_TIME_FOREVER); - CloseHandle(panel); + panel.Send(client, QueuePanelH, MENU_TIME_FOREVER); + delete panel; return Plugin_Handled; } @@ -6766,7 +6753,7 @@ public Action ResetQueuePointsCmd(int client, int args) if(!client) //No confirmation for console { - TurnToZeroPanelH(INVALID_HANDLE, MenuAction_Select, client, 1); + TurnToZeroPanelH(null, MenuAction_Select, client, 1); return Plugin_Handled; } @@ -6809,7 +6796,7 @@ public Action ResetQueuePointsCmd(int client, int args) return Plugin_Handled; } -public int TurnToZeroPanelH(Handle menu, MenuAction action, int client, int position) +public int TurnToZeroPanelH(Menu menu, MenuAction action, int client, int position) { if(action==MenuAction_Select && position==1) { @@ -6833,7 +6820,7 @@ public Action TurnToZeroPanel(int client, int target) return Plugin_Continue; } - Handle panel=CreatePanel(); + Panel panel=CreatePanel(); char text[128]; SetGlobalTransTarget(client); if(client==target) @@ -6846,14 +6833,14 @@ public Action TurnToZeroPanel(int client, int target) } PrintToChat(client, text); - SetPanelTitle(panel, text); + panel.SetTitle(text); Format(text, sizeof(text), "%t", "Yes"); - DrawPanelItem(panel, text); + panel.DrawItem(text); Format(text, sizeof(text), "%t", "No"); - DrawPanelItem(panel, text); + panel.DrawItem(text); shortname[client]=target; - SendPanelToClient(panel, client, TurnToZeroPanelH, MENU_TIME_FOREVER); - CloseHandle(panel); + panel.Send(client, TurnToZeroPanelH, MENU_TIME_FOREVER); + delete panel; return Plugin_Handled; } @@ -6920,35 +6907,35 @@ public Action FF2Panel(int client, int args) //._. { if(Enabled2 && IsValidClient(client, false)) { - Handle panel=CreatePanel(); + Panel panel=CreatePanel(); char text[512]; SetGlobalTransTarget(client); Format(text, sizeof(text), "%t", "What's Up"); - SetPanelTitle(panel, text); + panel.SetTitle(text); Format(text, sizeof(text), "%t", "Observe Health Value"); - DrawPanelItem(panel, text); + panel.DrawItem(text); Format(text, sizeof(text), "%t", "Class Changes"); - DrawPanelItem(panel, text); + panel.DrawItem(text); Format(text, sizeof(text), "%t", "What's New in FF2"); - DrawPanelItem(panel, text); + panel.DrawItem(text); Format(text, sizeof(text), "%t", "View Queue Points"); - DrawPanelItem(panel, text); + panel.DrawItem(text); Format(text, sizeof(text), "%t", "Toggle Music"); - DrawPanelItem(panel, text); + panel.DrawItem(text); Format(text, sizeof(text), "%t", "Toggle Monologue"); - DrawPanelItem(panel, text); + panel.DrawItem(text); Format(text, sizeof(text), "%t", "Toggle Class Changes"); - DrawPanelItem(panel, text); + panel.DrawItem(text); Format(text, sizeof(text), "%t", "Exit Menu"); - DrawPanelItem(panel, text); - SendPanelToClient(panel, client, Handler_FF2Panel, MENU_TIME_FOREVER); - CloseHandle(panel); + panel.DrawItem(text); + panel.Send(client, Handler_FF2Panel, MENU_TIME_FOREVER); + delete panel; return Plugin_Handled; } return Plugin_Continue; } -public int Handler_FF2Panel(Handle menu, MenuAction action, int client, int selection) +public int Handler_FF2Panel(Menu menu, MenuAction action, int client, int selection) { if(action==MenuAction_Select) { @@ -6990,7 +6977,7 @@ public int Handler_FF2Panel(Handle menu, MenuAction action, int client, int sele } } -public int Handler_ChangelogMenu(Handle menu, MenuAction action, int client, int selection) +public int Handler_ChangelogMenu(Menu menu, MenuAction action, int client, int selection) { //noop } @@ -7033,17 +7020,17 @@ public Action HelpPanel3(int client) return Plugin_Continue; } - Handle panel=CreatePanel(); - SetPanelTitle(panel, "Turn the Freak Fortress 2 class info..."); - DrawPanelItem(panel, "On"); - DrawPanelItem(panel, "Off"); - SendPanelToClient(panel, client, ClassInfoTogglePanelH, MENU_TIME_FOREVER); - CloseHandle(panel); + Panel panel=CreatePanel(); + panel.SetTitle("Turn the Freak Fortress 2 class info..."); + panel.DrawItem("On"); + panel.DrawItem("Off"); + panel.Send(client, ClassInfoTogglePanelH, MENU_TIME_FOREVER); + delete panel; return Plugin_Handled; } -public int ClassInfoTogglePanelH(Handle menu, MenuAction action, int client, int selection) +public int ClassInfoTogglePanelH(Menu menu, MenuAction action, int client, int selection) { if(IsValidClient(client)) { @@ -7133,11 +7120,11 @@ public Action HelpPanelClass(int client) Format(text, sizeof(text), "%t\n%s", "Melee Advice", text); } - Handle panel=CreatePanel(); - SetPanelTitle(panel, text); - DrawPanelItem(panel, "Exit"); - SendPanelToClient(panel, client, HintPanelH, 20); - CloseHandle(panel); + Panel panel=CreatePanel(); + panel.SetTitle(text); + panel.DrawItem("Exit"); + panel.Send(client, HintPanelH, 20); + delete panel; return Plugin_Continue; } @@ -7148,30 +7135,30 @@ void HelpPanelBoss(int boss) return; } - Handle kv=GetArrayCell(bossesArray, character[boss]); - KvRewind(kv); - if(KvJumpToKey(kv, "description")) + KeyValues kv=GetArrayCell(bossesArray, character[boss]); + kv.Rewind(); + if(kv.JumpToKey("description")) { char text[512], language[8]; GetLanguageInfo(GetClientLanguage(Boss[boss]), language, sizeof(language)); - //KvSetEscapeSequences(kv, true); //Not working - KvGetString(kv, language, text, sizeof(text)); + //kv.SetEscapeSequences(true); //Not working + kv.GetString(language, text, sizeof(text)); if(!text[0]) { - KvGetString(kv, "en", text, sizeof(text)); //Default to English if their language isn't available + kv.GetString("en", text, sizeof(text)); //Default to English if their language isn't available if(!text[0]) { return; } } ReplaceString(text, sizeof(text), "\\n", "\n"); - //KvSetEscapeSequences(kv, false); //We don't want to interfere with the download paths + //kv.SetEscapeSequences(false); //We don't want to interfere with the download paths - Handle panel=CreatePanel(); - SetPanelTitle(panel, text); - DrawPanelItem(panel, "Exit"); - SendPanelToClient(panel, Boss[boss], HintPanelH, 20); - CloseHandle(panel); + Panel panel=CreatePanel(); + panel.SetTitle(text); + panel.DrawItem("Exit"); + panel.Send(Boss[boss], HintPanelH, 20); + delete panel; } } @@ -7193,16 +7180,16 @@ public Action MusicTogglePanel(int client) return Plugin_Continue; } - Handle panel=CreatePanel(); - SetPanelTitle(panel, "Turn the Freak Fortress 2 music..."); - DrawPanelItem(panel, "On"); - DrawPanelItem(panel, "Off"); - SendPanelToClient(panel, client, MusicTogglePanelH, MENU_TIME_FOREVER); - CloseHandle(panel); + Panel panel=CreatePanel(); + panel.SetTitle("Turn the Freak Fortress 2 music..."); + panel.DrawItem("On"); + panel.DrawItem("Off"); + panel.Send(client, MusicTogglePanelH, MENU_TIME_FOREVER); + delete panel; return Plugin_Continue; } -public int MusicTogglePanelH(Handle menu, MenuAction action, int client, int selection) +public int MusicTogglePanelH(Menu menu, MenuAction action, int client, int selection) { if(IsValidClient(client) && action==MenuAction_Select) { @@ -7242,16 +7229,16 @@ public Action VoiceTogglePanel(int client) return Plugin_Continue; } - Handle panel=CreatePanel(); - SetPanelTitle(panel, "Turn the Freak Fortress 2 voices..."); - DrawPanelItem(panel, "On"); - DrawPanelItem(panel, "Off"); - SendPanelToClient(panel, client, VoiceTogglePanelH, MENU_TIME_FOREVER); - CloseHandle(panel); + Panel panel=CreatePanel(); + panel.SetTitle("Turn the Freak Fortress 2 voices..."); + panel.DrawItem("On"); + panel.DrawItem("Off"); + panel.Send(client, VoiceTogglePanelH, MENU_TIME_FOREVER); + delete panel; return Plugin_Continue; } -public int VoiceTogglePanelH(Handle menu, MenuAction action, int client, int selection) +public int VoiceTogglePanelH(Menu menu, MenuAction action, int client, int selection) { if(IsValidClient(client)) { @@ -7359,7 +7346,7 @@ stock bool IsValidClient(int client, bool replaycheck=true) return true; } -public void CvarChangeNextmap(Handle convar, const char[] oldValue, const char[] newValue) +public void CvarChangeNextmap(ConVar convar, const char[] oldValue, const char[] newValue) { CreateTimer(0.1, Timer_DisplayCharsetVote, _, TIMER_FLAG_NO_MAPCHANGE); } @@ -7377,56 +7364,56 @@ public Action Timer_DisplayCharsetVote(Handle timer) return Plugin_Continue; } - Handle menu=CreateMenu(Handler_VoteCharset, view_as(MENU_ACTIONS_ALL)); - SetMenuTitle(menu, "%t", "Vote for Character Set"); //"Please vote for the character set for the next map." + Menu menu=new Menu(Handler_VoteCharset, view_as(MENU_ACTIONS_ALL)); + menu.SetTitle("%t", "Vote for Character Set"); //"Please vote for the character set for the next map." char config[PLATFORM_MAX_PATH], charset[64]; BuildPath(Path_SM, config, sizeof(config), "%s/%s", FF2_SETTINGS, BOSS_CONFIG); - Handle Kv=CreateKeyValues(""); - FileToKeyValues(Kv, config); - AddMenuItem(menu, "Random", "Random"); + KeyValues Kv=new KeyValues(""); + Kv.ImportFromFile(config); + menu.AddItem("Random", "Random"); int total, charsets; do { total++; - if(KvGetNum(Kv, "hidden", 0)) //Hidden charsets are hidden for a reason :P + if(Kv.GetNum("hidden", 0)) //Hidden charsets are hidden for a reason :P { continue; } charsets++; validCharsets[charsets]=total; - KvGetSectionName(Kv, charset, sizeof(charset)); - AddMenuItem(menu, charset, charset); + Kv.GetSectionName(charset, sizeof(charset)); + menu.AddItem(charset, charset); } - while(KvGotoNextKey(Kv)); - CloseHandle(Kv); + while(Kv.GotoNextKey()); + delete Kv; if(charsets>1) //We have enough to call a vote { FF2CharSet=charsets; //Temporary so that if the vote result is random we know how many valid charsets are in the validCharset array - Handle voteDuration=FindConVar("sm_mapvote_voteduration"); - VoteMenuToAll(menu, voteDuration ? GetConVarInt(voteDuration) : 20); + ConVar voteDuration=FindConVar("sm_mapvote_voteduration"); + VoteMenuToAll(menu, voteDuration ? voteDuration.IntValue : 20); } return Plugin_Continue; } -public int Handler_VoteCharset(Handle menu, MenuAction action, int param1, int param2) +public int Handler_VoteCharset(Menu menu, MenuAction action, int param1, int param2) { if(action==MenuAction_VoteEnd) { FF2CharSet=param1 ? param1-1 : validCharsets[GetRandomInt(1, FF2CharSet)]-1; //If param1 is 0 then we need to find a random charset - char nextmap[32]; - GetConVarString(cvarNextmap, nextmap, sizeof(nextmap)); - GetMenuItem(menu, param1, FF2CharSetString, sizeof(FF2CharSetString)); + char nextmap[42]; + cvarNextmap.GetString(nextmap, sizeof(nextmap)); + menu.GetItem(param1, FF2CharSetString, sizeof(FF2CharSetString)); CPrintToChatAll("{olive}[FF2]{default} %t", "Character Set Next Map", nextmap, FF2CharSetString); //"The character set for {1} will be {2}." isCharSetSelected=true; } else if(action==MenuAction_End) { - CloseHandle(menu); + delete menu; } } @@ -7435,7 +7422,7 @@ public Action Command_Nextmap(int client, int args) if(FF2CharSetString[0]) { char nextmap[42]; - GetConVarString(cvarNextmap, nextmap, sizeof(nextmap)); + cvarNextmap.GetString(nextmap, sizeof(nextmap)); CPrintToChat(client, "{olive}[FF2]{default} %t", "Character Set Next Map", nextmap, FF2CharSetString); } return Plugin_Handled; @@ -7466,9 +7453,9 @@ stock int FindEntityByClassname2(int startEnt, const char[] classname) return FindEntityByClassname(startEnt, classname); } -public Action Timer_UseBossCharge(Handle timer, Handle data) +public Action Timer_UseBossCharge(Handle timer, DataPack data) { - BossCharge[ReadPackCell(data)][ReadPackCell(data)]=ReadPackFloat(data); + BossCharge[data.ReadCell()][data.ReadCell()]=data.ReadFloat(); return Plugin_Continue; } @@ -7593,7 +7580,7 @@ public int Native_GetBossTeam(Handle plugin, int numParams) public bool GetBossName(int boss, char[] bossName, int length) { - if(boss>=0 && boss<=MaxClients && character[boss]>=0 && character[boss]=0 && boss<=MaxClients && character[boss]>=0 && character[boss](GetArrayCell(bossesArray, character[boss]))!=null) { KvRewind(GetArrayCell(bossesArrayShadow, character[boss])); KvGetString(GetArrayCell(bossesArray, character[boss]), "name", bossName, length); @@ -7611,14 +7598,14 @@ public int Native_GetBossName(Handle plugin, int numParams) return bossExists; } -public Handle GetBossKV(int boss) +public KeyValues GetBossKV(int boss) { - if(boss>=0 && boss<=MaxClients && character[boss]>=0 && character[boss]=0 && boss<=MaxClients && character[boss]>=0 && character[boss](GetArrayCell(bossesArray, character[boss]))!=null) { KvRewind(GetArrayCell(bossesArrayShadow, character[boss])); - return GetArrayCell(bossesArray, character[boss]); + return view_as(GetArrayCell(bossesArray, character[boss])); } - return INVALID_HANDLE; + return null; } public int Native_GetBossKV(Handle plugin, int numParams) @@ -7825,9 +7812,9 @@ public bool HasAbility(int boss, const char[] pluginName, const char[] abilityNa return false; } - Handle kv=GetArrayCell(bossesArrayShadow, character[boss]); - KvRewind(kv); - if(KvJumpToKey(kv, "abilities") && KvJumpToKey(kv, pluginName) && KvJumpToKey(kv, abilityName)) + KeyValues kv=GetArrayCell(bossesArrayShadow, character[boss]); + kv.Rewind(); + if(kv.JumpToKey("abilities") && kv.JumpToKey(pluginName) && kv.JumpToKey(abilityName)) { return true; } @@ -7942,10 +7929,10 @@ bool UseAbility(int boss, const char[] pluginName, const char[] abilityName, int { for(int timer; timer<=1; timer++) { - if(BossInfoTimer[boss][timer]!=INVALID_HANDLE) + if(BossInfoTimer[boss][timer]!=null) { KillTimer(BossInfoTimer[boss][timer]); - BossInfoTimer[boss][timer]=INVALID_HANDLE; + BossInfoTimer[boss][timer]=null; } } @@ -7978,12 +7965,12 @@ bool UseAbility(int boss, const char[] pluginName, const char[] abilityName, int { Call_PushCell(3); //In use Call_Finish(); - Handle data; + DataPack data; CreateDataTimer(0.1, Timer_UseBossCharge, data); - WritePackCell(data, boss); - WritePackCell(data, slot); - WritePackFloat(data, -1.0*GetAbilityArgumentFloat(boss, pluginName, abilityName, "cooldown", 5.0)); - ResetPack(data); + data.WriteCell(boss); + data.WriteCell(slot); + data.WriteFloat(-1.0*GetAbilityArgumentFloat(boss, pluginName, abilityName, "cooldown", 5.0)); + data.Reset(); } else { @@ -8106,12 +8093,12 @@ public int Native_SetClientGlow(Handle plugin, int numParams) public int Native_Debug(Handle plugin, int numParams) { - return GetConVarBool(cvarDebug); + return cvarDebug.BoolValue; } public void OnEntityCreated(int entity, const char[] classname) { - if(GetConVarBool(cvarHealthBar)) + if(cvarHealthBar.BoolValue) { if(StrEqual(classname, HEALTHBAR_CLASS)) { @@ -8210,9 +8197,9 @@ void FindHealthBar() } } -public void HealthbarEnableChanged(Handle convar, const char[] oldValue, const char[] newValue) +public void HealthbarEnableChanged(ConVar convar, const char[] oldValue, const char[] newValue) { - if(Enabled && GetConVarBool(cvarHealthBar) && IsValidEntity(healthBar)) + if(Enabled && cvarHealthBar.BoolValue && IsValidEntity(healthBar)) { UpdateHealthBar(); } @@ -8224,7 +8211,7 @@ public void HealthbarEnableChanged(Handle convar, const char[] oldValue, const c void UpdateHealthBar() { - if(!Enabled || !GetConVarBool(cvarHealthBar) || IsValidEntity(g_Monoculus) || !IsValidEntity(healthBar) || CheckRoundState()==FF2RoundState_Loading) + if(!Enabled || !cvarHealthBar.BoolValue || IsValidEntity(g_Monoculus) || !IsValidEntity(healthBar) || CheckRoundState()==FF2RoundState_Loading) { return; } From 7f335d238795070bb9af894e31d2b2930e2bb435 Mon Sep 17 00:00:00 2001 From: naydef Date: Fri, 27 Oct 2017 20:08:10 +0300 Subject: [PATCH 10/12] Fix BGM timer making errors --- addons/sourcemod/scripting/freak_fortress_2.sp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/sourcemod/scripting/freak_fortress_2.sp b/addons/sourcemod/scripting/freak_fortress_2.sp index 1e408eaf..356adedd 100644 --- a/addons/sourcemod/scripting/freak_fortress_2.sp +++ b/addons/sourcemod/scripting/freak_fortress_2.sp @@ -586,12 +586,12 @@ public void OnMapStart() { if(view_as(GetArrayCell(bossesArray, index))!=null) { - CloseHandle(GetArrayCell(bossesArray, index)); // Use CloseHandle(), because GetArrayCell return any: type + CloseHandle(GetArrayCell(bossesArray, index)); SetArrayCell(bossesArray, index, INVALID_HANDLE); } if(view_as(GetArrayCell(bossesArrayShadow, index))!=null) { - CloseHandle(GetArrayCell(bossesArrayShadow, index)); // Use CloseHandle(), because GetArrayCell return any: type + CloseHandle(GetArrayCell(bossesArrayShadow, index)); SetArrayCell(bossesArrayShadow, index, INVALID_HANDLE); } } @@ -1971,17 +1971,18 @@ public Action Timer_PrepareBGM(Handle timer, int userid) { if(playBGM[client]) { + MusicTimer[client]=null; StopMusic(client); RequestFrame(PlayBGM, client); // Naydef: We might start playing the music before it gets stopped } else if(MusicTimer[client]!=null) { - delete MusicTimer[client]; + MusicTimer[client]=null; } } else if(MusicTimer[client]!=null) { - delete MusicTimer[client]; + MusicTimer[client]=null; } } } @@ -1989,12 +1990,13 @@ public Action Timer_PrepareBGM(Handle timer, int userid) { if(playBGM[client]) { + MusicTimer[client]=null; StopMusic(client); RequestFrame(PlayBGM, client); // Naydef: We might start playing the music before it gets stopped } else if(MusicTimer[client]!=null) { - delete MusicTimer[client]; + MusicTimer[client]=null; return Plugin_Stop; } } From d72f78e9e265a1c9d55f773c6fc61aea663d20bc Mon Sep 17 00:00:00 2001 From: naydef Date: Wed, 21 Feb 2018 13:14:20 +0200 Subject: [PATCH 11/12] "lient"->"client" --- addons/sourcemod/scripting/include/freak_fortress_2.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sourcemod/scripting/include/freak_fortress_2.inc b/addons/sourcemod/scripting/include/freak_fortress_2.inc index 1a4bea0d..e1d01c81 100644 --- a/addons/sourcemod/scripting/include/freak_fortress_2.inc +++ b/addons/sourcemod/scripting/include/freak_fortress_2.inc @@ -248,7 +248,7 @@ native int FF2_GetClientDamage(int client); * @param damage New damage dealt * @noreturn */ -native void FF2_SetClientDamage(int lient, int damage); +native void FF2_SetClientDamage(int client, int damage); /** * Finds if a Boss has a certain ability From 2c079dfb356bc2078d52f613b03803f4412ebd89 Mon Sep 17 00:00:00 2001 From: naydef Date: Fri, 27 Apr 2018 14:26:38 +0300 Subject: [PATCH 12/12] missing "const" --- addons/sourcemod/scripting/include/freak_fortress_2.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/sourcemod/scripting/include/freak_fortress_2.inc b/addons/sourcemod/scripting/include/freak_fortress_2.inc index e1d01c81..091eab0f 100644 --- a/addons/sourcemod/scripting/include/freak_fortress_2.inc +++ b/addons/sourcemod/scripting/include/freak_fortress_2.inc @@ -258,7 +258,7 @@ native void FF2_SetClientDamage(int client, int damage); * @param abilityName Name of ability * @return True if the boss has this ability, false if it doesn't */ -native bool FF2_HasAbility(int boss, const char[] pluginName, char[] abilityName); +native bool FF2_HasAbility(int boss, const char[] pluginName, const char[] abilityName); /** * Gets the integer value of an ability argument @@ -270,7 +270,7 @@ native bool FF2_HasAbility(int boss, const char[] pluginName, char[] abilityName * @param defaultValue Value to return if argument does not exist * @return Value of argument */ -native int FF2_GetAbilityArgument(int boss, const char[] pluginName, const char[] abilityName, char[] argument, int defaultValue=0); +native int FF2_GetAbilityArgument(int boss, const char[] pluginName, const char[] abilityName, const char[] argument, int defaultValue=0); /** * Gets the float value of an ability argument