Команда показа ПТС:
cmd:pts(playerid, params[]) { if(login_check{playerid} == false) return true; return SCM(playerid, COLOR_RED, !"[SERVER] Вы должны находиться в транспорте, чтобы показать ПТС транспорта!"); if(vehicleid == INVALID_VEHICLE_ID) return false; if(veh[vehicleid][v_ownerid] != playerid) return SCM(playerid, COLOR_RED, !"[SERVER] Это не ваш транспорт!"); if(spawn_veh{vehicleid} == true) return SCM(playerid, COLOR_RED, !"[SERVER] У созданных администраторами транспортных средств нету ПТС!"); new targetid; return SCM(playerid, COLOR_RED, !"[SERVER] Образец показа ПТС транспорта: /pts [id]"); return SCM(playerid, COLOR_RED, !"[SERVER] Игрок с введенным вами ID не в сети!"); if(login_check{targetid} == false) return SCM(playerid, COLOR_RED, !"[SERVER] Игрок с введенным вами ID не авторизован!"); static fmt_str[] = "*%s показал%s ПТС автомобиля %s"; new string[sizeof(fmt_str)-6+MAX_PLAYER_NAME*2+1+1]; format(string, sizeof(string), fmt_str, GetName(playerid), (player[playerid][p_sex] == 1) ? ("") : ("а"), GetName(targetid)); ProxDetector(playerid, 5.0, COLOR_ACTION, string); ShowPTS(targetid, vehicleid); return true; }
Сток показа ПТС:
stock ShowPTS(playerid, vehid) { static fmt_str[] = "\ {00C0FF}Владелец:\t\t\t\t{F81414}%s\ \n{00C0FF}ID транспорта:\t\t\t\t{F81414}%d\ \n{00C0FF}Модель:\t\t\t\t\t{F81414}%s\ \n{00C0FF}Класс:\t\t\t\t\t{F81414}%s\ "; new string[sizeof(fmt_str)-8+MAX_PLAYER_NAME+11+25+1+1]; format(string, sizeof(string), fmt_str, GetName(veh[vehid][v_ownerid]), veh[vehid][v_tableid], ModelName[veh[vehid][v_model]-400], car_class[veh[vehid][v_class]-1]); SPD(playerid, DLG_ID_NONE, DSM, !"{00C0FF}ПТС", string, !"{00C0FF}Понятно", !""); }
При вводе команды в консоль выводятся варнинги (крашдетекта)
[15:49:13] [connection] incoming connection: 127.0.0.1:61665 id: 0 [15:49:13] [join] Steve_Stage has joined the server (0:127.0.0.1) [15:49:23] [debug] Run time error 4: "Array index out of bounds" [15:49:23] [debug] Attempted to read/write array element at negative index -1 [15:49:23] [debug] AMX backtrace: [15:49:23] [debug] #0 00027228 in ShowPTS (playerid=0, vehid=1) at C:\Users\HP\Desktop\Документы\2) Pawn\Мои моды\Junction RP\gamemodes\JunctionMode.pwn:3193 [15:49:23] [debug] #1 0003522c in public pc_cmd_pts (playerid=0, params[]=@0005b278 "0") at C:\Users\HP\Desktop\Документы\2) Pawn\Мои моды\Junction RP\gamemodes\JunctionMode.pwn:4256 [15:49:24] [part] Steve_Stage has left the server (0:1)
Что делать?