SA-MP Forums Archive
Need some assistance with ignition command - 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: Need some assistance with ignition command (/showthread.php?tid=562820)



Need some assistance with ignition command - PabloAguado - 11.02.2015

Hello, I have been trying to figure out how to make the vehicle engine ignite if the person owns the car itself, for example if I have a car and have the keys i can ignite the engine, but if I don't own the car then the vehicle won't ignite. If anyone could help it would be very appreciated.

I just don't know how to start, the problem is that i can't figure out how to detect if the vehicle is his or not.

Here is my detection function to check if the player owns the vehicle.

Player[playerid][PlayerCarModel]

Код:
CMD:carengine(playerid, params[])
{
    if(strcmp(params,"on",true) == 0)
    {
	   if(Player[playerid][PlayerCarModel] >=1
		if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
        	new Vehicle = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
          	GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
   			SendClientMessage(playerid, COLOR_YELLOW, "You have turned your engine >{FFFFFF} ON");
   			Engine[Vehicle] = 1, SetVehicleParamsEx(Vehicle, 1, lights, alarm, doors, bonnet, boot, objective);
        }
    }
 	if(strcmp(params,"off",true) == 0)
 	{
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
			{
		    	new Vehicle = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
   				GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
   				SendClientMessage(playerid, COLOR_YELLOW, "You have turned your engine >{FFFFFF} OFF");
  		 		Engine[Vehicle] = 0, SetVehicleParamsEx(Vehicle, 0, lights, alarm, doors, bonnet, boot, objective);
  		 	}
  	}
    return 1;
}



Re: Need some assistance with ignition command - CalvinC - 12.02.2015

Im not sure how you store information in "Player[playerid][PlayerCarModel]", but you can try this:
pawn Код:
if(Player[playerid][PlayerCarModel] == GetPlayerVehicleID(playerid))
Otherwise show how you use it.