Problem with VSTORAGE
#1

Hello there. I resuntly got my vstorage system working. the only problem is, when i do /vstorage and spawn my vehicle it's duplicating the vehicle. How can i make it stop?

Here is the codes.

Please help.

Код:
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]) {
				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, VSTORAGE, DIALOG_STYLE_LIST, "Vehicle storage", vstring, "(De)spawn", "Cancel");
	return 1;
}
Reply
#2

post "VSTORAGE" in OnDialogResponse ?
Reply
#3

Quote:
Originally Posted by [Full]Garfield[XDB]
Посмотреть сообщение
post "VSTORAGE" in OnDialogResponse ?
Here.

Код:
	if(dialogid == VSTORAGE && response) {
		if(PlayerVehicleInfo[playerid][listitem][pvSpawned])
		{
			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] = 0;
				DestroyVehicle(PlayerVehicleInfo[playerid][listitem][pvId]);
				VehicleRadioStation[PlayerVehicleInfo[playerid][listitem][pvId]] = 0;
				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] == 0) {
			if(PlayerInfo[playerid][pDonateRank] == 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][pDonateRank] == 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][pDonateRank] == 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][pDonateRank] == 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][pDonateRank] == 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][pDonateRank] == 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][pDonateRank] <= 6)) {
				SendClientMessage(playerid, COLOR_GREY, "You have an invalid VIP level.");
			}
			else {
				++PlayerCars;
				VehicleSpawned[playerid]++;
				PlayerVehicleInfo[playerid][listitem][pvSpawned] = 1;
				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]);

				if(strlen(PlayerVehicleInfo[playerid][listitem][pvNumberPlate]) > 0)
					SetVehicleNumberPlate(PlayerVehicleInfo[playerid][listitem][pvId], PlayerVehicleInfo[playerid][listitem][pvNumberPlate]);

				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.");
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)