24.06.2015, 15:43
Код:
COMMAND:vehicle(playerid, params[]) { new type[128]; if(sscanf(params, "s[128]", type)) SendClientMessage(playerid, COLOR_GREEN, "Usage: /vehicle breakin"); else { if(strcmp(type, "breakin", true) == 0) { new string[128]; new vehicle = PlayerToCar(playerid,2,4.0); new gsengine,gslightss,gsalarm,gsdoors,gsbonnet,gsboot,gsobjective; GetVehicleParamsEx(vehicle,gsengine,gslightss,gsalarm,gsdoors,gsbonnet,gsboot,gsobjective); if(IsBreaking[playerid] == 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are now working on it!"); if(PlayerInfo[playerid][pToolKit] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You don't have Toolkits."); if(VehicleInfo[vehicle][vType] != VEHICLE_OWNED) return SendClientMessage(playerid, COLOR_LIGHTRED, "This is not a ownable car."); if(IsNotLockableWithoutEngine(vehicle)) return SCM(playerid, COLOR_LIGHTRED, "This car has no engine."); if(!VehicleEmpty(vehicle)) return SCM(playerid, COLOR_LIGHTRED, "Someone is in vehicle.."); if(gsdoors == 0) return SCM(playerid, COLOR_LIGHTRED, "Vehicle is unlock.."); format(string, sizeof(string),"You are now breaking down %s's lock.", vehicleData[GetVehicleModel(vehicle) - 400][typeName]); SendClientMessage(playerid, COLOR_WHITE, string); if(VehicleInfo[vehicle][vLockType] < 6) { if(VehicleInfo[vehicle][vLockType] == 0) { //BreakDownTimer[playerid] = 30; //BreakInTimer[playerid] = SetTimerEx("BreakInVehicle", 30000, false, "i", playerid); BreakCarLB[vehicle] = Create3DTextLabel("100", COLOR_WHITE, 0.0, 0.0, 0.0, 5.0, 0, 0); Attach3DTextLabelToVehicle(BreakCarLB[vehicle], vehicle, -0.7, -1.9, -0.3); VehicleInfo[vehicle][vDamages] += 100; } if(VehicleInfo[vehicle][vLockType] == 1) { //BreakDownTimer[playerid] = 60; //BreakInTimer[playerid] = SetTimerEx("BreakInVehicle", 60000, false, "i", playerid); VehicleInfo[vehicle][vDamages] += 150; BreakCarLB[vehicle] = Create3DTextLabel("150", COLOR_WHITE, 0.0, 0.0, 0.0, 5.0, 0, 0); Attach3DTextLabelToVehicle(BreakCarLB[vehicle], vehicle, -0.7, -1.9, -0.3); } if(VehicleInfo[vehicle][vLockType] == 2) { VehicleInfo[vehicle][vDamages] += 200; BreakCarLB[vehicle] = Create3DTextLabel("200", COLOR_WHITE, 0.0, 0.0, 0.0, 5.0, 0, 0); Attach3DTextLabelToVehicle(BreakCarLB[vehicle], vehicle, -0.7, -1.9, -0.3); //BreakDownTimer[playerid] = 120; //BreakInTimer[playerid] = SetTimerEx("BreakInVehicle", 120000, false, "i", playerid); } if(VehicleInfo[vehicle][vLockType] == 3) { VehicleInfo[vehicle][vDamages] += 250; BreakCarLB[vehicle] = Create3DTextLabel("250", COLOR_WHITE, 0.0, 0.0, 0.0, 5.0, 0, 0); Attach3DTextLabelToVehicle(BreakCarLB[vehicle], vehicle, -0.7, -1.9, -0.3); //BreakDownTimer[playerid] = 180; //BreakInTimer[playerid] = SetTimerEx("BreakInVehicle", 180000, false, "i", playerid); } if(VehicleInfo[vehicle][vLockType] == 4) { VehicleInfo[vehicle][vDamages] += 300; BreakCarLB[vehicle] = Create3DTextLabel("300", COLOR_WHITE, 0.0, 0.0, 0.0, 5.0, 0, 0); Attach3DTextLabelToVehicle(BreakCarLB[vehicle], vehicle, -0.7, -1.9, -0.3); //BreakDownTimer[playerid] = 240; //BreakInTimer[playerid] = SetTimerEx("BreakInVehicle", 240000, false, "i", playerid); } if(VehicleInfo[vehicle][vLockType] == 5) { BreakCarLB[vehicle] = Create3DTextLabel("350", COLOR_WHITE, 0.0, 0.0, 0.0, 5.0, 0, 0); Attach3DTextLabelToVehicle(BreakCarLB[vehicle], vehicle, -0.7, -1.9, -0.3); VehicleInfo[vehicle][vDamages] += 350; //BreakDownTimer[playerid] = 300; //BreakInTimer[playerid] = SetTimerEx("BreakInVehicle", 300000, false, "i", playerid); } SetVehicleParamsEx(vehicle,gsengine,gslightss,1,gsdoors,gsbonnet,gsboot,1); new Float:X, Float:Y, Float:Z; GetVehiclePos(vehicle, X, Y, Z); SetPVarInt(playerid, "SaveVehicleID", vehicle); PlayerInfo[playerid][pToolKit] --; VehicleInfo[vehicle][vIsBreak] = true; CarTheft(playerid); BreakX[vehicle] = X; BreakY[vehicle] = Y; BreakZ[vehicle] = Z; IsBreaking[playerid] = 1; IsBreakingIn[playerid] = 1; foreach(new i : Player) { PlayAudioStreamForPlayer(i, "http://dx.sc.chinaz.com/Files/DownLoad/sound1/201406/4611.mp3", X, Y, Z, 40.0, 1); } } } } return 1; }
Код:
[23:21:50] cmd_> Sakura_Test [ID: 0]: /vehicle breakin [23:21:50] [debug] Run time error 4: "Array index out of bounds" [23:21:50] [debug] Accessing element at negative index -166 [23:21:50] [debug] AMX backtrace: [23:21:50] [debug] #0 0034a24c in ?? (0x00000000) from gamemode.amx [23:21:50] [debug] #1 000823b0 in public cmd_vehicle (0x00000000, 0x0758a2fc) from gamemode.amx [23:21:50] [debug] #2 native CallLocalFunction () [00474110] from samp-server.exe [23:21:50] [debug] #3 000158a0 in public FIXES_OnPlayerCommandText (0x00000000, 0x0758a2b8) from gamemode.amx [23:21:50] [debug] #4 native CallLocalFunction () [00474110] from samp-server.exe [23:21:50] [debug] #5 00000c78 in public OnPlayerCommandText (0x00000000, 0x0758a274) from gamemode.amx