Raised This Month: $ Target: $400
 0% 

Solved Bot Mimic: Enum Structs (Invalid Handle)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
LeeStrong
AlliedModders Donor
Join Date: Nov 2015
Old 04-17-2020 , 14:06   Bot Mimic: Enum Structs (Invalid Handle)
Reply With Quote #1

Hi all,
I am working on a project at the moment that uses "Bot Mimic" to record and play replay bots.

The coded has been updated to the new syntax however the following error gets tripped;

ERROR
Code:
[SM] Exception reported: Invalid Handle 0 (error: 4)
[SM] Blaming: surftimer.smx
[SM] Call stack trace:
[SM]   [0] PushArrayArray
[SM]   [1] Line 644, surftimer/replay.sp::LoadRecordFromFile
[SM]   [2] Line 432, surftimer/replay.sp::PlayRecord
[SM]   [3] Line 721, surftimer/replay.sp::LoadRecordReplay
[SM]   [4] Line 683, surftimer/replay.sp::RefreshBot
I was wondering if anyone could possibly look at these segments of code, before/after the new syntax and ask if you would have done anything differently, or spot something I perhaps didn't that may cause the above error?

Quote:
Originally Posted by BEFORE
Code:
	Handle hRecordFrames = CreateArray(view_as<int>(FrameInfo));
	Handle hAdditionalTeleport = CreateArray(AT_SIZE);

	int iFrame[FRAME_INFO_SIZE];
	for (int i = 0; i < iTickCount; i++)
	{
		ReadFile(hFile, iFrame, view_as<int>(FrameInfo), 4);
		PushArrayArray(hRecordFrames, iFrame, view_as<int>(FrameInfo));
Quote:
Originally Posted by AFTER
Code:
	Handle hRecordFrames = CreateArray(sizeof(FrameInfo));
	Handle hAdditionalTeleport = CreateArray(sizeof(AdditionalTeleport));
	FrameInfo iFrame;
	for (int i = 0; i < iTickCount; i++)
	{
		ReadFile(hFile, iFrame.PlayerButtons, sizeof(FrameInfo), 4);
		ReadFile(hFile, iFrame.PlayerImpulse, sizeof(FrameInfo), 4);
		ReadFile(hFile, view_as<int>(iFrame.ActualVelocity), sizeof(FrameInfo), 4);
		ReadFile(hFile, view_as<int>(iFrame.PredictedVelocity), sizeof(FrameInfo), 4);
		ReadFile(hFile, view_as<int>(iFrame.PredictedAngles), sizeof(FrameInfo), 4);
		ReadFile(hFile, view_as<int>(iFrame.NewWeapon), sizeof(FrameInfo), 4);
		ReadFile(hFile, iFrame.PlayerSubtype, sizeof(FrameInfo), 4);
		ReadFile(hFile, iFrame.PlayerSeed, sizeof(FrameInfo), 4);
		ReadFile(hFile, iFrame.AdditionalFields, sizeof(FrameInfo), 4);
		ReadFile(hFile, iFrame.Pause, sizeof(FrameInfo), 4);
		PushArrayArray(hRecordFrames, iFrame, sizeof(FrameInfo));
Quote:
Originally Posted by BEFORE
Code:
enum FrameInfo
{
	playerButtons = 0,
	playerImpulse,
	Float:actualVelocity[3],
	Float:predictedVelocity[3],
	Float:predictedAngles[2],
	CSWeaponID:newWeapon,
	playerSubtype,
	playerSeed,
	additionalFields,
	pause,
}
Quote:
Originally Posted by AFTER
Code:
enum struct FrameInfo
{
	int PlayerButtons;
	int PlayerImpulse;
	float ActualVelocity[3];
	float PredictedVelocity[3];
	float PredictedAngles[2];
	CSWeaponID NewWeapon;
	int PlayerSubtype;
	int PlayerSeed;
	int AdditionalFields;
	int Pause;
}

Last edited by LeeStrong; 04-18-2020 at 07:01.
LeeStrong is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:58.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode