Raised This Month: $89 Target: $400
 22% 

[SM] Exception reported: Array index out-of-bounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SEAL Gaby
New Member
Join Date: Aug 2019
Old 08-26-2019 , 13:04   [SM] Exception reported: Array index out-of-bounds
Reply With Quote #1

Hi, how are you? I have an error with this plugin and I can not make it work, I am new to compile and others

L 08/26/2019 - 13:48:19: [SM] Exception reported: Array index out-of-bounds (index -1, limit 256)
L 08/26/2019 - 13:48:19: [SM] Blaming: clientmod_assistkill_example.smx
L 08/26/2019 - 13:48:19: [SM] Call stack trace:
L 08/26/2019 - 13:48:19: [SM] [1] Line 61, D:\A1 SEAL-TEAM server prueba\sv\sm2\addons\sourcemod\scripting\clie ntmod_assistkill_example.sp::ClientModAssistP atch
L 08/26/2019 - 13:48:19: [SM] [2] Line 17, D:\A1 SEAL-TEAM server prueba\sv\sm2\addons\sourcemod\scripting\clie ntmod_assistkill_example.sp::OnPluginStart


public void OnPluginStart()
{
ClientModAssistPatch(); //line 17
HookEvent("player_death", Event_PlayerDeath, EventHookMode_Pre);
}

--------------------------

if (FinalEventFilePath[strlen(FinalEventFilePath) - 1] == 's') //line 61
SEAL Gaby is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 08-26-2019 , 16:05   Re: [SM] Exception reported: Array index out-of-bounds
Reply With Quote #2

Try reading the error
Your strlen() is returning 0 and then subtracting 1 making it go to -1 and out of bounds of the array.
__________________
Mitchell is online now
SEAL Gaby
New Member
Join Date: Aug 2019
Old 09-10-2019 , 17:49   Re: [SM] Exception reported: Array index out-of-bounds
Reply With Quote #3

Quote:
Originally Posted by Mitchell View Post
Try reading the error
Your strlen() is returning 0 and then subtracting 1 making it go to -1 and out of bounds of the array.
now load it but don't patch it T-T
"[ClientMod] Kill assist event failed patch!
[SM] Loaded plugin clientmod_assistkill_example.smx successfully. "

HELP ME! T-T

public void OnPluginStart()
{
ClientModAssistPatch();
HookEvent("player_death", Event_PlayerDeath, EventHookMode_Pre);
}

public void Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast)
{
event.SetInt("assister", event.GetInt("userid"));
}

void ClientModAssistPatch() // автоматическое добавление возможности отправки ассиста со стороны сервера
{
bool bSuccessfull = false;
char FinalEventFilePath[PLATFORM_MAX_PATH];
DirectoryListing EventFileSearch = OpenDirectory(".", true, "MOD");
if (EventFileSearch != null)
{
char DirName[PLATFORM_MAX_PATH];
FileType cFileType = FileType_Unknown;
while (EventFileSearch.GetNext(DirName, sizeof(DirName), cFileType))
{
if (cFileType == FileType_Directory && strcmp(DirName, "resource", false) == 0)
{
strcopy(FinalEventFilePath, sizeof(FinalEventFilePath), DirName);

delete EventFileSearch;
EventFileSearch = OpenDirectory(DirName, true, "MOD");
if (EventFileSearch != null)
{
while (EventFileSearch.GetNext(DirName, sizeof(DirName), cFileType))
{
if (cFileType == FileType_File && strcmp(DirName, "modevents.res", false) == 0)
{
Format(FinalEventFilePath, sizeof(FinalEventFilePath), "%s/%s", FinalEventFilePath, DirName);
break;
}
}
}
break;
}
}
if (EventFileSearch != null)
delete EventFileSearch;
}

if (FinalEventFilePath[strlen(FinalEventFilePath) - 0] == 's')
{
char cTrash[8];
KeyValues hModEvents = new KeyValues("cstrikeevents");
if (hModEvents.ImportFromFile(FinalEventFilePath ) && hModEvents.JumpToKey("player_death"))
{
bool bAlreadyPatched = hModEvents.GetString("assister", cTrash, sizeof(cTrash)) && strcmp(cTrash, "short") == 0;
bool bPatched = false;
if (!bAlreadyPatched)
{
hModEvents.SetString("assister", "short");

hModEvents.Rewind();
if (hModEvents.JumpToKey("hostage_rescued_all"))
{
hModEvents.SetString("clientmodfix", "none");
}

hModEvents.Rewind();
if (hModEvents.JumpToKey("round_freeze_end"))
{
hModEvents.SetString("clientmodfix", "none");
}

hModEvents.Rewind();
if (hModEvents.JumpToKey("nav_generate"))
{
hModEvents.SetString("clientmodfix", "none");
}

hModEvents.Rewind();
bPatched = hModEvents.ExportToFile(FinalEventFilePath);
}

if (bPatched)
PrintToServer("[ClientMod] Kill assist event successfully patched! Restart server for use.");
else if (bAlreadyPatched)
PrintToServer("[ClientMod] Kill assist event already patched!");


bSuccessfull = bAlreadyPatched || bPatched;
}
delete hModEvents;
}


if (!bSuccessfull)
PrintToServer("[ClientMod] Kill assist event failed patch!");

}

Last edited by SEAL Gaby; 09-10-2019 at 17:50. Reason: plugin source
SEAL Gaby is offline
SEAL Gaby
New Member
Join Date: Aug 2019
Old 09-10-2019 , 18:06   Re: [SM] Exception reported: Array index out-of-bounds
Reply With Quote #4

Quote:
Originally Posted by Mitchell View Post
Try reading the error
Your strlen() is returning 0 and then subtracting 1 making it go to -1 and out of bounds of the array.
in windows it works, but in linux it doesn't give that error, and I don't understand D: !
Will it be for the gamedata?
SEAL Gaby is offline
Reply


Thread Tools
Display Modes

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 20:38.


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