I need to make that command dialog
#4

Код:
#define DIALOG_MANAGECAR 1253 // Random number just incase you have other dialogs in your script

CMD:car(playerid, params[])
{
	if(IsPlayerInVehicle(playerid) == 0) return SendClientMessage(playerid, 0xFFFFFF, "You are not in a vehicle, son!");
	if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, 0xFFFFFF, "You are not the driver!");
	ShowPlayerDialog(playerid, DIALOG_MANAGECAR, DIALOG_STYLE_LIST, "Car Management", "Status\nEngine\nLights\nTrunk\nHood\nFuel\nWindows", "Select", "Cancel");

	return 1;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
	if(dialogid == DIALOG_MANAGECAR) {
		if(listitem == 0) { // Listitem 0 = Status, this is because in the ShowPlayerDialog, Status was the first thing on the list before the \n created a new list item
			if(!response) return 0; // This just tells the script to close the dialog if the user presses cancel
			else { // This is simply just a movement from the command to dialog itself
				new vehicleid = GetPlayerVehicleID(playerid);
				new engine,lights,alarm,doors,bonnet,boot,objective,enginestatus[4],lightstatus[4];
				GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
				if(!IsRefuelableVehicle(vehicleid)) return SendClientMessageEx(playerid,COLOR_RED,"This vehicle doesn't need fuel.");
				if(engine != VEHICLE_PARAMS_ON) strcpy(enginestatus, "OFF", 4);
				else strcpy(enginestatus, "ON", 3);
				if(lights != VEHICLE_PARAMS_ON) strcpy(lightstatus, "OFF", 4);
				else strcpy(lightstatus, "ON", 3);
				if (IsVIPcar(vehicleid) || IsAdminSpawnedVehicle(vehicleid) || IsFamedVeh(vehicleid)) format(string, sizeof(string), "Engine: %s | Lights: %s | Fuel: Unlimited | Windows: %s",enginestatus,lightstatus,(CrateVehicleLoad[GetPlayerVehicleID(playerid)][vCarWindows] == 0) ? ("Up") : ("Down"));
				else format(string, sizeof(string), "Engine: %s | Lights: %s | Fuel: %.1f percent | Windows: %s",enginestatus,lightstatus, VehicleFuel[vehicleid], (CrateVehicleLoad[GetPlayerVehicleID(playerid)][vCarWindows] == 0) ? ("Up") : ("Down"));
				SendClientMessageEx(playerid, COLOR_WHITE, string);
			}
		}
	}

	return 1;
}
This is typically what your piece of code would become, if made into dialogs. The thing is, I haven't done it all for you so you can actually learn from what I've done, even if it's the bare minimal. Do not copy and paste this in, atleast not before you understand what's been done here, else it's pointless for you to be asking for help here, you might aswell look for someone through: https://sampforum.blast.hk/showthread.php?tid=447813
Reply


Messages In This Thread
I need to make that command dialog - by TheThirdNeo - 17.02.2016, 00:52
Re: I need to make that command dialog - by Godly - 17.02.2016, 00:58
Re: I need to make that command dialog - by TheThirdNeo - 17.02.2016, 01:21
Re: I need to make that command dialog - by Riddy - 17.02.2016, 01:34

Forum Jump:


Users browsing this thread: 1 Guest(s)