Member
|
09-18-2016
, 12:05
GetArrayString - InvalidIndex 1 ;/
|
#1
|
hi i have this problem:
Code:
L 09/18/2016 - 18:02:42: [SM] Exception reported: Invalid index 1 (count: 1)
L 09/18/2016 - 18:02:42: [SM] Blaming: buildinghats.smx()
L 09/18/2016 - 18:02:42: [SM] Call stack trace:
L 09/18/2016 - 18:02:42: [SM] [0] GetArrayString
L 09/18/2016 - 18:02:42: [SM] [1] Line 534, buildinghats.sp::Event_PlayerBuiltObject()
and
Code:
L 09/18/2016 - 18:02:27: [SM] Exception reported: Invalid index 1 (count: 1)
L 09/18/2016 - 18:02:27: [SM] Blaming: buildinghats.smx()
L 09/18/2016 - 18:02:27: [SM] Call stack trace:
L 09/18/2016 - 18:02:27: [SM] [0] GetArrayString
L 09/18/2016 - 18:02:27: [SM] [1] Line 491, buildinghats.sp::Timer_ReHat()
how to fix that ?
Code:
ublic Action:Timer_ReHat(Handle:timer, any:iBuilding)
{
if(!g_bCvarEnabled)
return Plugin_Continue;
if(iBuilding > MaxClients && IsValidEntity(iBuilding))
{
decl String:strPath[PLATFORM_MAX_PATH], String:strOffz[16], String:strScale[16], String:strAnima[128];
new row = (GetArraySize(hHatInfo) / 4) - 1;
new index = (GetRandomInt(0, row)) * 4;
GetArrayString(hHatInfo, index+1, strPath, sizeof(strPath)); // LINE 491 <<<--------------------------
GetArrayString(hHatInfo, index+2, strOffz, sizeof(strOffz));
GetArrayString(hHatInfo, index+3, strScale, sizeof(strScale));
GetArrayString(hHatInfo, index+4, strAnima, sizeof(strAnima));
new TFObjectType:objectT = TFObjectType:TF2_GetObjectType(iBuilding)
if(objectT == TFObject_Sentry)
ParentHatEntity(iBuilding, strPath, StringToFloat(strOffz), StringToFloat(strScale), TFObject_Sentry, strAnima);
else if(objectT == TFObject_Dispenser)
ParentHatEntity(iBuilding, strPath, StringToFloat(strOffz), StringToFloat(strScale), TFObject_Dispenser, strAnima);
}
return Plugin_Handled;
}
Code:
public Action:Event_PlayerBuiltObject(Handle:event, const String:name[], bool:dontBroadcast)
{
if(!g_bCvarEnabled)
return Plugin_Continue;
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new TFObjectType:objectT = TFObjectType:GetEventInt(event, "object");
if(client >= 1 && client <= MaxClients && IsClientInGame(client) && g_bWantsTheH[client])
{
if(!CheckCommandAccess(client, "sm_buildinghats_access", 0))
return Plugin_Handled;
new iBuilding = GetEventInt(event, "index");
if(iBuilding > MaxClients && IsValidEntity(iBuilding))
{
if(!GetEntProp(iBuilding, Prop_Send, "m_bCarryDeploy"))
{
g_ModelIndex[iBuilding] = INVALID_STRING_INDEX;
g_flZOffset[iBuilding] = 0.0;
g_flModelScale[iBuilding]= 0.0;
Format(g_strParticle[iBuilding], sizeof(g_strParticle), "");
decl String:strPath[PLATFORM_MAX_PATH], String:strOffz[16], String:strScale[16], String:strAnima[128];
new row = (GetArraySize(hHatInfo) / 4) - 1;
new index = (GetRandomInt(0, row)) * 4;
GetArrayString(hHatInfo, index+1, strPath, sizeof(strPath)); // LINE 534 <<<-------------------------
GetArrayString(hHatInfo, index+2, strOffz, sizeof(strOffz));
GetArrayString(hHatInfo, index+3, strScale, sizeof(strScale));
GetArrayString(hHatInfo, index+4, strAnima, sizeof(strAnima));
if(objectT == TFObject_Sentry)
{
if(GetEntProp(iBuilding, Prop_Send, "m_bMiniBuilding"))
{
SetVariantInt(2);
AcceptEntityInput(iBuilding, "SetBodyGroup");
CreateTimer(3.0, Timer_TurnTheLightsOff, iBuilding);
}
ParentHatEntity(iBuilding, strPath, StringToFloat(strOffz), StringToFloat(strScale), TFObject_Sentry, strAnima);
// PrintToChatAll("%s", strPath);
}
else if(objectT == TFObject_Dispenser)
{
ParentHatEntity(iBuilding, strPath, StringToFloat(strOffz), StringToFloat(strScale), TFObject_Dispenser, strAnima);
// PrintToChatAll("%s", strPath);
}
}
}
}
return Plugin_Handled;
}
Thanks for help ))
Last edited by Kamil445; 09-18-2016 at 12:06.
|
|