code removed, I don't want to release it :P
[08:26:28] [debug] AMX backtrace: [08:26:28] [debug] #0 001e7860 in public cmd_engine (playerid=0, params[]=@006ef004 "") at C:\Users\User\Documents\Desktop\Los Santos Life Roleplay\gamemodes\LSLRP.pwn:28644 [08:26:28] [debug] #1 native CallLocalFunction () from samp03svr [08:26:28] [debug] #2 0001dfc0 in public OnPlayerCommandText (playerid=0, cmdtext[]=@006eefe4 "/engine") at C:\Users\User\Documents\Desktop\Los Santos Life Roleplay\pawno\include\zcmd.inc:102
CarData[id][carFaction]
Код:
CarData[id][carFaction] |
SA-MP Dedicated Server ---------------------- v0.3.7-R2, ©2005-2015 SA-MP Team [09:00:28] filterscripts = "" (string) [09:00:28] [09:00:28] Server Plugins [09:00:28] -------------- [09:00:28] Loading plugin: crashdetect.so [09:00:28] CrashDetect v4.15.1 is OK. [09:00:28] Loaded. [09:00:28] Loading plugin: sscanf.so [09:00:28] [09:00:28] =============================== [09:00:28] sscanf plugin loaded. [09:00:28] Version: 2.8.2 [09:00:28] © 2012 Alex "******" Cole [09:00:28] =============================== [09:00:28] Loaded. [09:00:28] Loading plugin: streamer.so [09:00:28] *** Streamer Plugin v2.8.1 by Incognito loaded *** [09:00:28] Loaded. [09:00:28] Loading plugin: Whirlpool.so [09:00:28] [09:00:28] ================== [09:00:28] [09:00:28] Whirlpool loaded [09:00:28] [09:00:28] ================== [09:00:28] [09:00:28] Loaded. [09:00:28] Loading plugin: mysql.so [09:00:28] >> plugin.mysql: R39-5 successfully loaded. [09:00:28] Loaded. [09:00:28] Loading plugin: nativechecker.so [09:00:28] Loaded. [09:00:28] Loaded 6 plugins. [09:00:28] [09:00:28] Filterscripts [09:00:28] --------------- [09:00:28] Loaded 0 filterscripts. [09:00:28] [09:00:28] [09:00:28] [09:00:28] ======================================= [09:00:28] | | [09:00:28] | YSI version 3.09.0684 | [09:00:28] | By Alex "******" Cole | [09:00:28] | | [09:00:28] ======================================= [09:00:28] [09:00:28] [SQL] Connection to "127.0.0.1" passed! [09:00:28] Los Santos Life Roleplay [09:00:28] Number of vehicle models: 4 [09:02:02] [debug] Run time error 4: "Array index out of bounds" [09:02:02] [debug] Accessing element at negative index -1 [09:02:02] [debug] AMX backtrace: [09:02:02] [debug] #0 001e7860 in public cmd_engine (playerid=1, params[]=@006ef004 "") at C:\Users\User\Documents\Desktop\Los Santos Life Roleplay\gamemodes\LSLRP.pwn:28644 [09:02:02] [debug] #1 native CallLocalFunction () from samp03svr [09:02:02] [debug] #2 0001dfc0 in public OnPlayerCommandText (playerid=1, cmdtext[]=@006eefe4 "/engine") at C:\Users\User\Documents\Desktop\Los Santos Life Roleplay\pawno\include\zcmd.inc:102
if (carid != -1 && Car_IsOwner(playerid, carid) || CoreVehicles[vehicleid][vehTemporary] || (PlayerData[playerid][pFaction] != -1 && CarData[carid][carFaction] == GetFactionType(playerid)) || IsAJobVehicle(vehicleid) || PlayerData[playerid][pCarKeys] == carid) // line 28644
CoreVehicles[vehicleid][vehTemporary]
PlayerData[playerid][pFaction]
CarData[carid][carFaction]
PlayerData[playerid][pCarKeys]
CoreVehicles[vehicleid][vehTemporary]
CarData[carid][carFaction]
CarData[carid][carFaction]
CMD:engine(playerid, params[])
{
new
vehicleid = GetPlayerVehicleID(playerid),
carid,
vehiclemodel;
if (!IsPlayerInAnyVehicle(playerid))
{
SendErrorMessage(playerid, "You are not in any vehicle.");
}
if (!IsEngineVehicle(vehicleid))
{
SendErrorMessage(playerid, "This vehicle doesn't have an engine.");
}
if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
{
SendErrorMessage(playerid, "You can't do this as you're not the driver.");
}
if (PlayerData[playerid][pInjured])
{
SendErrorMessage(playerid, "You can't do this while being injured or dead.");
}
if (ReturnVehicleHealth(vehicleid) <= 300)
{
SendErrorMessage(playerid, "This vehicle is totalled and can't be started.");
}
if (CoreVehicles[vehicleid][vehFuel] < 1)
{
SendErrorMessage(playerid, "The fuel tank is empty.");
}
carid = Car_GetID(vehicleid);
if (carid != -1 && Car_IsOwner(playerid, carid) || CoreVehicles[vehicleid][vehTemporary] || (PlayerData[playerid][pFaction] != -1 && CarData[carid][carFaction] == GetFactionType(playerid)) || IsAJobVehicle(vehicleid) || PlayerData[playerid][pCarKeys] == carid) // line 28644
{
vehiclemodel = GetVehicleModel(vehicleid);
switch (GetEngineStatus(vehicleid))
{
case false:
{
SetEngineStatus(vehicleid, true);
ShowPlayerFooter(playerid, "You have ~g~started~w~ the engine!");
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s inserts the key into the ignition and starts the engine of the %s.", ReturnName(playerid, 0), ReturnVehicleModelName(vehiclemodel));
}
case true:
{
SetEngineStatus(vehicleid, false);
ShowPlayerFooter(playerid, "You have ~r~stopped~w~ the engine!");
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s inserts the key into the ignition and stops the engine of the %s.", ReturnName(playerid, 0), ReturnVehicleModelName(vehiclemodel));
}
}
}
else SendErrorMessage(playerid, "You don't have the keys to this vehicle.");
return 1;
}
So -1 is passed in an array in the command (not some function is called in the command). Let's review the code:
pawn Код:
pawn Код:
pawn Код:
pawn Код:
|
if (carid != -1)
{
print("carid != -1");
if (Car_IsOwner(playerid, carid)) printf("Car_IsOwner(%i, %i)", playerid, carid);
else if (CoreVehicles[vehicleid][vehTemporary]) printf("CoreVehicles[%i][vehTemporary]", vehicleid);
...
}