22.08.2014, 20:15
pawn Код:
CMD:vcheck(playerid, params[])
{
if(IsACop(playerid))
{
new carid = GetPlayerVehicleID(playerid);
new closestcar = GetClosestCar(playerid, carid);
if(IsPlayerInRangeOfVehicle(playerid, closestcar, 9.0))
{
foreach(Player, i)
{
new v = GetPlayerVehicle(i, closestcar);
if(v != -1)
{
new str1[72 + MAX_PLAYER_NAME];
new cid =PlayerInfo[playerid][pCar][v];
format(str1, sizeof(str1), "Vehicle registration: %d | Name: %s | Owner: %s.",closestcar,GetVehicleFriendlyName(CarInfo[cid][c_ID]),PlayerRPName(i));
SendClientMessage(playerid, COLOR_WHITE, str1);
return 1;
}
}
for(new f = 0; f < sizeof(FamilyInfo); f++)
{
new v = GetGangVehicle(f, closestcar);
if(v != -1)
{
new str2[128 + MAX_PLAYER_NAME];
format(str2, sizeof(str2), "Vehicle registration: %d | Name: %s | Owner: %s.",closestcar,GetVehicleFriendlyName(FamilyVehicleInfo[f][v][fvId]),FamilyInfo[f][FamilyLeader]);
SendClientMessage(playerid, COLOR_WHITE, str2);
return 1;
}
}
SendClientMessage(playerid, COLOR_GRAD2, "This vehicle is not owned by anyone!");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use this command.");
}
return 1;
}
pawn Код:
[13:11:18] [cmd] [Norman] /vcheck
[13:11:18] [debug] Run time error 4: "Array index out of bounds"
[13:11:18] [debug] Accessing element at index 3 past array upper bound 2
[13:11:18] [debug] AMX backtrace:
[13:11:18] [debug] #0 0021dc9c in ?? (0x00000000, 0x00000050) from Gvlock.amx
[13:11:18] [debug] #1 0021d738 in public cmd_vcheck (0x00000000, 0x00d3d3a8) from Gvlock.amx
[13:11:18] [debug] #2 native CallLocalFunction () [00472e50] from RP.exe
[13:11:18] [debug] #3 0000ab0c in public OnPlayerCommandText (0x00000000, 0x00d3d388) from Gvlock.amx