Просмотр полной версии : [Вопрос] Attempted to read/write array element at negative index -400
[18:21:55] [debug] Run time error 4: "Array index out of bounds"
[18:21:55] [debug] Attempted to read/write array element at negative index -400
[18:21:55] [debug] AMX backtrace:
format(string,sizeof(string),"%s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid)-400)]);
PlayerTextDrawSetString(playerid,vehicle_speed[playerid][2],string);
В чем проблема ?
[18:21:55] [debug] Run time error 4: "Array index out of bounds"
[18:21:55] [debug] Attempted to read/write array element at negative index -400
[18:21:55] [debug] AMX backtrace:
format(string,sizeof(string),"%s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid)-400)]);
PlayerTextDrawSetString(playerid,vehicle_speed[playerid][2],string);
В чем проблема ?
format(string,sizeof(string),"%s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
PlayerTextDrawSetString(playerid,vehicle_speed[playerid][2],string);
Не помогает всё так же в логах пишет
[21:54:06] [debug] Run time error 4: "Array index out of bounds"
[21:54:06] [debug] Attempted to read/write array element at negative index -400
[21:54:06] [debug] AMX backtrace:
[21:54:06] [debug] #0 000625bc in public @__updeit_speed (playerid=0) at C:\Users\User\Desktop\gta\gamemodes\samp.pwn:4963
Ну так проверяй, сидит ли игрок в каком-либо авто, прежде чем выполнять этот код =\ Раз ругается на отрицательный индекс "-400", значит GetVehicleModel и GetPlayerVehicleID вернули 0, что случается только когда игрок не сидит в авто.
Powered by vBulletin® Version 4.2.0 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. Перевод: zCarot