10.10.2015, 07:57
Hey,
I have a problem with the Vehicle Storage in my server, When I register to my server the vehicle storage is full with cars that I didn't buy, How can I remove it?
Codes:
I have a problem with the Vehicle Storage in my server, When I register to my server the vehicle storage is full with cars that I didn't buy, How can I remove it?
Codes:
PHP код:
CMD:vstorage(playerid, params[])
{
if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0 || PlayerInfo[playerid][pJailTime] > 0 || GetPVarInt(playerid, "Injured")) return SendClientMessageEx(playerid, COLOR_GRAD2, "You cannot do this at this time.");
if(PlayerInfo[playerid][pFreezeCar] == 0 || PlayerInfo[playerid][pAdmin] >= 2)
{
new vstring[4096], icount = GetPlayerVehicleSlots(playerid);
for(new i, iModelID; i < icount; i++) {
if((iModelID = PlayerVehicleInfo[playerid][i][pvModelId] - 400) >= 0) {
if(PlayerVehicleInfo[playerid][i][pvImpounded]) {
format(vstring, sizeof(vstring), "%s\n%s (impounded)", vstring, VehicleName[iModelID]);
}
else if(PlayerVehicleInfo[playerid][i][pvDisabled]) {
format(vstring, sizeof(vstring), "%s\n%s (disabled)", vstring, VehicleName[iModelID]);
}
else if(!PlayerVehicleInfo[playerid][i][pvSpawned]) {
format(vstring, sizeof(vstring), "%s\n%s (stored)", vstring, VehicleName[iModelID]);
}
else format(vstring, sizeof(vstring), "%s\n%s (spawned)", vstring, VehicleName[iModelID]);
}
else strcat(vstring, "\nEmpty");
}
format(vstring, sizeof(vstring), "%s\n{40FFFF}Additional Vehicle Slot {FFD700}(Credits: %s){A9C4E4}", vstring, number_format(ShopItems[23][sItemPrice]));
ShowPlayerDialog(playerid, VEHICLESTORAGE, DIALOG_STYLE_LIST, "Vehicle storage", vstring, "(De)spawn", "Cancel");
}
else { return SendClientMessageEx(playerid, COLOR_GRAD2, "Your vehicle assets have been frozen by the Judiciary. Consult your local courthouse to have this cleared"); }
return 1;
}
PHP код:
if(dialogid == VEHICLESTORAGE && response) {
//if(!(400 <= PlayerVehicleInfo[playerid][listitem][pvModelId] <= 611))
//printf("DEBUG: listitem: %d, Vehicle Slots: %d", listitem, GetPlayerVehicleSlots(playerid));
if(listitem == GetPlayerVehicleSlots(playerid)) {
new szstring[128];
SetPVarInt(playerid, "MiscShop", 7);
format(szstring, sizeof(szstring), "Additional Vehicle Slot\nYour Credits: %s\nCost: {FFD700}%s{A9C4E4}\nCredits Left: %s", number_format(PlayerInfo[playerid][pCredits]), number_format(ShopItems[23][sItemPrice]), number_format(PlayerInfo[playerid][pCredits]-ShopItems[23][sItemPrice]));
return ShowPlayerDialog(playerid, DIALOG_MISCSHOP2, DIALOG_STYLE_MSGBOX, "Purchase a additional vehicle slot", szstring, "Purchase", "Cancel");
}
if(PlayerVehicleInfo[playerid][listitem][pvSpawned]) {
new
iVehicleID = PlayerVehicleInfo[playerid][listitem][pvId];
if((!IsVehicleOccupied(iVehicleID) || IsPlayerInVehicle(playerid, iVehicleID)) && !IsVehicleInTow(iVehicleID)) {
new
Float: vehiclehealth;
GetVehicleHealth(iVehicleID, vehiclehealth);
if(vehiclehealth < 800) {
SendClientMessageEx(playerid, COLOR_WHITE, "This vehicle is too damaged to be stored.");
}
else if (GetPVarInt(playerid, "Refueling") == PlayerVehicleInfo[playerid][listitem][pvId])
SendClientMessageEx(playerid, COLOR_WHITE, "You can not store a vehicle while it is being refueled.");
else {
--PlayerCars;
VehicleSpawned[playerid]--;
PlayerVehicleInfo[playerid][listitem][pvSpawned] = 0;
PlayerVehicleInfo[playerid][listitem][pvFuel] = VehicleFuel[iVehicleID];
DestroyVehicle(iVehicleID);
PlayerVehicleInfo[playerid][listitem][pvId] = INVALID_PLAYER_VEHICLE_ID;
g_mysql_SaveVehicle(playerid, listitem);
new vstring[128];
format(vstring, sizeof(vstring), "You have stored your %s. The vehicle has been despawned.", VehicleName[PlayerVehicleInfo[playerid][listitem][pvModelId] - 400]);
SendClientMessageEx(playerid, COLOR_WHITE, vstring);
CheckPlayerVehiclesForDesync(playerid);
}
}
else SendClientMessageEx(playerid, COLOR_WHITE, "This vehicle is currently occupied - it cannot be despawned right now.");
}
else if(PlayerVehicleInfo[playerid][listitem][pvImpounded]) {
SendClientMessageEx(playerid, COLOR_WHITE, "You can not spawn an impounded vehicle. If you wish to reclaim it, do so at the DMV in Dillimore.");
}
else if(PlayerVehicleInfo[playerid][listitem][pvDisabled]) {
SendClientMessageEx(playerid, COLOR_WHITE, "You can not spawn a disabled vehicle. It is disabled due to your VIP level (vehicle restrictions).");
}
else if((PlayerInfo[playerid][pRVehRestricted] > gettime() || PlayerVehicleInfo[playerid][listitem][pvRestricted] > gettime()) && IsRestrictedVehicle(PlayerVehicleInfo[playerid][listitem][pvModelId]))
{
SendClientMessageEx(playerid, COLOR_GREY, "You are not authorized to spawn this restricted vehicle.");
}
else if(!PlayerVehicleInfo[playerid][listitem][pvSpawned]) {
if(PlayerInfo[playerid][pDonateRank] == 0 && VehicleSpawned[playerid] >= 2) {
SendClientMessageEx(playerid, COLOR_GREY, "As non-VIP you can only have 2 vehicles spawned. You must store a vehicle in order to spawn another one.");
}
else if(PlayerInfo[playerid][pDonateRank] == 1 && VehicleSpawned[playerid] >= 2) {
SendClientMessageEx(playerid, COLOR_GREY, "As Bronze VIP you can only have 2 vehicles spawned. You must store a vehicle in order to spawn another one.");
}
else if(PlayerInfo[playerid][pDonateRank] == 2 && VehicleSpawned[playerid] >= 2) {
SendClientMessageEx(playerid, COLOR_GREY, "As Silver VIP you can only have 2 vehicles spawned. You must store a vehicle in order to spawn another one.");
}
else if(PlayerInfo[playerid][pDonateRank] == 3 && VehicleSpawned[playerid] >= 3) {
SendClientMessageEx(playerid, COLOR_GREY, "As Gold VIP you can only have 3 vehicles spawned. You must store a vehicle in order to spawn another one.");
}
else if(PlayerInfo[playerid][pDonateRank] == 4 && VehicleSpawned[playerid] >= 5) {
SendClientMessageEx(playerid, COLOR_GREY, "As Platinum VIP you can only have 5 vehicles spawned. You must store a vehicle in order to spawn another one.");
}
else if(PlayerInfo[playerid][pDonateRank] == 5 && VehicleSpawned[playerid] >= 5) {
SendClientMessageEx(playerid, COLOR_GREY, "As Diamond VIP you can only have 5 vehicles spawned. You must store a vehicle in order to spawn another one.");
}
else if(!(0 <= PlayerInfo[playerid][pDonateRank] <= 5)) {
SendClientMessageEx(playerid, COLOR_GREY, "You have an invalid VIP level.");
}
else if((PlayerVehicleInfo[playerid][listitem][pvModelId]) < 400) {
SendClientMessageEx(playerid, COLOR_GREY, "The vehicle slot is empty.");
}
else {