20.05.2014, 22:26
pawn Code:
COMMAND:takecar(playerid, params[])
{
new Lrg[1800], count, statusaa[20], IsAtGarage = 0, takecarr[250];
GarageLoop(g)
{
if(PublicGarage[g][gActive] == 0) continue;
if(IsPlayerInRangeOfPoint(playerid, 2.0, PublicGarage[g][garageX],PublicGarage[g][garageY],PublicGarage[g][garageZ]))
{
new zone[50];
IsAtGarage = 1;
GetZone(PublicGarage[g][garageX],PublicGarage[g][garageY],PublicGarage[g][garageZ], zone);
format(takecarr, sizeof(takecarr), "{D3D3D3}Take a vehicle from {778899}%s {D3D3D3}Garage", zone);
}
}
if(IsAtGarage == 0) return SendClientError(playerid, "You need to be outside a public garage to use this command");
VehLoop(v)
{
if(Vehicle[v][vActive] == 0) continue;
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if(!strcmp(Vehicle[v][owner], PlayerName(playerid), false))
{
count++;
if(Vehicle[v][InGarage] == 1) format(statusaa, sizeof(statusaa), "{B0C4DE}Stored");
else format(statusaa, sizeof(statusaa), "{ff0000}Spawned");
format(LrgStr, sizeof(LrgStr), "{778899}Vehicle: {B0C4DE}%s {ffffff}>> {778899}Status: %s\n", GetVehicleNameFromModel(Vehicle[v][model]), statusaa);
strcat(Lrg, LrgStr);
}
}
if(count <= 0) return SendClientError(playerid, "You currently do not own any vehicles");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, takecarr, Lrg, "Take", "Cancel");
return 1;
}
Code:
[23:41:24] [debug] Run time error 4: "Array index out of bounds" [23:41:24] [debug] Accessing element at negative index -400 [23:41:24] [debug] AMX backtrace: [23:41:24] [debug] #0 000078e8 in GetVehicleNameFromModel (modelid=0) at C:\Users\Brandon\Desktop\programming\Sicilian Mafia Roleplay\gamemodes\sicilian.pwn:1008 [23:41:24] [debug] #1 0002b5a8 in public cmd_takecar (playerid=0, params[]=@0x0015368c "") at C:\Users\Brandon\Desktop\programming\Sicilian Mafia Roleplay\gamemodes\sicilian.pwn:3931 [23:41:24] [debug] #2 native CallLocalFunction () [00472ef0] from samp-server.exe [23:41:24] [debug] #3 000006f4 in public OnPlayerCommandText (playerid=0, cmdtext[]=@0x00153668 "/takeca") at C:\Users\Brandon\Desktop\programming\Sicilian Mafia Roleplay\pawno\include\zcmd.inc:89