naja nicht wirklich erfolg dabei, er durchläuft alles sauber und zeigt mir die im XML hinterlegten positionen richtig an
So jetzt hab ich herrausgefunden dass er genau da:
DialogResponse:TuningGarage_Neon(playerID, response, listItem, inputText[]){if (response){new tuningPartIndex;new XMLNode:xml = XML_LoadDocument("vehiclemodels.xml");xml = XML_GetFirstChild(xml, "vehiclemodels");new XMLNode:modelNode = XML_GetFirstChild(xml, "model");while (modelNode){new modelID = XML_GetIntAttribute(modelNode, "id");if (modelID < 400 || modelID > 611){printf("Invalid vehicle model ID: %d", modelID);modelNode = XML_GetNextSibling(modelNode, "model");continue;}new arrayIndex = modelID - 400;// First array element starts with 0, vehicle models are starting with 400 (400 - 400 = 0, 401 - 400 = 1, ...)new tuningPartSlot;new XMLNode:neonNode = XML_GetFirstChild(modelNode, "neon");if (neonNode){new Float:neonPosX = XML_GetFloatAttribute(neonNode, "x");new Float:neonPosY = XML_GetFloatAttribute(neonNode, "y");new Float:neonPosZ = XML_GetFloatAttribute(neonNode, "z");new neonPrice = XML_GetIntAttribute(neonNode, "price");for (new neonModelID = 18647; neonModelID <= 18652; neonModelID++){if (tuningPartSlot >= MAX_TUNINGPARTSPERVEHICLE){break;}g_tuningParts[tuningPartIndex][E_TUNINGPART_MODELID] = neonModelID;g_tuningParts[tuningPartIndex][E_TUNINGPART_PRICE] = neonPrice;g_tuningParts[tuningPartIndex][E_TUNINGPART_TYPE] = TUNINGPART_NEON;// Left sideg_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_X][0] = -neonPosX;g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_Y][0] = neonPosY;g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_Z][0] = neonPosZ;// Right sideg_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_X][1] = neonPosX;g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_Y][1] = neonPosY;g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_Z][1] = neonPosZ;g_vehicleModels[arrayIndex][E_VEHICLEMODEL_TUNINGPARTS][tuningPartSlot] = tuningPartIndex;tuningPartSlot++;tuningPartIndex++;printf("PosX = %f, PosY = %f, PosZ = %f", neonPosX, neonPosY, neonPosZ); //Genau bis hier hin geht er}}}if (listItem == 1)//Green{if (GetPlayerMoney(playerID) < TUNINGGARAGE_PRICE_NEON){GameTextForPlayer(playerID, LanguageString(playerID, StringID:80("You do not have enough money!")), 3000, 3);ShowDialog:TuningGarage_Neon(playerID);}else{printf("Neon Green used...");new vehicleID = GetPlayerVehicleID(playerID);new XMLNode:neonNode = XML_GetFirstChild(modelNode, "neon");if (neonNode){new Float:neonPosX = XML_GetFloatAttribute(neonNode, "x");new Float:neonPosY = XML_GetFloatAttribute(neonNode, "y");new Float:neonPosZ = XML_GetFloatAttribute(neonNode, "z");printf("PosX = %f, PosY = %f, PosZ = %f", neonPosX, neonPosY, neonPosZ);g_tuningParts[tuningPartIndex][E_TUNINGPART_NEON][0] = CreateObject(18649,0,0,0,0,0,0);g_tuningParts[tuningPartIndex][E_TUNINGPART_NEON][1] = CreateObject(18649,0,0,0,0,0,0);AttachObjectToVehicle(g_tuningParts[tuningPartIndex][E_TUNINGPART_NEON][0], GetPlayerVehicleID(playerID), -neonPosX, neonPosY, neonPosZ, 0.000000, 0.000000, 0.000000);AttachObjectToVehicle(g_tuningParts[tuningPartIndex][E_TUNINGPART_NEON][1], GetPlayerVehicleID(playerID), neonPosX, neonPosY, neonPosZ, 0.000000, 0.000000, 0.000000);printf("Attaching on Vehicle %d", vehicleID);ShowDialog:TuningGarage_Neon(playerID);}}}else{ShowDialog:TuningGarage_CategoryTypes(playerID, listItem);}
Wo ich es grün hinterlegt habe, kommt allerdings crasht er vorher und zeigt mir die Position millionen fach an mit der folgenden log:
[2019-10-16 21:47:49] [debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[2019-10-16 21:47:49] [debug] Stack pointer (STK) is 0x9D1504, heap pointer (HEA) is 0x9D1650
[2019-10-16 21:47:49] [debug] AMX backtrace:
[2019-10-16 21:47:49] [debug] #0 00013120 in ?? (60, 257) from grgserver.amx
[2019-10-16 21:47:49] [debug] #1 0003f2f0 in ?? (60) from grgserver.amx
[2019-10-16 21:47:49] [debug] #2 0003d3f0 in ?? (60, 3) from grgserver.amx
[2019-10-16 21:47:49] [debug] #3 0003e4ac in public DR_TuningGarage_MainMenu (60, 1, 3, 10291772) from grgserv$
[2019-10-16 21:47:49] [debug] #4 native CallLocalFunction () from samp03svr
[2019-10-16 21:47:49] [debug] #5 0002ca50 in public OnDialogResponse (60, 0, 1, 3, 10291752) from grgserver.amx
[2019-10-16 21:47:51] PosX = -0.924996, PosY = 0.009998, PosZ = -0.674996
[2019-10-16 21:47:51] PosX = -0.924996, PosY = 0.009998, PosZ = -0.674996
[2019-10-16 21:47:51] PosX = -0.924996, PosY = 0.009998, PosZ = -0.674996
[2019-10-16 21:47:51] PosX = -0.924996, PosY = 0.009998, PosZ = -0.674996
Nach viel Rumprobieren hab ich nun jede Röhren Farbe auf das geändert...
if (listItem == 1)//Green
{
new count;
new tuningPartIndex;
new XMLNode:xml = XML_LoadDocument("vehiclemodels.xml");
xml = XML_GetFirstChild(xml, "vehiclemodels");
new XMLNode:modelNode = XML_GetFirstChild(xml, "model");
while (modelNode)
{
new XMLNode:neonNode = XML_GetFirstChild(modelNode, "neon");
if (neonNode)
{
new Float:neonPosX = XML_GetFloatAttribute(neonNode, "x");
new Float:neonPosY = XML_GetFloatAttribute(neonNode, "y");
new Float:neonPosZ = XML_GetFloatAttribute(neonNode, "z");
g_tuningParts[tuningPartIndex][E_TUNINGPART_TYPE] = TUNINGPART_NEON;
// Left side
g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_X][0] = -neonPosX;
g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_Y][0] = neonPosY;
g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_Z][0] = neonPosZ;
// Right side
g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_X][1] = neonPosX;
g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_Y][1] = neonPosY;
g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_Z][1] = neonPosZ;
tuningPartIndex++;
count++;
modelNode = XML_GetNextSibling(modelNode, "model");
}
}
if (GetPlayerMoney(playerID) < TUNINGGARAGE_PRICE_NEON)
{
GameTextForPlayer(playerID, LanguageString(playerID, StringID:80("You do not have enough money!")), 3000, 3);
ShowDialog:TuningGarage_Neon(playerID);
}
else
{
printf("Neon Green used...");
printf("PosX = %f, PosY = %f, PosZ = %f", g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_X][0], g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_Y][0], g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_Z][0]);
printf("2 Position PosX = %f, PosY = %f, PosZ = %f", g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_X][1], g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_Y][1], g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_Z][1]);
g_tuningParts[tuningPartIndex][E_TUNINGPART_NEON][0] = CreateObject(18649,0,0,0,0,0,0);
g_tuningParts[tuningPartIndex][E_TUNINGPART_NEON][1] = CreateObject(18649,0,0,0,0,0,0);
AttachObjectToVehicle(g_tuningParts[tuningPartIndex][E_TUNINGPART_NEON][0], GetPlayerVehicleID(playerID), g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_X][0], g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_Y][0], g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_Z][0], 0.000000, 0.000000, 0.000000);
AttachObjectToVehicle(g_tuningParts[tuningPartIndex][E_TUNINGPART_NEON][1], GetPlayerVehicleID(playerID), g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_X][1], g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_Y][1], g_tuningParts[tuningPartIndex][E_TUNINGPART_OFFSET_Z][1], 0.000000, 0.000000, 0.000000);
ShowDialog:TuningGarage_Neon(playerID);
}
XML_UnloadDocument(xml);
}
else
{
ShowDialog:TuningGarage_CategoryTypes(playerID, listItem);
}
Da ich der meinung war, dass es da durch kommt das ich die XML schon nach den response auslese... dennoch immer noch das gleiche mit dem Crashen und meinie Printf zeigt er erst garnicht an...
Nicht mal wenn ich nicht genug geld habe, bringt er mir irgend etwas...