20.08.2014, 18:08
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 < MAX_FAMILY; f++)
{
new v = GetGangVehicle(f, closestcar);
if(v != -1)
{
new str2[128];
format(str2, sizeof(str2), "Vehicle registration: %d | Name: %s | Owner: %s.",closestcar,GetVehicleFriendlyName(FamilyVehicleInfo[f][v][fvId]),FamilyInfo[family][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 Код:
[16:02:48] [cmd] [Vishwa] /vcheck
[16:02:48] [debug] Run time error 4: "Array index out of bounds"
[16:02:48] [debug] Accessing element at index 3 past array upper bound 2
[16:02:48] [debug] AMX backtrace:
[16:02:48] [debug] #0 002bf0b4 in ?? (0x00000000, 0x0000018b) from Gvlock.amx
[16:02:48] [debug] #1 002bea10 in public cmd_vcheck (0x00000000, 0x00c23734) from Gvlock.amx
[16:02:48] [debug] #2 native CallLocalFunction () [00472e50] from RP.exe
[16:02:48] [debug] #3 0000cc68 in public OnPlayerCommandText (0x00000000, 0x00c23714) from Gvlock.amx
From this part getting problem.
pawn Код:
for(new f = 0; f < MAX_FAMILY; f++)
{
new v = GetGangVehicle(f, closestcar);
if(v != -1)
{
new str2[128];
format(str2, sizeof(str2), "Vehicle registration: %d | Name: %s | Owner: %s.",closestcar,GetVehicleFriendlyName(FamilyVehicleInfo[f][v][fvId]),FamilyInfo[family][FamilyLeader]);
SendClientMessage(playerid, COLOR_WHITE, str2);
return 1;
}
}
SendClientMessage(playerid, COLOR_GRAD2, "This vehicle is not owned by anyone!");
}
}
}

