Gas Station [invalid subscript error] - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Gas Station [invalid subscript error] (
/showthread.php?tid=581812)
Gas Station [invalid subscript error] -
Zens - 15.07.2015
I keep getting this error, how come it aint working?
Код:
C:\Users\Test\Desktop\roleplay.pwn(2074) : error 028: invalid subscript (not an array or too many subscripts): "GasStationData"
C:\Users\Test\Desktop\roleplay.pwn(2074) : warning 215: expression has no effect
C:\Users\Test\Desktop\roleplay.pwn(2074) : error 001: expected token: ";", but found "]"
C:\Users\Test\Desktop\roleplay.pwn(2074) : error 029: invalid expression, assumed zero
C:\Users\Test\Desktop\roleplay.pwn(2074) : fatal error 107: too many error messages on one line
The code that brings up the error:
Код:
forward OnGasStationCreated(bizid);
public OnGasStationCreated(bizid)
{
if (bizid == -1 || !GasStationData[bizid][gsExists]); // <--- This line brings the error.
return 0;
GasStationData[bizid][gsID] = mysql_insert_id();
GasStation_Save(bizid);
return 1;
}
forward GasStation_Load();
public GasStation_Load()
{
static
rows,
fields;
cache_get_data(rows, fields, g_iHandle);
for (new i = 0; i < rows; i ++) if (i < MAX_GASSTATIONS)
{
GasStationData[i][gsExists] = true;
GasStationData[i][gsID] = cache_get_field_int(i, "gsID");
cache_get_field_content(i, "gsName", GasStationData[i][gsName], g_iHandle);
cache_get_field_content(i, "gsMessage", GasStationData[i][gsMessage], g_iHandle);
GasStationData[i][gsOwner] = cache_get_field_int(i, "gsOwner");
GasStationData[i][gsPrice] = cache_get_field_int(i, "gsPrice");
GasStationData[i][gsRange] = cache_get_field_int(i, "gsRange");
GasStationData[i][gsPos][0] = cache_get_field_float(i, "gsPosX");
GasStationData[i][gsPos][1] = cache_get_field_float(i, "gsPosY");
GasStationData[i][gsPos][2] = cache_get_field_float(i, "gsPosZ");
GasStation_Refresh(i);
}
return 1;
}
Re: Gas Station [invalid subscript error] -
Zens - 15.07.2015
Fixed it, nvm