I can't find the keybind for car engine.
#1

I can't find the keybind for car engine! I got some shit keybinds if i press S the engine will start and stop. Need help!
Reply
#2

How can i change the S to 2? Please help.
Reply
#3

bump
Reply
#4

This code would be under OnPlayerKeyStateChange, if you still have problems with the 'S' button after using my code, post your entire public OnPlayerKeyStateChange function here.

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_SUBMISSION)
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
            if(engine == 1)
            {
                SetVehicleParamsEx(GetPlayerVehicleID(playerid), 0, lights, alarm, doors, bonnet, boot, objective);
                SendClientMessage(playerid, 0xFF0000FF, "You Have Turned Your Vehicle's Engine Off."); //This line is not necessary and is completely optional.
            }
            else
            {
                SetVehicleParamsEx(GetPlayerVehicleID(playerid), 1, lights, alarm, doors, bonnet, boot, objective);
                SendClientMessage(playerid, 0x00FF00FF, "You Have Turned Your Vehicle's Engine On."); //Once again, this line is completely optional.
            }
        }
    }
    return 1;
}
Reply
#5

Can't find too, "Text not found"
Reply
#6

Make sure you check all the filterscripts/gamemodes that are running on your server as well.
Reply
#7

Код:
CMD:car(playerid, params[])
{
	if(isnull(params))
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /car [name]");
		SendClientMessageEx(playerid, COLOR_GREY, "Available names: Status, Engine, Lights, Trunk, Hood, Fuel");
		return 1;
	}
	if(strcmp(params, "engine", true) == 0 && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
		new engine,lights,alarm,doors,bonnet,boot,objective,vehicleid;
		new Float:X, Float:Y, Float:Z;
		new string[128];
		vehicleid = GetPlayerVehicleID(playerid);
		GetVehiclePos(vehicleid, X, Y, Z);
		if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
		GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
		if(VehicleBomb[vehicleid] == 1)
		{
			SendClientMessageEx(playerid, COLOR_GRAD2, "**Your engine had a bomb in the engine**");
			CreateExplosion(X, Y, Z, 7, 20);
			CreateExplosion(X, Y, Z, 2, 1);
		    format(string, sizeof(string), "%s has blown up due to the engine was wired with a bomb",GetPlayerNameEx(playerid));
		    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		    VehicleBomb[vehicleid] = 0;
			return 1;
		}
		else
		{
			if(engine == VEHICLE_PARAMS_ON)
			{
				SetVehicleEngine(vehicleid, playerid);
				format(string, sizeof(string), "* %s has stopped his vehicle's engine",  GetPlayerNameEx(playerid));
	   			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			}
			else if((engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET))
			{
				   SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine starting, please wait...");
				   new rand = random(4);
			       if(rand == 0)
				   {
					   SetTimerEx("SetVehicleEngine", 1000000000000, 0, "dd",  vehicleid, playerid);
					   SendClientMessage(playerid, COLOR_TWYELLOW, "Vehicle engine started");
			      	   format(string, sizeof(string), "* %s has started his vehicle's engine",  GetPlayerNameEx(playerid));
			 		   ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			       }
				   if(rand == 1)
				   {
					   SendClientMessage(playerid, COLOR_TWYELLOW, "Vehicle engine failed to start");
					   format(string, sizeof(string), "* %s struggles to start the engine but fails",  GetPlayerNameEx(playerid));
			 		   ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				   }
			       if(rand == 2)
				   {
					   SetTimerEx("SetVehicleEngine", 1000000000000, 0, "dd",  vehicleid, playerid);
					   SendClientMessage(playerid, COLOR_TWYELLOW, "Vehicle engine started");
					   format(string, sizeof(string), "* %s has started his vehicle's engine",  GetPlayerNameEx(playerid));
			   		   ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				   }
				   if(rand == 3)
				   {
					   SetTimerEx("SetVehicleEngine", 100000000000, 0, "dd",  vehicleid, playerid);
					   SendClientMessage(playerid, COLOR_TWYELLOW, "Vehicle engine started");
			           format(string, sizeof(string), "* %s has started his vehicle's engine",  GetPlayerNameEx(playerid));
			 		   ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				   }
			}
		}
	}
Do you think it's here?
Reply
#8

It might be in your SetVehicleEngine, just show me that.

And also, if you're planning on making an engine that basically never starts, then
pawn Код:
SetTimerEx("SetVehicleEngine", 1000000000000, 0, "dd",  vehicleid, playerid);
Should definitely not be 1000000000000, it should be 10000 at the most.

*900th Post!!
Reply
#9

Код:
SetTimerEx("SetVehicleEngine", 1000, 0, "dd",  vehicleid, playerid);
It's 1000 dude.
Reply
#10

So how can i change the keybind now? To number 2 not S. ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)