30.10.2017, 22:50
(
Последний раз редактировалось Konstantinos; 31.10.2017 в 08:51.
Причина: Was in a hurry, must verify it's not null and it's numeric
)
So if the cop input the ID, it will unimpound the vehicle, otherwise it will just show the dialog for either cop or player?
pawn Код:
else if (!strcmp(tmp, "unimpound", true, 7))
{
if (strlen(tmp2) && IsNumeric(tmp2) && PlayerInfo[playerid][playerteam] == FAC_TYPE_POLICE && PlayerInfo[playerid][ranklvl] <= 2)
{
new theunimpoundid = strval(tmp2);
if (!dini_Isset(globalstats, "unimpoundslot"))
dini_IntSet(globalstats, "unimpoundslot", 0);
new ri = dini_Int(globalstats, "unimpoundslot");
if (ri >= sizeof(unimpoundpos))
{
ri = 0;
dini_IntSet(globalstats, "unimpoundslot", 0);
}
else dini_IntSet(globalstats, "unimpoundslot", ri + 1);
VehicleInfo[theunimpoundid][vX] = unimpoundpos[ri][spawnx];
VehicleInfo[theunimpoundid][vY] = unimpoundpos[ri][spawny];
VehicleInfo[theunimpoundid][vZ] = unimpoundpos[ri][spawnz];
VehicleInfo[theunimpoundid][vA] = unimpoundpos[ri][sangle];
VehicleInfo[theunimpoundid][vVirtualWorld] = 0;
VehicleInfo[theunimpoundid][vImpounded] = 0;
VehicleInfo[theunimpoundid][vImpoundFee] = 0;
myStrcpy(VehicleInfo[theunimpoundid][vImpoundReason], "None");
ReloadVehicle(theunimpoundid);
printf("%d", theunimpoundid);
return 1;
}
new iBigStr[1575], iCount, iSmllStr[128];
strcat(iBigStr, "Vehicle\tImpound fee\tImpound Reason\n");
VehicleLoop(v)
{
if (VehicleInfo[v][vActive] != true) continue;
if (strcmp(PlayerName(playerid), VehicleInfo[v][vOwner], false)) continue;
if (VehicleInfo[v][vImpounded] != 1) continue;
if (VehicleInfo[v][vImpounded] == 1 && VehicleInfo[v][vSpawned] != true)
{
iCount++;
format(iSmllStr, sizeof(iSmllStr), "%d %s(%d)\t%d\t%s\n", v, GetVehicleNameFromModel(VehicleInfo[v][vModel]), VehicleInfo[v][rID], VehicleInfo[v][vImpoundFee], VehicleInfo[v][vImpoundReason]);
}
strcat(iBigStr, iSmllStr);
ShowPlayerDialog(playerid, DIALOG_UNIMPOUND, DIALOG_STYLE_TABLIST_HEADERS, "{3196ef}Please select vehicle you would like to unimpound", iBigStr, "Select", "Exit");
}
if (!iCount) SendClientError(playerid, "You don't have any impounded vehicle");
return 1;
}