Hey Leute, nach langer zeit Melde ich mich mal wieder.
Ich habe ein Problem und zwar Crasht andauernd der Server wenn man bei einem Bestimmten Pickup die Z Taste drückt und ich bekomme diese fehlermeldung:
[2016-10-08 20:23:06] [debug] Run time error 4: "Array index out of bounds"
[2016-10-08 20:23:06] [debug] Accessing element at negative index -1
[2016-10-08 20:23:06] [debug] Backtrace (most recent call first):
[2016-10-08 20:23:06] [debug] #0 0002aef4 in ?? () from *****.amx
[2016-10-08 20:23:06] [debug] #1 000343b4 in OnPlayerKeyStateChange () from *****.amx
[2016-10-08 20:23:06] [debug] Aborting...
Ich hab schon alles überprüft und finde den Fehler nicht...
Code von OnPlayerKeyStateChange:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){if (IsKeyPressed(KEY_JUMP) && GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CUFFED){ApplyAnimation(playerid, "GYMNASIUM", "gym_jog_falloff", 4.1, 0, 1, 1, 0, 0);// Prevent player from jumping while cuffedreturn true;}if (IsKeyPressed(KEY_ANALOG_DOWN)){new vehicleID = GetPlayerVehicleID(playerid);if (vehicleID){if (VehicleProperty:vehicleID[RADIOSTATIONID] <= 1){VehicleProperty:vehicleID[RADIOSTATIONID] = sizeof(radioStations) - 1;}else{VehicleProperty:vehicleID[RADIOSTATIONID]--;}PlayRadioStation(playerid, VehicleProperty:vehicleID[RADIOSTATIONID]);return true;}}if (IsKeyPressed(KEY_ANALOG_UP)){new vehicleID = GetPlayerVehicleID(playerid);if (vehicleID){if (VehicleProperty:vehicleID[RADIOSTATIONID] >= sizeof(radioStations) - 1){VehicleProperty:vehicleID[RADIOSTATIONID] = 1;}else{VehicleProperty:vehicleID[RADIOSTATIONID]++;}PlayRadioStation(playerid, VehicleProperty:vehicleID[RADIOSTATIONID]);return true;}}if (IsKeyPressed(KEY_ACTION)){if (IsPlayerInAnyVehicle(playerid)){TogglePlayerVehicleEngine(playerid);return true;}}if (IsKeyPressed(KEY_NO)){if (PVar:playerid[OBJEDITOR_CURRENTOBJECTID]){CancelEdit(playerid);new arrayIndex = PVar:playerid[OBJEDITOR_CURRENTOBJECTID] - 1;new modelID = Streamer_GetIntData(STREAMER_TYPE_OBJECT, PVar:playerid[OBJEDITOR_CURRENTOBJECTID], E_STREAMER_MODEL_ID);DestroyDynamicObject(PVar:playerid[OBJEDITOR_CURRENTOBJECTID]);new fileName[STRINGLENGTH_OBJECTFILENAME];new objectID = dynamicObjects[arrayIndex][OBJECT_ID];strcat(fileName, dynamicObjects[arrayIndex][OBJECT_FILENAME]);// Unset all enum variables in the object elementCount(enumField, sizeof(dynamicObjects[])){dynamicObjects[PVar:playerid[OBJEDITOR_CURRENTOBJECTID] - 1][enum_object:enumField] = 0;}SaveObjects(fileName);UpdateObjectsForAllPlayers();SelectObject(playerid);SendClientMessageEx(playerid, COLOR_INFO, StringID:203("The object %d (%s) has been removed"), objectID, objectModels[modelID]);PVar:playerid[OBJEDITOR_CURRENTOBJECTID] = 0;return true;}}if (IsKeyPressed(KEY_WALK)){if (PVar:playerid[OBJEDITOR_CURRENTOBJECTID]){AddObject(playerid, Streamer_GetIntData(STREAMER_TYPE_OBJECT, PVar:playerid[OBJEDITOR_CURRENTOBJECTID], E_STREAMER_MODEL_ID), dynamicObjects[PVar:playerid[OBJEDITOR_CURRENTOBJECTID] - 1][OBJECT_FILENAME], true);return true;}if (permissions[playerid][PERMISSION_MAPPER]){new pickupID = IsPlayerInPickup(playerid);if (pickupID != -1){MySQLQuery("SELECT * FROM `properties` WHERE `pickupId` = '%d'", pickups[pickupID][PICKUP_ID]);mysql_store_result();if (mysql_num_rows()){PVar:playerid[SELECTEDPROPERTYID] = strval(GetMySQLField("id"));SendClientMessageEx(playerid, COLOR_INFO, StringID:142("Property '%s' selected"), GetMySQLField("name"));}else{SendClientMessageEx(playerid, COLOR_INFO, StringID:337("This pickup is not linked to a property!"));}mysql_free_result();return true;}}}if (IsKeyPressed(KEY_YES)){new pickupID = IsPlayerInPickup(playerid);if (pickupID != -1){PickupEvent(playerid, pickupID, PICKUPEVENT_KEYPRESS);return true;}}return false;}
Es is nur bei einem Bestimmten Pickup...
Hoffe ihr könnt mir helfen.
//Edit
Schon behoben. Lag im Dialog er hatte 2 Parameter aufgerufen obwohl es nur einen gab