how to turn the vehicle on with nump8
#6

SA:MP can only detect GTA SA keys like KEY_FIRE or KEY_SPRINT
If you want to use NumPad8 then you should set on of your GTA sa controls to NumPad8.
I will show you how to do that script.
The engine will turn on and off when you press N


PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
        if ((
newkeys KEY_NO) && !(oldkeys KEY_NO))
        {
                 if(
IsPlayerInAnyVehicle(playerid// checks if the player is in a vehicle
                 
{
                         new 
enginelightsalarmdoorsbonnetbootobjectivevehicleid GetPlayerVehicleID(playerid);
    
// we create some variables, these ones will store vehicle data. After we get the id of the vehicle                      
                         
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective); //we store vehicles data inside the variables we created
                          
if(engine == 0engine 1//if: the engine is off we turn it on
                          
else if(engine == 1engine 0// viceversa
                          
SetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective); we update vehicles data
                  
}
          }
          return 
1;

Reply


Messages In This Thread
how to turn the vehicle on with nump8 - by langit - 12.11.2017, 17:32
Re: how to turn the vehicle on with nump8 - by Sew_Sumi - 12.11.2017, 17:47
Re: how to turn the vehicle on with nump8 - by thefirestate - 12.11.2017, 18:05
Re: how to turn the vehicle on with nump8 - by Erioni - 12.11.2017, 18:19
Re: how to turn the vehicle on with nump8 - by Sew_Sumi - 12.11.2017, 18:25
Re: how to turn the vehicle on with nump8 - by Lucases - 12.11.2017, 19:54
Re: how to turn the vehicle on with nump8 - by langit - 13.11.2017, 00:20
Re: how to turn the vehicle on with nump8 - by langit - 13.11.2017, 00:26
Re: how to turn the vehicle on with nump8 - by Dayrion - 13.11.2017, 00:54
Re: how to turn the vehicle on with nump8 - by TitoRayne - 13.11.2017, 12:02

Forum Jump:


Users browsing this thread: 2 Guest(s)