I got a problem, once I stored the vehicle in storage, I can't respawn it anymore.
Код:
if(dialogid == VEHICLESTORAGE)
{
if(response == 1)
{
if(PlayerVehicleInfo[playerid][listitem][pvSpawned] == 0)
{
new
Float: vehiclehealth;
GetVehicleHealth(PlayerVehicleInfo[playerid][listitem][pvId], vehiclehealth);
if(vehiclehealth < 750)
{
SendClientMessage(playerid, COLOR_WHITE, "This vehicle is too damaged to be stored.");
}
else {
--PlayerCars;
VehicleSpawned[playerid]--;
PlayerVehicleInfo[playerid][listitem][pvSpawned] = 1;
DestroyVehicle(PlayerVehicleInfo[playerid][listitem][pvId]);
PlayerVehicleInfo[playerid][listitem][pvId] = INVALID_PLAYER_VEHICLE_ID;
new vstring[128];
format(vstring, sizeof(vstring), "You have stored your %s. The vehicle has been despawned.", VehicleName[PlayerVehicleInfo[playerid][listitem][pvModelId] - 400]);
SendClientMessage(playerid, COLOR_WHITE, vstring);
}
}
}
else if(PlayerVehicleInfo[playerid][listitem][pvModelId] == 0) {
SendClientMessage(playerid, COLOR_WHITE, "You can't spawn an non-existant vehicle.");
}
else if(PlayerVehicleInfo[playerid][listitem][pvImpounded]) {
SendClientMessage(playerid, COLOR_WHITE, "You can't spawn an impounded vehicle. If you wish to reclaim it, do so at the DMV in Dillimore.");
}
else if(PlayerVehicleInfo[playerid][listitem][pvDisabled] == 1) {
SendClientMessage(playerid, COLOR_WHITE, "You can't spawn a disabled vehicle. It is disabled due to your Donator level (vehicle restrictions).");
}
else if(PlayerVehicleInfo[playerid][listitem][pvSpawned] == 1) {
if(PlayerInfo[playerid][pDonator] == 0 && VehicleSpawned[playerid] >= 3) {
SendClientMessage(playerid, COLOR_GREY, "As non-VIP you can only have 3 vehicle spawned. You must store a vehicle in order to spawn another one.");
}
else if(PlayerInfo[playerid][pDonator] == 1 && VehicleSpawned[playerid] >= 4) {
SendClientMessage(playerid, COLOR_GREY, "As Bronze VIP you can only have 4 vehicles spawned. You must store a vehicle in order to spawn another one.");
}
else if(PlayerInfo[playerid][pDonator] == 2 && VehicleSpawned[playerid] >= 5) {
SendClientMessage(playerid, COLOR_GREY, "As Silver VIP you can only have 5 vehicles spawned. You must store a vehicle in order to spawn another one.");
}
else if(PlayerInfo[playerid][pDonator] == 3 && VehicleSpawned[playerid] >= 6) {
SendClientMessage(playerid, COLOR_GREY, "As Gold VIP you can only have 6 vehicles spawned. You must store a vehicle in order to spawn another one.");
}
else if(PlayerInfo[playerid][pDonator] == 4 && VehicleSpawned[playerid] >= 10) {
SendClientMessage(playerid, COLOR_GREY, "As Platinum VIP you can only have 10 vehicles spawned. You must store a vehicle in order to spawn another one.");
}
else if(PlayerInfo[playerid][pDonator] == 5 && VehicleSpawned[playerid] >= 10){
SendClientMessage(playerid, COLOR_GREY, "As VIP Moderator you can only have 10 vehicles spawned. You must store a vehicle in order to spawn another one.");
}
else if(!(0 <= PlayerInfo[playerid][pDonator] <= 6)) {
SendClientMessage(playerid, COLOR_GREY, "You have an invalid VIP level.");
}
else {
++PlayerCars;
VehicleSpawned[playerid]++;
PlayerVehicleInfo[playerid][listitem][pvSpawned] = 0;
PlayerVehicleInfo[playerid][listitem][pvId] = CreateVehicle(PlayerVehicleInfo[playerid][listitem][pvModelId], PlayerVehicleInfo[playerid][listitem][pvPosX], PlayerVehicleInfo[playerid][listitem][pvPosY], PlayerVehicleInfo[playerid][listitem][pvPosZ], PlayerVehicleInfo[playerid][listitem][pvPosAngle],PlayerVehicleInfo[playerid][listitem][pvColor1], PlayerVehicleInfo[playerid][listitem][pvColor2], -1);
//VehicleFuel[PlayerVehicleInfo[playerid][listitem][pvId]] = PlayerVehicleInfo[playerid][listitem][pvFuel];
if(PlayerVehicleInfo[playerid][listitem][pvLocked] == 1) LockPlayerVehicle(playerid, PlayerVehicleInfo[playerid][listitem][pvId], PlayerVehicleInfo[playerid][listitem][pvLock]);
LoadPlayerVehicleMods(playerid, listitem);
new vstring[128];
format(vstring, sizeof(vstring), "You have taken your %s out of storage. The vehicle has been spawned at the last parking location.", VehicleName[PlayerVehicleInfo[playerid][listitem][pvModelId] - 400]);
SendClientMessage(playerid, COLOR_WHITE, vstring);
}
}
else SendClientMessage(playerid, COLOR_WHITE, "You can't spawn a non-existent vehicle.");
}
Код:
CMD:vstorage(playerid, params[])
{
new vstring[1024];
for(new i, iModelID; i < MAX_PLAYERVEHICLES; 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] != 0) {
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");
}
ShowPlayerDialog(playerid, VEHICLESTORAGE, DIALOG_STYLE_LIST, "Vehicle storage", vstring, "(De)spawn", "Cancel");
return 1;
}