Engine
#1

Hi

I want to make my engine different, so when I type /engine, the smoke stops comming.
I've got the Moderntopia scipt and I can't change it.

Here are the lines (mootor = engine):
Код:
dcmd_mootor(playerid, params[], vehicleid)
{
	#pragma unused params
	
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Sa pole autos!");
	if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "Ainult juht saab sхidukit kдivitada!");
	if(PLayerInLockedCar[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "Sul pole vхtmeid!");
	new engine, lights, alarm, doors, bonnet, boot, objective;

	new vehicleId = GetPlayerVehicleID(playerid);
	
	if(gCar[vehicleId][Engine] == 1) // Mootor kдib.
	{
		TogglePlayerControllable(playerid, false);
		gCar[vehicleId][Engine] = 0;
		SendClientMessage(playerid, COLOR_GREY, "Mootor on suretatud, kui sa tahad vдljuda trьki /vдlju.");
		SendEmoteMessage(playerid, "suretab sхiduki mootori.");
		Kinni[playerid] = 0;
		return 1;
	}
	else
	{		
		if(!IsAllowedToUseVehicle(playerid, vehicleId))
		{
			new vehowner = -1, vehkeygiven = -1;
			
			new i1 = GetBuyCarId(playerid), i2 = GetBuyBikeId(playerid), i3 = GetBuyKopterId(playerid);
			new i4 = GetBuyPaatId(playerid), i5 = GetTreilerId(playerid), i6 = GetaAutoId(playerid);
			new i7 = GetaKopterId(playerid);
			
			if(i1 != -1)
			{
				vehowner = CarInfo[i1][cOwner];
				vehkeygiven = CarInfo[i1][CarKeyGiven];
			}
			else if(i2 != -1)
			{
				vehowner = BikeInfo[i2][bikeOwner];
				vehkeygiven = BikeInfo[i2][bikeKeyGiven];
			}
			else if(i3 != -1)
			{
				vehowner = KopterInfo[i3][kOwner];
				vehkeygiven = KopterInfo[i3][kKeyGiven];
			}
			else if(i4 != -1)
			{
				vehowner = PaatInfo[i4][paatOwner];
				vehkeygiven = PaatInfo[i4][paatKeyGiven];
			}
			else if(i5 != -1)
			{
				vehowner = TreilerInfo[i5][treilerOwned];
				vehkeygiven = TreilerInfo[i5][treilerKeyGiven];
			}
			else if(i6 != -1)
			{
				vehowner = aAutoInfo[i6][aautoOwner];
				vehkeygiven = 0;
			}
			else if(i7 != -1)
			{
				vehowner = aKopterInfo[i7][akopterOwner];
				vehkeygiven = 0;
			}			
			if(!IsAllowedToUseBuyVehicle(playerid, vehicleId, 1, vehowner, vehkeygiven, " ", 1, false))
			{
				return SendClientMessage(playerid, COLOR_GREY, "Sul pole vхtmeid!");
			}
		}
		
		if( StuckVeh[vehicleId] == 1 )
		{
			TogglePlayerControllable(playerid, false);
			return SendEmoteMessage(playerid, "ьritab mootorit kдivitada kuid ebaхnnestub.");
		}
		if( gCar[vehicleId][Fuel] <= 0 )
		{
			TogglePlayerControllable(playerid, false);
			SendEmoteMessage(playerid, "ьritab mootorit kдivitada kuid ebaхnnestub.");
			return SendClientMessage(playerid, COLOR_GREY, "Kьtus on otsas.");
		}
		TogglePlayerControllable(playerid, true);
		gCar[vehicleId][Engine] = 1;
		return SendEmoteMessage(playerid, "kдivitab sхiduki mootori.");
	}
}
Reply
#2

pawn Код:
if(gCar[vehicleId][Engine] == 1) // Mootor kдib.
    {
        TogglePlayerControllable(playerid, false);
                GetVehicleParamsEx(vehicleId, engine, lights, alarm, doors, boot, bonnet, objective);
                SetVehicleParamsEx(vehicleId, VEHICLE_PARAMS_OFF, lights, alarm, doors, boot, bonnet, objective); // not sure about the function name.
        gCar[vehicleId][Engine] = 0;
        SendClientMessage(playerid, COLOR_GREY, "Mootor on suretatud, kui sa tahad vдljuda trьki /vдlju.");
        SendEmoteMessage(playerid, "suretab sхiduki mootori.");
        Kinni[playerid] = 0;
        return 1;
    }
This is how you disable it. Not sure if you still need ManualVehicleEngineAndLIghts or something in OnGamemodeinit. (probably noticed that I am not in pawno at the moment xD)

Enabling is setting the VEHICLE_PARAMS_OFF to VEHICLE_PARAMS_ON (or 0 and 1 respectively).
Reply
#3

I also need a /lights command. Can anyone make me one? With dcmd?
Reply
#4

You can implement the same scenario as in the above code. Just switch the variables of engine to the one for the lights.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)