SA-MP Forums Archive
Dialog didnt responding - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dialog didnt responding (/showthread.php?tid=580885)



Dialog didnt responding - PowerF - 09.07.2015

Код:
	new string[128];
	if (dialogid == BUY_VEHICLE)
	{
	    if (!response)
	    {
			TogglePlayerControllable(playerid, 1);
			return RemovePlayerFromVehicle(playerid);
		}
		else
		{
			if (!IsPlayerInAnyVehicle(playerid))
			{
			    SendClientMessage(playerid, GREY, "You are not in a vehicle.");
			    TogglePlayerControllable(playerid, 1);
				return RemovePlayerFromVehicle(playerid);
			}
			if (!DealershipVehicles[GetPlayerVehicleID(playerid)][vForSale])
			{
			    SendClientMessage(playerid, GREY, "You are not in any vehicle that's for sale.");
			    TogglePlayerControllable(playerid, 1);
				return RemovePlayerFromVehicle(playerid);
			}
			if (playerData[playerid][playerMoney] < DealershipVehicles[GetPlayerVehicleID(playerid)][vPrice])
			{
			    SendClientMessage(playerid, GREY, "You cannot afford the vehicle.");
			    TogglePlayerControllable(playerid, 1);
				return RemovePlayerFromVehicle(playerid);
			}

			new
			    iModel = DealershipVehicles[GetPlayerVehicleID(playerid)][vModel],
			    Float:fAngle = DealershipVehicles[GetPlayerVehicleID(playerid)][vRot],
				Float:fX = DealershipVehicles[GetPlayerVehicleID(playerid)][vX],
				Float:fY = DealershipVehicles[GetPlayerVehicleID(playerid)][vY],
				Float:fZ = DealershipVehicles[GetPlayerVehicleID(playerid)][vZ];

            switch (iModel)
			{
				case 460, 464, 476, 511, 512, 513, 519, 520, 553, 577, 592, 593, 430, 446, 452, 453,
			 	454, 472, 473, 484, 493, 595, 417, 425, 447, 465, 469, 487, 488, 497, 501, 548, 563:
				{
                    fX = (fX + (24.0 * floatsin(-fAngle, degrees)));
					fY = (fY + (24.0 * floatcos(fAngle, degrees)));
				}
				default:
				{
                    fX = (fX + (6.0 * floatsin(-fAngle, degrees)));
					fY = (fY + (6.0 * floatcos(fAngle, degrees)));
				}
			}
			switch (CreatePlayerVehicle(playerid, iModel, fX, fY, fZ, fAngle))
			{
			    case -1:
			    {
	                SendClientMessage(playerid, GREY, "The vehicle could not be purchased.");
			    	TogglePlayerControllable(playerid, 1);
					return RemovePlayerFromVehicle(playerid);
				}
			    case 0:
			    {
			        SendClientMessage(playerid, GREY, "You already own the maximum amount of vehicles.");
				    TogglePlayerControllable(playerid, 1);
					return RemovePlayerFromVehicle(playerid);
				}
				case 1:
				{
					playerGiveMoney(playerid, -DealershipVehicles[GetPlayerVehicleID(playerid)][vPrice]);
					format(string, sizeof(string), "You have purchased a %s for $%d, for more help regarding your purchase, type /carhelp.", GetVehicleName(GetPlayerVehicleID(playerid)), DealershipVehicles[GetPlayerVehicleID(playerid)][vPrice]);
					SendClientMessage(playerid, YELLOW, string);
					RemovePlayerFromVehicle(playerid);
					TogglePlayerControllable(playerid, 1);
					return 1;
				}
			}
		}
	}
	if (dialogid == MY_CARS && response)
	{
	    for (new i = 1; i < MAX_PLAYER_CARS + 1; i += 1)
	    {
			if (VehicleListitem[playerid][i] == listitem)
			{
			    if (!PlayerVehicles[playerid][i][pCarOwned]) return SendClientMessage(playerid, GREY, "An error has occurred.");
				PlayerVehicles[playerid][i][pCarSpawned] = !PlayerVehicles[playerid][i][pCarSpawned];
				switch (PlayerVehicles[playerid][i][pCarSpawned])
				{
			        case 0:
					{
					    UnlockVehicle(PlayerVehicles[playerid][i][pCarID]);
					    DestroyVehicle(PlayerVehicles[playerid][i][pCarID]);
					    PlayerVehicles[playerid][i][pCarID] = 0;
					    format(string, sizeof(string), "You have despawned your %s in slot #%d.", GetVehicleNameByModel(PlayerVehicles[playerid][i][pCarModel]), i);
					    SendClientMessage(playerid, WHITE, string);
					}
					case 1:
					{
					    PlayerVehicles[playerid][i][pCarID] = CreateVehicle(PlayerVehicles[playerid][i][pCarModel], PlayerVehicles[playerid][i][pCarX], PlayerVehicles[playerid][i][pCarY], PlayerVehicles[playerid][i][pCarZ], PlayerVehicles[playerid][i][pCarRot], PlayerVehicles[playerid][i][pCarColor1], PlayerVehicles[playerid][i][pCarColor2], -1);
					    ModifyVehicle(playerid, i);
					    format(string, sizeof(string), "You have spawned your %s in slot #%d.", GetVehicleNameByModel(PlayerVehicles[playerid][i][pCarModel]), i);
					    SendClientMessage(playerid, WHITE, string);
					}
				}
				VehicleListitem[playerid][i] = -1;
				return 1;
			}
	    }
	}
	if (dialogid == DELETE_VEHICLE && response)
	{
	    for (new i = 1; i < MAX_PLAYER_CARS + 1; i += 1)
	    {
			if (VehicleListitem[playerid][i] == listitem)
			{
			    if (!PlayerVehicles[playerid][i][pCarOwned]) return SendClientMessage(playerid, GREY, "An error has occurred.");
				new iModel = PlayerVehicles[playerid][i][pCarModel];
				if (DeletePlayerVehicle(playerid, i))
				{
					format(string, sizeof(string), "You have deleted your %s in slot #%d.", GetVehicleNameByModel(iModel), i);
				    SendClientMessage(playerid, WHITE, string);
				}
				VehicleListitem[playerid][i] = -1;
				return 1;
			}
	    }
	}
	if (dialogid == UPGRADE_VEH && response)
	{
	    for (new i = 1; i < MAX_PLAYER_CARS + 1; i += 1)
	    {
			if (VehicleListitem[playerid][i] == listitem)
			{
			    if (!PlayerVehicles[playerid][i][pCarOwned]) return SendClientMessage(playerid, GREY, "An error has occurred.");
				SetPVarInt(playerid, "UpgradingVehicle", i);
				ShowPlayerDialog(playerid, 13, DIALOG_STYLE_LIST, "Vehicle Upgrades", "Vehicle Lock ("#LOCK_PRICE")", "Upgrade", "Cancel");
				VehicleListitem[playerid][i] = -1;
				return 1;
			}
	    }
	}
	if (dialogid == UPGRADE_VEH2)
	{
	    if (response)
	    {
			new slot = GetPVarInt(playerid, "UpgradingVehicle");
			if (!slot)
			    return SendClientMessage(playerid, GREY, "You must select a vehicle first.");

			if (!PlayerVehicles[playerid][slot][pCarOwned]) return SendClientMessage(playerid, GREY, "An error has occurred."), DeletePVar(playerid, "UpgradingVehicle");
			if (PlayerVehicles[playerid][slot][pCarHasLock]) return SendClientMessage(playerid, GREY, "This vehicle already has a lock installed."), DeletePVar(playerid, "UpgradingVehicle");

			if (playerData[playerid][playerMoney] >= LOCK_PRICE)
			{
			    playerGiveMoney(playerid, -LOCK_PRICE);
				PlayerVehicles[playerid][slot][pCarHasLock] = 1;
				SendClientMessage(playerid, YELLOW, "You have purchased a lock for your vehicle. This costed you $"#LOCK_PRICE".");
				SendClientMessage(playerid, WHITE, "HINT: Type /lock to lock or unlock your vehicle.");
				DeletePVar(playerid, "UpgradingVehicle");
				return 1;
			}
			else
			{
			    SendClientMessage(playerid, GREY, "You cannot afford the lock.");
			    DeletePVar(playerid, "UpgradingVehicle");
		    }
		}
		else return DeletePVar(playerid, "UpgradingVehicle");
	}
	return 1;
}
after i press 'Yes' Button it didnt respond it
im sure the dialog id is not used by other dialogs


Re: Dialog didnt responding - PowerF - 09.07.2015

someone pls?


Re: Dialog didnt responding - KingServerIRAN - 09.07.2015

Please show your dialog function


Re: Dialog didnt responding - PowerF - 09.07.2015

Quote:
Originally Posted by KingServerIRAN
Посмотреть сообщение
Please show your dialog function
what do you mean?


Re: Dialog didnt responding - PowerF - 09.07.2015

help me please


Re : Dialog didnt responding - JizzyE - 09.07.2015

Show us the ShowPlayerDialog function


Re: Re : Dialog didnt responding - PowerF - 09.07.2015

Quote:
Originally Posted by JizzyE
Посмотреть сообщение
Show us the ShowPlayerDialog function
it was from a_samp itself..


Re: Dialog didnt responding - PowerF - 09.07.2015

Help me please..