|
Senior Member
Join Date: Jul 2018
Location: Portugal
|
04-28-2021
, 05:34
Re: Invalid Handle
|
#3
|
Quote:
Originally Posted by asherkin
What is the exact error you get? on what line?
|
Invalid Handle 3 (error 7)
I did some changes on the code, but still not fixed.
the loop works but when the size of the array with 2 of skinrarity gets to 10 the next loop gives that error
Spoiler
public Action GetData(Handle timer, any data)
{
KeyValues kv = new KeyValues("Skins");
kv.ImportFromFile(SkinListPath);
int count = 0;
if (!KvGotoFirstSubKey(kv))
{
SetFailState("CFG File not found: %s", SkinListPath);
CloseHandle(kv);
return;
}
do {
char sectionname[64];
char skinindex[5];
char weaponclasses[1024];
char tier[5];
KvGetSectionName(kv, sectionname, 64);
KvGetString(kv, "classes", weaponclasses, 1024);
KvGetString(kv, "index", skinindex, 5);
KvGetString(kv, "skintier", tier, 5);
strcopy(WeaponList[count].name, 64, sectionname);
WeaponList[count].index = StringToInt(skinindex);
strcopy(WeaponList[count].class, 1024, weaponclasses);
WeaponList[count].weapontier = StringToInt(tier);
if(WeaponList[count].weapontier == 0)
continue;
if(WeaponList[count].weapontier >= MAX_TIER_LISTS)
continue;
int skinrarity = WeaponList[count].weapontier - 1;
int number = GetArraySize(g_aSkinList[skinrarity]);
ResizeArray(g_aSkinList[skinrarity], number + 1);
SetArrayString(g_aSkinList[skinrarity], number, WeaponList[count].name);
count++;
} while (KvGotoNextKey(kv));
for(int i = 0; i<MAX_TIER_LISTS;i++)
{
LogAction(0,-1, "%i", GetArraySize(g_aSkinList[i]));
}
}
I m anexing the sp file.
__________________
Last edited by DiogoOnAir; 04-29-2021 at 11:15.
|
|
|
|