13.06.2016, 02:51
(
Последний раз редактировалось Dokins; 13.06.2016 в 03:43.
)
After deleting (it seems to be an owned vehicle) the command /myvehicles stops working, is there anyway to combat this?
Basically after using /deleteveh any vehicles with an ID above that ID won't display in my vehicles I'm not sure what the cause is of this
I've tried fixing it several ways.
Basically after using /deleteveh any vehicles with an ID above that ID won't display in my vehicles I'm not sure what the cause is of this
I've tried fixing it several ways.
pawn Код:
CMD:deleteveh(playerid, params[])
{
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
if(AdminLevel[playerid] < 2) return SendClientMessage(playerid, COLOUR_GREY, "You are not authorized to use this command.");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOUR_GREY, "You must be in a vehicle.");
new vehicleid = GetPlayerVehicleID(playerid);
new string[128];
if(VehicleSQLID[vehicleid] > 0)
{
new query[700];
format(query, sizeof(query), "UPDATE `vehicles` SET Inactive = 1, VehModel = 0, VehJob = -1,VehOwner = 0, VehColour1 = 0, VehColour2 = 0, VehPlate = '0', VehSpawnX = 0, VehSpawnY = 0, VehSpawnZ = 0, VehSpawnAngle = 0, VehFuel = 0, VehCash = 0, VehArmour = 0,VehFaction = 0,VehFRank = 0, VehOwned = 0, VehFactioned = 0, VehWeed = 0, VehCoke = 0, VehBizID = 0, VehForSale = 0, VehPrice = 0, VehPCP = 0, VehLSD = 0, VehSteroids = 0, VehHeroin = 0, VehDealership = 0 WHERE `id` = %d LIMIT 1",
VehicleSQLID[vehicleid]);
mysql_tquery(dbHandle, query, "DeletedVeh", "ii", playerid, vehicleid);
}
if(VehicleSQLID[vehicleid] < 1)
{
SendClientMessage(playerid, COLOUR_GREY, "No rows affected.");
format(string, sizeof(string), "Admin Vehicle {FF0000}Deleted.");
SendClientMessage(playerid, COLOUR_WHITE, string);
DestroyVehicle(vehicleid);
strdel(VehPlate[vehicleid], 0, 32);
DestroyDynamic3DTextLabel(VehicleLabel[vehicleid]);
}
return 1;
}
forward DeletedVeh(playerid, vehicleid);
public DeletedVeh(playerid, vehicleid)
{
new rows = cache_affected_rows(), string[128];
if(rows)
{
format(string, sizeof(string), "{FF0000}Vehicle Deleted.");
SendClientMessage(playerid, COLOUR_WHITE, string);
format(string, sizeof(string), "Vehicle Server ID: {FF0000}%d.", vehicleid);
SendClientMessage(playerid, COLOUR_WHITE, string);
format(string,sizeof(string), "Vehicle MySQL ID: {FF0000}%d.", VehicleSQLID[vehicleid]);
SendClientMessage(playerid, COLOUR_WHITE, string);
format(string, sizeof(string), "Next Free SQLID: {FF0000}%d.", GetFreeMySQLSlot("vehicles"));
SendClientMessage(playerid, COLOUR_WHITE, string);
DestroyVehicle(vehicleid);
DestroyDynamic3DTextLabel(VehicleLabel[vehicleid]);
VehicleSQLID[vehicleid] = 0;
VehOwner[vehicleid] = 0;
}
return 1;
}
pawn Код:
CMD:myvehicles(playerid, params[])//NEEDS REWRITE
{
new string[700],vehicle[128], name1, am = 0;
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command."), true;
for(new v = 1; v < GetVehiclePoolSize()+1; v++) //incorrect because it's the SQLID and not the server ID.
{
if(VehOwner[v] == PlayerSQLID[playerid])
{
am ++;
printf("Vehid %d, PSQL %d, VehSQL %d", v, PlayerSQLID[playerid], VehicleSQLID[v]);
name1 = GetVehicleModel(v) - 400;
if(VehExported[v] == 0)
{
format(vehicle, sizeof(vehicle), "{FFFFFF}%s - {FFFFFF}ID({33AA33}%d{FFFFFF}) - Plate: {33AA33}%s\n", VehicleNames[name1], v, VehPlate[v]);
strcat(string, vehicle);
}
if(VehExported[v] == 1)
{
format(vehicle, sizeof(vehicle), "{FFFFFF}%s - {FFFFFF}ID({33AA33}%d{FFFFFF}) - Plate: {33AA33}%s - NEEDS RECOVERY (/recoverveh)\n",VehicleNames[name1], v, VehPlate[v]);
strcat(string, vehicle);
}
}
}
if(am < 1) return SendClientMessage(playerid, COLOUR_GREY, "You do not own any vehicles"), true;
ShowPlayerDialog(playerid,DIALOG_SHOWCAR,DIALOG_STYLE_MSGBOX,"My Vehicles", string,"Close","");
return 1;
}