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) { diff --git a/addons/sourcemod/scripting/freak_fortress_2.sp b/addons/sourcemod/scripting/freak_fortress_2.sp index 2cac0616..356adedd 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; + +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; + +Menu 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]; + +ConVar 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; +KeyValues 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); @@ -398,25 +400,26 @@ public 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); @@ -459,8 +462,8 @@ public OnPluginStart() bossesArrayShadow=CreateArray(); voicesArray=CreateArray(); - decl String:oldVersion[64]; - GetConVarString(cvarVersion, oldVersion, sizeof(oldVersion)); + char oldVersion[64]; + 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."); @@ -481,10 +484,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 +507,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)) @@ -514,14 +517,14 @@ public OnLibraryAdded(const String: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); } #endif } -public OnLibraryRemoved(const String:name[]) +public void OnLibraryRemoved(const char[] name) { #if defined _steamtools_included if(StrEqual(name, "SteamTools", false)) @@ -538,18 +541,18 @@ 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_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(); } @@ -559,34 +562,34 @@ public OnConfigsExecuted() } #if defined _updater_included && !defined DEV_REVISION - if(LibraryExists("updater") && GetConVarBool(cvarUpdater)) + if(LibraryExists("updater") && cvarUpdater.BoolValue) { Updater_AddPlugin(UPDATE_URL); } #endif } -public OnMapStart() +public void OnMapStart() { HPTime=0.0; - doorCheckTimer=INVALID_HANDLE; + doorCheckTimer=null; RoundCount=0; - for(new client; client<=MaxClients; client++) + for(int client; client<=MaxClients; client++) { KSpreeTimer[client]=0.0; FF2Flags[client]=0; Incoming[client]=-1; - MusicTimer[client]=INVALID_HANDLE; + MusicTimer[client]=null; } - for(new index; index(GetArrayCell(bossesArray, index))!=null) { CloseHandle(GetArrayCell(bossesArray, index)); SetArrayCell(bossesArray, index, INVALID_HANDLE); } - if(GetArrayCell(bossesArrayShadow, index)!=INVALID_HANDLE) + if(view_as(GetArrayCell(bossesArrayShadow, index))!=null) { CloseHandle(GetArrayCell(bossesArrayShadow, index)); SetArrayCell(bossesArrayShadow, index, INVALID_HANDLE); @@ -594,7 +597,7 @@ public OnMapStart() } } -public OnMapEnd() +public void OnMapEnd() { if(Enabled || Enabled2) { @@ -602,26 +605,27 @@ public OnMapEnd() } } -public OnPluginEnd() +public void OnPluginEnd() { OnMapEnd(); } -public EnableFF2() +public void EnableFF2() { Enabled=true; Enabled2=true; - new String:config[PLATFORM_MAX_PATH]; + 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; @@ -633,32 +637,32 @@ public 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"); - - new Float:time=Announce; + 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) { CreateTimer(time, Timer_Announce, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); @@ -669,13 +673,13 @@ 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 || FindConVar("tf_medieval").BoolValue; FindHealthBar(); #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); } @@ -684,41 +688,39 @@ public EnableFF2() changeGamemode=0; } -public DisableFF2() +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(new client=1; client<=MaxClients; client++) + 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; @@ -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(""); - FileToKeyValues(kv, config); + KeyValues kv=new KeyValues(""); + kv.ImportFromFile(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,12 +763,12 @@ public FindCharacters() { if(strlen(charset)) { - new i; + 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; @@ -778,15 +780,15 @@ public 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)) { - new index; + int index; do { - KvGetSectionName(kv, config, sizeof(config)); + kv.GetSectionName(config, sizeof(config)); int chance=KvGetNum(kv, NULL_STRING, -1); if(chance<0) @@ -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 +1113,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) { @@ -1136,7 +1134,7 @@ public CvarChange(Handle:convar, const String:oldValue[], const String:newValue[ else if(convar==cvarUpdater) { #if defined _updater_included && !defined DEV_REVISION - GetConVarInt(cvarUpdater) ? Updater_AddPlugin(UPDATE_URL) : Updater_RemovePlugin(); + cvarUpdater.IntValue ? Updater_AddPlugin(UPDATE_URL) : Updater_RemovePlugin(); #endif } else if(convar==cvarEnabled) @@ -1146,13 +1144,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 +1163,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 +1197,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,15 +1213,15 @@ stock bool:IsFF2Map() return false; } - new Handle:file=OpenFile(config, "r"); - if(file==INVALID_HANDLE) + File file=OpenFile(config, "r"); + if(file==null) { LogError("[FF2] Error reading maps from %s, disabling plugin.", config); return false; } - new tries; - while(ReadFileLine(file, config, sizeof(config)) && tries<100) + int tries; + while(file.ReadLine(config, sizeof(config)) && tries<100) { tries++; if(tries==100) @@ -1240,18 +1238,18 @@ stock bool:IsFF2Map() if(!StrContains(currentmap, config, false) || !StrContains(config, "all", false)) { - CloseHandle(file); + delete file; return true; } } - CloseHandle(file); + delete file; 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 +1258,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 +1273,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,8 +1292,8 @@ stock bool:CheckToChangeMapDoors() return; } - new Handle:file=OpenFile(config, "r"); - if(file==INVALID_HANDLE) + File file=OpenFile(config, "r"); + if(file==null) { if(!strncmp(currentmap, "vsh_lolcano_pb1", 15, false)) { @@ -1304,7 +1302,7 @@ stock bool:CheckToChangeMapDoors() return; } - while(!IsEndOfFile(file) && ReadFileLine(file, config, sizeof(config))) + while(!file.EndOfFile() && file.ReadLine(config, sizeof(config))) { Format(config, strlen(config)-1, config); if(!strncmp(config, "//", 2, false)) @@ -1314,15 +1312,15 @@ stock bool:CheckToChangeMapDoors() if(StrContains(currentmap, config, false)!=-1 || !StrContains(config, "all", false)) { - CloseHandle(file); + delete file; checkDoors=true; return; } } - CloseHandle(file); + delete file; } -public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast) +public Action OnRoundStart(Event event, const char[] name, bool dontBroadcast) { if(changeGamemode==1) { @@ -1333,7 +1331,7 @@ public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast DisableFF2(); } - if(!GetConVarBool(cvarEnabled)) + if(!cvarEnabled.BoolValue) { #if defined _steamtools_included if(steamtools) @@ -1355,12 +1353,12 @@ public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast DeleteFile("bNextMapToFF2"); } - new bool:blueBoss; - switch(GetConVarInt(cvarForceBossTeam)) + bool blueBoss; + switch(cvarForceBossTeam.IntValue) { case 1: { - blueBoss=bool:GetRandomInt(0, 1); + blueBoss=view_as(GetRandomInt(0, 1)); } case 2: { @@ -1374,21 +1372,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 +1412,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 +1435,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 +1448,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 +1477,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,10 +1496,10 @@ 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; + BossInfoTimer[boss][0]=null; + BossInfoTimer[boss][1]=null; if(Boss[boss]) { CreateTimer(0.3, MakeBoss, boss, TIMER_FLAG_NO_MAPCHANGE); @@ -1513,14 +1511,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(event.GetInt("team"))==BossTeam)) { bossWin=true; if(FindSound("win", sound, sizeof(sound))) @@ -1660,10 +1658,10 @@ public Action:OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast) } StopMusic(); - DrawGameTimer=INVALID_HANDLE; + DrawGameTimer=null; - new bool:isBossAlive; - for(new boss; boss<=MaxClients; boss++) + bool isBossAlive; + for(int boss; boss<=MaxClients; boss++) { if(IsValidClient(Boss[boss])) { @@ -1674,7 +1672,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,22 +1687,21 @@ 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) + if(BossInfoTimer[boss][timer]!=null) { - KillTimer(BossInfoTimer[boss][timer]); - BossInfoTimer[boss][timer]=INVALID_HANDLE; + delete BossInfoTimer[boss][timer]; } } } - 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 +1715,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 +1730,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 +1761,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 +1778,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,10 +1801,10 @@ 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(Event event, const char[] name, bool dontBroadcast) { - decl String:sound[PLATFORM_MAX_PATH]; - GetEventString(event, "sound", sound, sizeof(sound)); + char sound[PLATFORM_MAX_PATH]; + event.GetString("sound", sound, sizeof(sound)); if(!StrContains(sound, "Game.Your", false) || StrEqual(sound, "Game.Stalemate", false)) { return Plugin_Handled; @@ -1815,35 +1812,35 @@ 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); - SetEventInt(event, "player", client); + Event event=CreateEvent("player_escort_score", true); + event.SetInt("player", client); - new points; + int points; while(damage-600>0) { damage-=600; points++; } - SetEventInt(event, "points", points); - FireEvent(event); + event.SetInt("points", points); + event.Fire(); if(IsBoss(client)) { @@ -1865,7 +1862,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 +1874,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 +1888,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 +1903,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 +1914,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 +1933,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 +1955,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; @@ -1974,19 +1971,18 @@ public Action:Timer_PrepareBGM(Handle:timer, any: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]!=INVALID_HANDLE) + else if(MusicTimer[client]!=null) { - KillTimer(MusicTimer[client]); - MusicTimer[client]=INVALID_HANDLE; + MusicTimer[client]=null; } } - else if(MusicTimer[client]!=INVALID_HANDLE) + else if(MusicTimer[client]!=null) { - KillTimer(MusicTimer[client]); - MusicTimer[client]=INVALID_HANDLE; + MusicTimer[client]=null; } } } @@ -1994,68 +1990,68 @@ public Action:Timer_PrepareBGM(Handle:timer, any: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]!=INVALID_HANDLE) + else if(MusicTimer[client]!=null) { - KillTimer(MusicTimer[client]); - MusicTimer[client]=INVALID_HANDLE; + MusicTimer[client]=null; return Plugin_Stop; } } return Plugin_Continue; } -PlayBGM(client) +void PlayBGM(int client) { - new Handle:kv=GetArrayCell(bossesArray, character[0]); - KvRewind(kv); - if(KvJumpToKey(kv, "sounds")) + KeyValues kv=GetArrayCell(bossesArray, character[0]); + kv.Rewind(); + if(kv.JumpToKey("sounds")) { - new Handle:musicArray=CreateArray(PLATFORM_MAX_PATH); - new Handle:timeArray=CreateArray(); - decl String:music[PLATFORM_MAX_PATH]; - KvGotoFirstSubKey(kv); + ArrayList musicArray=CreateArray(PLATFORM_MAX_PATH); + ArrayList timeArray=CreateArray(); + char music[PLATFORM_MAX_PATH]; + kv.GotoFirstSubKey(); do { - KvGetSectionName(kv, music, sizeof(music)); - new 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) { - decl String:bossName[64]; - KvRewind(kv); - KvGetString(kv, "name", bossName, sizeof(bossName)); + char bossName[64]; + 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) { - decl String:bossName[64]; - KvRewind(kv); - KvGetString(kv, "name", bossName, sizeof(bossName)); + char bossName[64]; + 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; } - new index=GetRandomInt(0, GetArraySize(musicArray)-1); + int index=GetRandomInt(0, musicArray.Length-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); - GetArrayString(musicArray, index, temp, sizeof(temp)); + char temp[PLATFORM_MAX_PATH]; + char buffer[PLATFORM_MAX_PATH]; + 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); @@ -2068,38 +2064,38 @@ PlayBGM(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); } } else { - decl String:bossName[64]; - KvRewind(kv); - KvGetString(kv, "name", bossName, sizeof(bossName)); + char bossName[64]; + kv.Rewind(); + kv.GetString("name", bossName, sizeof(bossName)); PrintToServer("[FF2 Bosses] Character %s is missing BGM file '%s'!", bossName, music); } } } -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 +2109,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 { @@ -2128,10 +2124,9 @@ StopMusic(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]; } } @@ -2147,10 +2142,9 @@ StopMusic(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, ""); @@ -2161,10 +2155,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 +2178,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 +2197,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 +2236,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 +2264,7 @@ public Action:Timer_NextBossPanel(Handle:timer) } } -public Action:MessageTimer(Handle:timer) +public Action MessageTimer(Handle timer) { if(CheckRoundState()!=FF2RoundState_Setup) { @@ -2278,29 +2273,29 @@ public Action:MessageTimer(Handle:timer) if(checkDoors) { - new entity=-1; + int entity=-1; while((entity=FindEntityByClassname2(entity, "func_door"))!=-1) { AcceptEntityInput(entity, "Open"); AcceptEntityInput(entity, "Unlock"); } - if(doorCheckTimer==INVALID_HANDLE) + if(doorCheckTimer==null) { doorCheckTimer=CreateTimer(5.0, Timer_CheckDoors, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); } } 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 +2314,7 @@ public Action:MessageTimer(Handle:timer) } } - for(new client; client<=MaxClients; client++) + for(int client; client<=MaxClients; client++) { if(IsValidClient(client)) { @@ -2330,12 +2325,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,38 +2341,38 @@ 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]); - 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 { - decl String:sectionName[32]; - KvGetSectionName(kv, sectionName, sizeof(sectionName)); - new index=StringToInt(sectionName); + char sectionName[32]; + 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); @@ -2391,7 +2386,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); @@ -2409,7 +2404,7 @@ EquipBoss(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); } @@ -2420,20 +2415,20 @@ EquipBoss(boss) LogError("[FF2 Bosses] Invalid weapon index %s specified for character %s!", sectionName, bossName); } } - while(KvGotoNextKey(kv)); + while(kv.GotoNextKey()); } - KvRewind(kv); - new TFClassType:class=TFClassType:KvGetNum(kv, "class", 1); - if(TF2_GetPlayerClass(client)!=class) + kv.Rewind(); + TFClassType playerclass=view_as(kv.GetNum("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,8 +2446,8 @@ public Action:MakeBoss(Handle:timer, any:boss) } } - new Handle:kv=GetArrayCell(bossesArray, character[boss]); - KvRewind(kv); + KeyValues kv=GetArrayCell(bossesArray, character[boss]); + kv.Rewind(); if(TF2_GetClientTeam(client)!=BossTeam) { AssignTeam(client, BossTeam); @@ -2462,14 +2457,14 @@ 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(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: { @@ -2496,7 +2491,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,63 +2527,62 @@ public Action:MakeBoss(Handle:timer, any:boss) } /*Soon(TM) -CreateWeaponModsKeyValues() +void CreateWeaponModsKeyValues() { - if(kvWeaponSpecials!=INVALID_HANDLE) + if(kvWeaponSpecials!=null) { - CloseHandle(kvWeaponSpecials); + delete kvWeaponSpecials; } - kvWeaponSpecials=CreateKeyValues("WeaponSpecials"); - for(new i=0; i-1) { flags|=OVERRIDE_ITEM_LEVEL; @@ -2612,7 +2606,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti level=1; } - new quality=KvGetNum(kvWeaponMods, "quality", -1); + int quality=kvWeaponMods.GetNum("quality", -1); if(quality>-1) { flags|=OVERRIDE_ITEM_QUALITY; @@ -2627,21 +2621,20 @@ 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); - weapon=INVALID_HANDLE; + delete weapon; - KvGoBack(kvWeaponMods); + kvWeaponMods.GoBack(); } - if(KvJumpToKey(kvWeaponMods, "add")) + if(kvWeaponMods.JumpToKey("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; kvWeaponMods.GotoNextKey(); key+=2) { if(key>=32) { @@ -2650,17 +2643,17 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti } 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]); } 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; kvWeaponMods.GotoNextKey(false); key++) { - decl String:temp[4]; + 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++; } @@ -2740,19 +2733,19 @@ 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])); } @@ -2821,7 +2814,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti { LogError("[FF2 Weapons] There was nothing under \"Addattribs\" for classname %s!", classname); } - KvGoBack(kvWeaponMods); + kvWeaponMods.GoBack(); }*/ } @@ -2829,8 +2822,8 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti { Debug("Keyvalues differentClass: Gave weapon!"); TF2Items_GiveNamedItem(client, weapon); - CloseHandle(weapon); - weapon=INVALID_HANDLE; + delete weapon; + weapon=null; return Plugin_Stop; }*/ } @@ -2839,8 +2832,8 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti { case 38, 457: //Axtinguisher, Postal Pummeler { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "", false); - if(itemOverride!=INVALID_HANDLE) + Handle itemOverride=PrepareItemHandle(item, _, _, "", false); + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2848,12 +2841,12 @@ 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 //207: +33% damage to self - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2861,8 +2854,8 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti } case 40, 1146: //Backburner, Festive Backburner { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "165 ; 1.0"); - if(itemOverride!=INVALID_HANDLE) + Handle itemOverride=PrepareItemHandle(item, _, _, "165 ; 1.0"); + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2870,11 +2863,11 @@ 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 - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2882,13 +2875,13 @@ 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 //191: -7 health/second //772: Holsters 50% slower - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2896,10 +2889,10 @@ 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) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2907,8 +2900,8 @@ 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); - if(itemOverride!=INVALID_HANDLE) + Handle itemOverride=PrepareItemHandle(item, _, _, "202 ; 0.5 ; 125 ; -15", false); + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2916,8 +2909,8 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti }*/ case 226: //Battalion's Backup { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "140 ; 10.0"); - if(itemOverride!=INVALID_HANDLE) + Handle itemOverride=PrepareItemHandle(item, _, _, "140 ; 10.0"); + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2925,8 +2918,8 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti } case 231: //Darwin's Danger Shield { - new Handle:itemOverride=PrepareItemHandle(item, _, _, "26 ; 50"); //+50 health - if(itemOverride!=INVALID_HANDLE) + Handle itemOverride=PrepareItemHandle(item, _, _, "26 ; 50"); //+50 health + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2934,10 +2927,10 @@ 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) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2945,11 +2938,11 @@ 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 - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2957,13 +2950,13 @@ 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 //179: Minicrits become crits //547: Deploys 40% faster - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2975,9 +2968,9 @@ 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) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2985,11 +2978,11 @@ 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 - if(itemOverride!=INVALID_HANDLE) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -2997,7 +2990,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 @@ -3007,7 +3000,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti //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; @@ -3015,9 +3008,9 @@ 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) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -3027,7 +3020,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"); @@ -3040,7 +3033,7 @@ public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefiniti //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; @@ -3049,10 +3042,10 @@ 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) + if(itemOverride!=null) { item=itemOverride; return Plugin_Changed; @@ -3060,14 +3053,14 @@ 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 //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; @@ -3076,15 +3069,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)); @@ -3109,26 +3102,25 @@ public Action:Timer_NoHonorBound(Handle:timer, any: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, 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 { 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; } @@ -3140,21 +3132,20 @@ stock Handle:PrepareItemHandle(Handle:item, String:classname[]="", index=-1, con 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; } - new flags=OVERRIDE_ATTRIBUTES; + int flags=OVERRIDE_ATTRIBUTES; if(preserve) { flags|=PRESERVE_ATTRIBUTES; } - if(weapon==INVALID_HANDLE) + if(weapon==null) { weapon=TF2Items_CreateItem(flags); } @@ -3163,16 +3154,16 @@ stock Handle:PrepareItemHandle(Handle:item, String:classname[]="", index=-1, con TF2Items_SetFlags(weapon, flags); } - if(item!=INVALID_HANDLE) + if(item!=null) { 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 +3546,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 +3557,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 +3584,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 +3603,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 +3616,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,11 +3627,11 @@ 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) { CReplyToCommand(client, "{olive}[FF2]{default} Charset for nextmap is %s", config); @@ -3824,27 +3814,27 @@ public Action:Command_Charset(client, args) break; } - if(!KvGotoNextKey(Kv)) + if(!Kv.GotoNextKey()) { CReplyToCommand(client, "{olive}[FF2]{default} Charset not found"); break; } } - CloseHandle(Kv); + delete Kv; 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); - while(ReadDirEntry(directory, filename, sizeof(filename), filetype)) + FileType filetype; + DirectoryListing directory=OpenDirectory(path); + while(directory.GetNext(filename, sizeof(filename), filetype)) { if(filetype==FileType_File && StrContains(filename, ".smx", false)!=-1) { @@ -3857,7 +3847,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 +3856,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 +3865,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 +3879,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 +3914,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 +3937,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)) + if(IsBoss(client) && !CheckRoundState() && cvarPreroundBossDisconnect.BoolValue) { - 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); @@ -3975,14 +3965,13 @@ public OnClientDisconnect(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 String:name[], bool:dontBroadcast) +public Action OnPlayerSpawn(Event event, const char[] name, bool dontBroadcast) { if(Enabled && CheckRoundState()==FF2RoundState_RoundRunning) { @@ -3991,14 +3980,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(Event event, const char[] name, bool dontBroadcast) { if(!Enabled) { return Plugin_Continue; } - new client=GetClientOfUserId(GetEventInt(event, "userid")); + int client=GetClientOfUserId(event.GetInt("userid")); if(!IsValidClient(client)) { return Plugin_Continue; @@ -4031,32 +4020,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 +4058,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 +4088,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 +4106,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 +4129,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 +4145,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 +4161,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 +4172,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 +4194,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 +4226,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 +4260,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 +4273,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 +4315,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,41 +4334,41 @@ public Action:BossTimer(Handle:timer) SetClientGlow(client, -0.2); - new Handle:kv=GetArrayCell(bossesArray, character[boss]); - KvRewind(kv); - if(KvJumpToKey(kv, "abilities")) + KeyValues kv=GetArrayCell(bossesArray, character[boss]); + kv.Rewind(); + if(kv.JumpToKey("abilities")) { - decl String:ability[10]; - KvGotoFirstSubKey(kv); + char ability[10]; + kv.GotoFirstSubKey(); do { - decl String:pluginName[64]; - KvGetSectionName(kv, pluginName, sizeof(pluginName)); - KvGotoFirstSubKey(kv); + char pluginName[64]; + kv.GetSectionName(pluginName, sizeof(pluginName)); + kv.GotoFirstSubKey(); do { - decl String:abilityName[64]; - KvGetSectionName(kv, abilityName, sizeof(abilityName)); - new slot=KvGetNum(kv, "slot", 0); - new buttonmode=KvGetNum(kv, "buttonmode", 0); + char abilityName[64]; + 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); } 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 +4408,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 +4438,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 +4454,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 +4462,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 +4482,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 +4503,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 +4518,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,27 +4537,27 @@ public Action:OnCallForMedic(client, const String:command[], args) if(RoundFloat(BossCharge[boss][0])==100) { - new Handle:kv=GetArrayCell(bossesArray, character[boss]); - KvRewind(kv); - if(KvJumpToKey(kv, "abilities")) + KeyValues kv=GetArrayCell(bossesArray, character[boss]); + kv.Rewind(); + if(kv.JumpToKey("abilities")) { - decl String:ability[10]; - KvGotoFirstSubKey(kv); + char ability[10]; + kv.GotoFirstSubKey(); do { - decl String:pluginName[64]; - KvGetSectionName(kv, pluginName, sizeof(pluginName)); - KvGotoFirstSubKey(kv); + char pluginName[64]; + kv.GetSectionName(pluginName, sizeof(pluginName)); + kv.GotoFirstSubKey(); do { - decl String:abilityName[64]; - KvGetSectionName(kv, abilityName, sizeof(abilityName)); - if(KvGetNum(kv, "slot")) // Rage is slot 0 + char abilityName[64]; + kv.GetSectionName(abilityName, sizeof(abilityName)); + if(kv.GetNum("slot")) // Rage is slot 0 { 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 { if(!UseAbility(boss, pluginName, abilityName, 0)) @@ -4578,12 +4567,12 @@ 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,8 +4791,8 @@ public Action:OnPlayerDeath(Handle:event, const String:eventName[], bool:dontBro } else { - new boss=GetBossIndex(client); - if(boss==-1 || (GetEventInt(event, "death_flags") & TF_DEATHFLAG_DEADRINGER)) + int boss=GetBossIndex(client); + if(boss==-1 || (event.GetInt("death_flags") & TF_DEATHFLAG_DEADRINGER)) { return Plugin_Continue; } @@ -4820,11 +4810,11 @@ public Action:OnPlayerDeath(Handle:event, const String:eventName[], bool:dontBro Marketed[boss]=0.0; } - if(TF2_GetPlayerClass(client)==TFClass_Engineer && !(GetEventInt(event, "death_flags") & TF_DEATHFLAG_DEADRINGER)) + if(TF2_GetPlayerClass(client)==TFClass_Engineer && !(event.GetInt("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 +4980,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 +5002,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,15 +5034,15 @@ 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); } case 0: { - if(!GetConVarBool(cvarCountdownResult)) + if(!cvarCountdownResult.BoolValue) { - for(new client=1; client<=MaxClients; client++) //Thx MasterOfTheXP + for(int client=1; client<=MaxClients; client++) //Thx MasterOfTheXP { if(IsClientInGame(client) && IsPlayerAlive(client)) { @@ -5070,17 +5060,17 @@ 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(Event event, const char[] name, bool dontBroadcast) //TODO: Can this be removed? { - if(Enabled && CheckRoundState()==FF2RoundState_RoundRunning && GetEventBool(event, "minicrit") && GetEventBool(event, "allseecrit")) + if(Enabled && CheckRoundState()==FF2RoundState_RoundRunning && event.GetBool("minicrit") && event.GetBool("allseecrit")) { Debug("allseecrit removed"); - SetEventBool(event, "allseecrit", false); + event.SetBool("allseecrit", false); } 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 +5094,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 +5137,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)); @@ -5173,12 +5163,12 @@ public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &d Format(classname, sizeof(classname), ""); } - /*if(KvJumpToKey(kvWeaponMods, "onhit")) + /*if(kvWeaponMods.JumpToKey("onhit")) { //TODO } - if(KvJumpToKey(kvWeaponMods, "ontakedamage")) + if(kvWeaponMods.JumpToKey("ontakedamage")) { //TODO }*/ @@ -5188,20 +5178,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 +5231,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 +5245,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 +5263,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 +5275,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 +5304,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 +5360,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 +5371,18 @@ public Action:OnTakeDamageAlive(client, &attacker, &inflictor, &Float:damage, &d } } - for(new healer; healer1.0) { uber=1.0; @@ -5417,7 +5407,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 +5431,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 +5466,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 +5484,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 +5507,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 +5536,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 +5585,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 +5867,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 +5882,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 +5906,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,55 +5917,55 @@ 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++) + ArrayList disguiseArray=CreateArray(); + for(int clientcheck; clientcheck<=MaxClients; clientcheck++) { if(IsValidClient(clientcheck) && TF2_GetClientTeam(clientcheck)==team && clientcheck!=client) { - PushArrayCell(disguiseArray, clientcheck); + disguiseArray.Push(clientcheck); } } - if(GetArraySize(disguiseArray)<=0) + if(disguiseArray.Length<=0) { disguiseTarget=client; } else { - disguiseTarget=GetArrayCell(disguiseArray, GetRandomInt(0, GetArraySize(disguiseArray)-1)); + disguiseTarget=disguiseArray.Get(GetRandomInt(0, disguiseArray.Length-1)); if(!IsValidClient(disguiseTarget)) { disguiseTarget=client; } } - new class=GetRandomInt(0, 4); - new TFClassType:classArray[]={TFClass_Scout, TFClass_Pyro, TFClass_Medic, TFClass_Engineer, TFClass_Sniper}; - CloseHandle(disguiseArray); + int playerclass=GetRandomInt(0, 4); + TFClassType classArray[]={TFClass_Scout, TFClass_Pyro, TFClass_Medic, TFClass_Engineer, TFClass_Sniper}; + delete 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 +5975,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 +5991,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,22 +6003,22 @@ stock LastBossIndex() return 0; } -stock Operate(Handle:sumArray, &bracket, Float:value, Handle:_operator) +stock void Operate(ArrayList sumArray, int& bracket, float value, ArrayList _operator) { - new Float:sum=GetArrayCell(sumArray, bracket); - switch(GetArrayCell(_operator, bracket)) + float sum=sumArray.Get(bracket); + switch(_operator.Get(bracket)) { case Operator_Add: { - SetArrayCell(sumArray, bracket, sum+value); + sumArray.Set(bracket, sum+value); } case Operator_Subtract: { - SetArrayCell(sumArray, bracket, sum-value); + sumArray.Set(bracket, sum-value); } case Operator_Multiply: { - SetArrayCell(sumArray, bracket, sum*value); + sumArray.Set(bracket, sum*value); } case Operator_Divide: { @@ -6036,21 +6028,21 @@ stock Operate(Handle:sumArray, &bracket, Float:value, Handle:_operator) bracket=0; return; } - SetArrayCell(sumArray, bracket, sum/value); + sumArray.Set(bracket, sum/value); } case Operator_Exponent: { - SetArrayCell(sumArray, bracket, Pow(sum, value)); + sumArray.Set(bracket, Pow(sum, value)); } default: { - SetArrayCell(sumArray, bracket, value); //This means we're dealing with a constant + sumArray.Set(bracket, value); //This means we're dealing with a constant } } - SetArrayCell(_operator, bracket, Operator_None); + _operator.Set(bracket, Operator_None); } -stock OperateString(Handle:sumArray, &bracket, String:value[], size, Handle:_operator) +stock void OperateString(ArrayList sumArray, int& bracket, char[] value, int size, ArrayList _operator) { if(!StrEqual(value, "")) //Make sure 'value' isn't blank { @@ -6081,29 +6073,29 @@ 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]); - KvRewind(kv); - KvGetString(kv, "name", bossName, sizeof(bossName), "=Failed name="); + char formula[1024], bossName[64]; + KeyValues kv=GetArrayCell(bossesArrayShadow, character[boss]); + kv.Rewind(); + kv.GetString("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) + kv.GetSectionName(match, sizeof(match)); + if(soundsArray.FindString(match)>=0) { - decl String:bossName[64]; - KvRewind(kv); - KvGetString(kv, "name", bossName, sizeof(bossName)); + char bossName[64]; + 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; } -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 +6381,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 +6396,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 +7348,12 @@ stock bool:IsValidClient(client, bool:replaycheck=true) return true; } -public CvarChangeNextmap(Handle:convar, const String:oldValue[], const String:newValue[]) +public void CvarChangeNextmap(ConVar 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,73 +7366,73 @@ public Action:Timer_DisplayCharsetVote(Handle:timer) return Plugin_Continue; } - new Handle:menu=CreateMenu(Handler_VoteCharset, MenuAction: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." - 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(""); - FileToKeyValues(Kv, config); - AddMenuItem(menu, "Random", "Random"); - new total, charsets; + 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 - new 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 Handler_VoteCharset(Handle:menu, MenuAction:action, param1, 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 - decl String: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; } } -public Action:Command_Nextmap(client, args) +public Action Command_Nextmap(int client, int args) { if(FF2CharSetString[0]) { - decl String:nextmap[42]; - GetConVarString(cvarNextmap, nextmap, sizeof(nextmap)); + char nextmap[42]; + cvarNextmap.GetString(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 +7446,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 +7455,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, DataPack data) { - BossCharge[ReadPackCell(data)][ReadPackCell(data)]=ReadPackFloat(data); + BossCharge[data.ReadCell()][data.ReadCell()]=data.ReadFloat(); 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 +7474,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 +7526,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 +7545,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,24 +7565,24 @@ 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](GetArrayCell(bossesArray, character[boss]))!=null) { KvRewind(GetArrayCell(bossesArrayShadow, character[boss])); KvGetString(GetArrayCell(bossesArray, character[boss]), "name", bossName, length); @@ -7595,166 +7591,166 @@ public bool:GetBossName(boss, String:bossName[], length) return false; } -public Native_GetBossName(Handle:plugin, numParams) +public int Native_GetBossName(Handle plugin, int numParams) { - new length=GetNativeCell(3); - decl String:bossName[length]; - new bool:bossExists=GetBossName(GetNativeCell(1), bossName, length); + int length=GetNativeCell(3); + char[] bossName=new char[length]; + bool bossExists=GetBossName(GetNativeCell(1), bossName, length); SetNativeString(2, bossName, length); return bossExists; } -public Handle:GetBossKV(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 Native_GetBossKV(Handle:plugin, numParams) +public int Native_GetBossKV(Handle plugin, int numParams) { - return _:GetBossKV(GetNativeCell(1)); + return view_as(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), view_as(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 +7765,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,107 +7779,107 @@ 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]); - 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; } 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 +7912,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,12 +7929,12 @@ 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) + if(BossInfoTimer[boss][timer]!=null) { KillTimer(BossInfoTimer[boss][timer]); - BossInfoTimer[boss][timer]=INVALID_HANDLE; + BossInfoTimer[boss][timer]=null; } } @@ -7946,7 +7942,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,18 +7961,18 @@ 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; + 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 { @@ -8000,77 +7996,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,19 +8088,19 @@ 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); + return cvarDebug.BoolValue; } -public OnEntityCreated(entity, const String:classname[]) +public void OnEntityCreated(int entity, const char[] classname) { - if(GetConVarBool(cvarHealthBar)) + if(cvarHealthBar.BoolValue) { if(StrEqual(classname, HEALTHBAR_CLASS)) { @@ -8128,7 +8124,7 @@ public OnEntityCreated(entity, const String:classname[]) } } -public OnEntityDestroyed(entity) +public void OnEntityDestroyed(int entity) { if(entity==g_Monoculus) { @@ -8140,23 +8136,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 +8166,7 @@ public Action:OnPickup(entity, client) //Thanks friagram! return Plugin_Continue; } -public FF2RoundState:CheckRoundState() +public FF2RoundState CheckRoundState() { switch(GameRules_GetRoundState()) { @@ -8194,7 +8190,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,9 +8199,9 @@ FindHealthBar() } } -public HealthbarEnableChanged(Handle:convar, const String:oldValue[], const String: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(); } @@ -8215,15 +8211,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) + if(!Enabled || !cvarHealthBar.BoolValue || 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])) { diff --git a/addons/sourcemod/scripting/freak_fortress_2/default_abilities.sp b/addons/sourcemod/scripting/freak_fortress_2/default_abilities.sp index b4740980..12d4a581 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; +ConVar cvarOldJump; +ConVar 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,13 +46,13 @@ 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); - HookConVarChange(cvarOldJump, CvarChange); - HookConVarChange(cvarBaseJumperStun, CvarChange); + cvarOldJump.AddChangeHook(CvarChange); + cvarBaseJumperStun.AddChangeHook(CvarChange); jumpHUD=CreateHudSynchronizer(); @@ -65,29 +67,29 @@ public OnPluginStart() FF2_RegisterSubplugin(PLUGIN_NAME); } -public OnConfigsExecuted() +public void OnConfigsExecuted() { - oldJump=GetConVarBool(cvarOldJump); - removeBaseJumperOnStun=GetConVarBool(cvarBaseJumperStun); + oldJump=cvarOldJump.BoolValue; + removeBaseJumperOnStun=cvarBaseJumperStun.BoolValue; } -public CvarChange(Handle:convar, const String:oldValue[], const String:newValue[]) +public void CvarChange(ConVar 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(Event 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,14 +545,14 @@ Charge_WeighDown(boss, slot) //TODO: Create a HUD for this return; } - new Handle:data; - new Float:velocity[3]; - if(gravityDatapack[client]==INVALID_HANDLE) + DataPack data; + float velocity[3]; + 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); @@ -572,31 +574,31 @@ Charge_WeighDown(boss, slot) //TODO: Create a HUD for this } } -public Action:Timer_ResetGravity(Handle:timer, Handle:data) +public Action Timer_ResetGravity(Handle timer, DataPack data) { - new 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 String:name[], bool:dontBroadcast) +public Action OnPlayerDeath(Event event, const char[] name, bool dontBroadcast) { - new 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; } -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, int 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(Event event, const char[] name, bool dontBroadcast) { - new boss=FF2_GetBossIndex(GetClientOfUserId(GetEventInt(event, "userid"))); + int boss=FF2_GetBossIndex(GetClientOfUserId(event.GetInt("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..9c632e90 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(Event event, const char[] name, bool dontBroadcast) { - new client=GetClientOfUserId(GetEventInt(event, "userid")); - new 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; } - 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,28 @@ 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; +ConVar cvarTimeScale; +ConVar cvarCheats; +ConVar 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 +70,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(Event 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; @@ -90,22 +91,22 @@ public Action:OnRoundStart(Handle:event, const String: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 String:name[], bool:dontBroadcast) +public Action OnRoundEnd(Event 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) { @@ -113,7 +114,7 @@ public Action:OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast) { KillTimer(SlowMoTimer); } - Timer_StopSlowMo(INVALID_HANDLE, -1); + Timer_StopSlowMo(null, -1); return Plugin_Continue; } @@ -127,7 +128,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,17 +138,17 @@ public OnClientDisconnect(client) } } -public Action:Timer_GetBossTeam(Handle:timer) +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; } -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 +159,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 +182,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,11 +207,11 @@ 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; + 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)) { @@ -218,31 +219,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]; + 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"); + 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 +252,13 @@ Rage_Clone(const String:abilityName[], boss) } } - new alive, dead; - new Handle:players=CreateArray(); - for(new target=1; target<=MaxClients; target++) + int alive, dead; + ArrayList 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)) @@ -266,33 +267,33 @@ Rage_Clone(const String:abilityName[], boss) } else if(FF2_GetBossIndex(target)==-1) //Don't let dead bosses become clones { - PushArrayCell(players, target); + players.Push(target); dead++; } } } } - 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); - 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, (class ? (TFClassType:class) : (TFClassType: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"); @@ -307,7 +308,7 @@ Rage_Clone(const String:abilityName[], boss) } case 1: { - new weapon; + int weapon; TF2_RemoveAllWeapons(clone); if(classname[0]=='\0') { @@ -365,14 +366,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; + 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; - 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,23 +399,23 @@ Rage_Clone(const String:abilityName[], boss) } } -public Action:Timer_EquipModel(Handle:timer, any:pack) +public Action Timer_EquipModel(Handle timer, DataPack pack) { - ResetPack(pack); - new client=GetClientOfUserId(ReadPackCell(pack)); + pack.Reset(); + int client=GetClientOfUserId(pack.ReadCell()); if(client && IsClientInGame(client) && IsPlayerAlive(client)) { - decl String:model[PLATFORM_MAX_PATH]; - ReadPackString(pack, model, PLATFORM_MAX_PATH); + char model[PLATFORM_MAX_PATH]; + pack.ReadString(model, PLATFORM_MAX_PATH); SetVariantString(model); AcceptEntityInput(client, "SetCustomModel"); SetEntProp(client, Prop_Send, "m_bUseClassAnimations", 1); } } -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 +425,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 +444,7 @@ public Action:SaveMinion(client, &attacker, &inflictor, &Float:damage, &damagety } } - new tries; + int tries; do { tries++; @@ -463,7 +465,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 +473,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 +499,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 +519,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, DataPack data) { - new boss=ReadPackCell(data); - new client=GetClientOfUserId(FF2_GetBossUserId(boss)); + int boss=data.ReadCell(); + int client=GetClientOfUserId(FF2_GetBossUserId(boss)); - decl String:abilityName[64]; - ReadPackString(data, abilityName, sizeof(abilityName)); + char abilityName[64]; + data.ReadString(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 +550,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 +614,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; + 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; 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,11 +633,11 @@ 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; + SlowMoTimer=null; oldTarget=0; - SetConVarFloat(cvarTimeScale, 1.0); + cvarTimeScale.FloatValue=1.0; UpdateClientCheatValue(0); if(boss!=-1) { @@ -647,9 +649,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,39 +659,39 @@ 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; + 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) { - new client=GetClientOfUserId(ReadPackCell(data)); - new target=GetClientOfUserId(ReadPackCell(data)); + int client=GetClientOfUserId(data.ReadCell()); + int target=GetClientOfUserId(data.ReadCell()); 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 +705,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) { @@ -718,13 +720,13 @@ public bool:TraceRayDontHitSelf(entity, 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: @@ -782,23 +784,23 @@ public bool:TraceRayDontHitSelf(entity, mask) } */ -public Action:OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) +public Action OnPlayerDeath(Event 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(event.GetInt("attacker")); + int client=GetClientOfUserId(event.GetInt("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)) { @@ -812,10 +814,10 @@ public Action:OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcas 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); } - new prop=CreateEntityByName("prop_physics_override"); + int prop=CreateEntityByName("prop_physics_override"); if(IsValidEntity(prop)) { SetEntityModel(prop, model); @@ -824,11 +826,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 +844,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: @@ -864,9 +866,9 @@ 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)) + 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(new target=1; target<=MaxClients; target++) + for(int target=1; target<=MaxClients; target++) { if(CloneOwnerIndex[target]==boss) { @@ -889,25 +891,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 +918,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,13 +983,13 @@ 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)) { - 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 2db7eee7..6da5b327 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); + HookEvent("teamplay_round_start", OnRoundStart, EventHookMode_PostNoCopy); FF2_RegisterSubplugin(PLUGIN_NAME); } -public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast) +public Action OnRoundStart(Event 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); + Format(overlay, sizeof(overlay), "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..ee472468 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,21 +31,21 @@ 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))) { 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); } -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 #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 @@ -34,7 +35,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 +44,7 @@ native bool:FF2_IsFF2Enabled(); * * @noreturn */ -native FF2_RegisterSubplugin(String:pluginName[]); +native void FF2_RegisterSubplugin(char[] pluginName); /** * Unregister a subplugin with FF2 @@ -52,7 +53,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 +61,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 +71,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 +79,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 +87,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,15 +103,15 @@ 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 * * @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(boss=0); +native KeyValues FF2_GetBossKV(int boss=0); /** * Gets the current health value of the Boss @@ -118,7 +119,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 +128,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 +136,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 +145,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 +153,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 +162,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 +170,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 +179,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 +191,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 +204,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 +212,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 +221,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 +231,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 +239,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 +248,7 @@ native FF2_GetClientDamage(client); * @param damage New damage dealt * @noreturn */ -native FF2_SetClientDamage(client, damage); +native void FF2_SetClientDamage(int client, int damage); /** * Finds if a Boss has a certain ability @@ -257,7 +258,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, const char[] abilityName); /** * Gets the integer value of an ability argument @@ -269,7 +270,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, const char[] argument, int defaultValue=0); /** * Gets the float value of an ability argument @@ -281,7 +282,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 +296,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 +314,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 +322,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 +331,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 +339,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 +348,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 +356,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 +364,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 +377,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 +385,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 +395,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 +410,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 +419,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 +428,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 +449,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 +459,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 +468,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 +476,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 +486,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 +496,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 +507,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 +516,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 +524,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 +534,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 +543,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 +552,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 +563,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 +572,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 +593,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 +609,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 +629,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, ArrayList 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]) { @@ -641,11 +642,11 @@ stock int ExplodeStringIntoArrayList(const String:text[], const String:split[], 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; @@ -658,18 +659,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" {