My GM crashes - 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: My GM crashes (
/showthread.php?tid=639383)
My GM crashes -
Antenastyle - 16.08.2017
So I've been making a furniture system, but when I have to load them, it crashes, this is the line where the crashdetect says that it crash... I don't know what's the problem...
Код:
id = CreateDynamicObject(HouseFurnitures[ FurnitureData[FurnitureID] ][ModelID], FurnitureData[furnitureX], FurnitureData[furnitureY], FurnitureData[furnitureZ], FurnitureData[furnitureRX], FurnitureData[furnitureRY], FurnitureData[furnitureRZ], cache_get_field_content_int(loaded, "furnitureVW"), cache_get_field_content_int(loaded, "furnitureInt"));
Pawno complies it without errors and mysql have no errors. I have tried printing the information that loads the callback, but all the information is OK...
Re: My GM crashes -
Kane - 16.08.2017
Код:
FurnitureData[furnitureX],
FurnitureData[furnitureY],
FurnitureData[furnitureZ],
FurnitureData[furnitureRX],
FurnitureData[furnitureRY],
FurnitureData[furnitureRZ]
Is this meant to be like that?
Re: My GM crashes -
Antenastyle - 16.08.2017
Quote:
Originally Posted by Arthur Kane
Код:
FurnitureData[furnitureX],
FurnitureData[furnitureY],
FurnitureData[furnitureZ],
FurnitureData[furnitureRX],
FurnitureData[furnitureRY],
FurnitureData[furnitureRZ]
Is this meant to be like that?
|
Yes, thats it
Re: My GM crashes -
Kane - 16.08.2017
Show your code for FurnitureData.
Re: My GM crashes -
Antenastyle - 17.08.2017
Код:
enum fInfo
{
SQLID,
HouseSQLID,
FurnitureID,
Float: furnitureX,
Float: furnitureY,
Float: furnitureZ,
Float: furnitureRX,
Float: furnitureRY,
Float: furnitureRZ
}
new FurnitureData[fInfo]
There is no problem with this, I think...
Re: My GM crashes -
Kane - 17.08.2017
https://sampforum.blast.hk/showthread.php?tid=318212
How's FurnitureData going to be indexed? You need to make a two dimensional array.
An example:
PHP код:
#define MAX_FURNITURE (1000)
enum fInfo
{
SQLID,
HouseSQLID,
FurnitureID,
Float: furnitureX,
Float: furnitureY,
Float: furnitureZ,
Float: furnitureRX,
Float: furnitureRY,
Float: furnitureRZ
}
new FurnitureData[MAX_FURNITURE][fInfo];
Re: My GM crashes -
Misiur - 17.08.2017
pawn Код:
HouseFurnitures[ FurnitureData[FurnitureID] ]
This is 100% the cause. I guess you get "Accessing array index out of bounds on index" either -1 or some large number. You have to check first what the value holds:
pawn Код:
printf("%d", FurnitureData[FurnitureID]);
If it's negative, really big, or your defined invalid value for "FurnitureID", you need to add a surrounding if clause, or change the code in some other way