01.08.2018, 19:53
(
Last edited by R3SpaWn0; 01/08/2018 at 09:49 PM.
)
EDIT: Solved, it was becouse in OnPlayerExit i have SaveCar and SaveCharacter, and i was using Temporal Veh /veh, and when the scripts want to go save the veh coordinates in database say error becouse the vehicle dont really exist in database, its temporal ! I fixed it with brain and:
Now i go to create the /savecar cmd to insert to database
Hi, i m running my script and its running perfect, but i was testing with a friend and i saw i got in console this, and then server i think reboot..
I show you OnPlayerExitVehicle
Is good to Car_Save and SaveCharacter on here? or maybe i make a timer with that? thank you !
Code:
if (CoreVehicles[vehicleid][vehTemporary]) { SendClientMessage(playerid, COLOR_LIGHTRED, "Server tried to save coordinates of this temporary car but it's not existing, now it's not causing bug !!"); return 1; }
Hi, i m running my script and its running perfect, but i was testing with a friend and i saw i got in console this, and then server i think reboot..
Code:
[20:21:12] [debug] #0 000b8c30 in public OnPlayerExitVehicle (0x00000001, 0x0000000e) from roleplay.amx [20:21:39] [debug] Run time error 4: "Array index out of bounds" [20:21:39] [debug] Accessing element at negative index -1 [20:21:39] [debug] AMX backtrace: [20:21:39] [debug] #0 000b8c30 in public OnPlayerExitVehicle (0x00000001, 0x0000000e) from roleplay.amx [20:23:48] [debug] Run time error 4: "Array index out of bounds" [20:23:48] [debug] Accessing element at negative index -1 [20:23:48] [debug] AMX backtrace: [20:23:48] [debug] #0 000b8c30 in public OnPlayerExitVehicle (0x00000000, 0x0000000e) from roleplay.amx [20:23:50] [debug] Run time error 4: "Array index out of bounds" [20:23:50] [debug] Accessing element at negative index -1 [20:23:50] [debug] AMX backtrace: [20:23:50] [debug] #0 000b8c30 in public OnPlayerExitVehicle (0x00000001, 0x0000000e) from roleplay.amx [20:25:39] [debug] Run time error 4: "Array index out of bounds" [20:25:39] [debug] Accessing element at negative index -1 [20:25:39] [debug] AMX backtrace: [20:25:39] [debug] #0 000b8c30 in public OnPlayerExitVehicle (0x00000000, 0x0000000e) from roleplay.amx [20:25:43] [debug] Run time error 4: "Array index out of bounds" [20:25:43] [debug] Accessing element at negative index -1 [20:25:43] [debug] AMX backtrace: [20:25:43] [debug] #0 000b8c30 in public OnPlayerExitVehicle (0x00000001, 0x0000000e) from roleplay.amx [20:25:43] [debug] Run time error 4: "Array index out of bounds" [20:25:43] [debug] Accessing element at negative index -1 [20:25:43] [debug] AMX backtrace:
PHP Code:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if (IsPlayerNPC(playerid))
return 1;
if (PlayerData[playerid][pTaxiDuty])
{
foreach (new i : Player) if (PlayerData[i][pTaxiPlayer] == playerid && IsPlayerInVehicle(i, GetPlayerVehicleID(playerid))) {
LeaveTaxi(i, playerid);
}
SetPlayerColor(playerid, DEFAULT_COLOR);
PlayerData[playerid][pTaxiDuty] = false;
SendServerMessage(playerid, "You are no longer on taxi duty!");
}
if (PlayerData[playerid][pDrivingTest])
{
SetTimerEx("PutInsideVehicle", 500, false, "dd", playerid, vehicleid);
Dialog_Show(playerid, LeaveTest, DIALOG_STYLE_MSGBOX, "Confirm Test Leave", "Warning: Are you sure you want to exit the driving test?", "Yes", "No");
}
if (PlayerData[playerid][pJob] == JOB_UNLOADER && GetVehicleModel(vehicleid) == 530)
{
CoreVehicles[vehicleid][vehLoadType] = 0;
DestroyObject(CoreVehicles[vehicleid][vehCrate]);
CoreVehicles[vehicleid][vehCrate] = INVALID_OBJECT_ID;
DisablePlayerCheckpoint(playerid);
}
new Float:x, Float:y, Float:z, Float:a;
new carid = Car_Nearest(playerid);
new id = Car_GetID(vehicleid);
new Float:vHealth;
new veh;
veh = GetPlayerVehicleID(playerid);
GetVehicleHealth(veh, vHealth);
GetVehiclePos(vehicleid,x,y,z);
GetVehicleZAngle(vehicleid,a);
CarData[carid][carPos][0] = x;
CarData[carid][carPos][1] = y;
CarData[carid][carPos][2] = z;
CarData[carid][carPos][3] = a;
CarData[carid][carHealth] = vHealth;
Car_Save(id);
SQL_SaveCharacter(playerid);
return 1;
}