[Bug] Skeleton King Abilities
Closed this issue · 3 comments
MAGNAT2645 commented
Errors (happened after compiling a version from this repository):
L 08/13/2020 - 12:16:46: [SM] Exception reported: Client index 0 is invalid
L 08/13/2020 - 12:16:46: [SM] Blaming: freaks/skeleton_king.ff2
L 08/13/2020 - 12:16:46: [SM] Call stack trace:
L 08/13/2020 - 12:16:46: [SM] [0] GetClientSerial
L 08/13/2020 - 12:16:46: [SM] [1] Line 458, C:\Home\TF2-Server-Files\tf\addons\sourcemod\scripting\freaks\skeleton_king.sp::Charge_RocketSpawn
L 08/13/2020 - 12:16:46: [SM] [2] Line 371, C:\Home\TF2-Server-Files\tf\addons\sourcemod\scripting\freaks\skeleton_king.sp::FF2_OnAbility2
L 08/13/2020 - 12:16:46: [SM] [3] Line 48, C:\Home\TF2-Server-Files\tf\addons\sourcemod\scripting\include\freak_fortress_2_subplugin.inc::FF2_OnAbility
L 08/13/2020 - 12:16:46: [SM] [5] Call_Finish
L 08/13/2020 - 12:16:46: [SM] [6] Line 17298, Unofficial Freak Fortress::UseAbility
L 08/13/2020 - 12:16:46: [SM] [7] Line 11513, Unofficial Freak Fortress::ActivateAbilitySlot
L 08/13/2020 - 12:16:46: [SM] [8] Line 11005, Unofficial Freak Fortress::BossTimer
L 08/13/2020 - 12:16:46: [SM] Exception reported: Data pack operation is out of bounds.
L 08/13/2020 - 12:16:46: [SM] Blaming: freaks/skeleton_king.ff2
L 08/13/2020 - 12:16:46: [SM] Call stack trace:
L 08/13/2020 - 12:16:46: [SM] [0] DataPack.ReadCell
L 08/13/2020 - 12:16:46: [SM] [1] Line 469, C:\Home\TF2-Server-Files\tf\addons\sourcemod\scripting\freaks\skeleton_king.sp::Timer_StartCD
MAGNAT2645 commented
These errors occur due to this line:
data.WriteCell(GetClientSerial(slot));
why would you need to get serial from SLOT? (that's not even a client index)
This is how it was originally:
new Handle:data;
CreateDataTimer(0.2, Timer_StartCD, data);
WritePackCell(data, index);
WritePackCell(data, slot);
WritePackFloat(data,-FF2_GetAbilityArgumentFloat(index,this_plugin_name,ability_name,2,5.0));
ResetPack(data);
}
}
}
}
public Action:Timer_StartCD(Handle:hTimer,Handle:data)
{
new index = ReadPackCell(data);
new slot = ReadPackCell(data);
new Float:see = ReadPackFloat(data);
FF2_SetBossCharge(index,slot,see);
}
And THIS version:
DataPack data;
CreateDataTimer(0.2, Timer_StartCD, data, TIMER_FLAG_NO_MAPCHANGE);
data.WriteCell(GetClientSerial(slot));
data.WriteCell(index);
data.WriteFloat(-FF2_GetAbilityArgumentFloat(index,this_plugin_name,ability_name,2,5.0));
data.Reset();
}
}
}
}
public Action Timer_StartCD(Handle hTimer, DataPack data)
{
int index = GetClientFromSerial(data.ReadCell());
int slot = data.ReadCell();
float see = data.ReadFloat();
FF2_SetBossCharge(index, slot, see);
}
NOTE that index and slot were swapped... but why?
MAGNAT2645 commented
Check this.
MAGNAT2645 commented
I'm not entirely sure if this problem fixed but i'll close issue anyway for now.