CTRL for vehicle headlights - 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: CTRL for vehicle headlights (
/showthread.php?tid=585688)
CTRL for vehicle headlights -
GabiXx - 15.08.2015
I tryied this, but CTRL don't work. I want CTRL for turn headlights on/off.
PHP код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_ACTION ) // KEY_SUBMISSION = butonul 2 - Daca apesi 2 vei deschide / inchide farurile
{
if(!IsPlayerInAnyVehicle(playerid)) return true; // Daca playerul nu e in masina oprim 'operatiunea'
new engine, lights, alarm, doors, bonnet, boot, objective; // Cream niste variabile pentru a stoca informatiile despre masini
new vid = GetPlayerVehicleID(playerid); // Cream o variabiabila gen 'shortcut' pentru a nu mai scrie 'GetPlayerVehicleID(playerid)'
GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective); // Stocam informatiile despre masina in variabilile create; // La fel ca mai sus doar ca opusu (o pornim daca e oprita)
if(lights == VEHICLE_PARAMS_ON) SetVehicleParamsEx(vid, engine, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective); // Daca lumina este pornita , o oprim - Traducere mot-a-mot :P
if(lights == VEHICLE_PARAMS_OFF) SetVehicleParamsEx(vid, engine, VEHICLE_PARAMS_ON, alarm, doors, bonnet, boot, objective);
}
return 1;
}
Re: CTRL for vehicle headlights -
Vince - 15.08.2015
KEY_ACTION is generally assigned to Tab.
Re: CTRL for vehicle headlights -
GabiXx - 15.08.2015
But in vehicle is LCTRL.
Re: CTRL for vehicle headlights -
Variable™ - 15.08.2015
https://sampwiki.blast.hk/wiki/Keys
The key is KEY_FIRE
Re: CTRL for vehicle headlights -
GabiXx - 15.08.2015
Still don't work.
Re: CTRL for vehicle headlights -
Variable™ - 15.08.2015
-.-
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_ACTION) // KEY_SUBMISSION = butonul 2 - Daca apesi 2 vei deschide / inchide farurile
{
if(IsPlayerInAnyVehicle(playerid)) // Daca playerul nu e in masina oprim 'operatiunea'
{
new engine, lights, alarm, doors, bonnet, boot, objective; // Cream niste variabile pentru a stoca informatiile despre masini
new vid = GetPlayerVehicleID(playerid); // Cream o variabiabila gen 'shortcut' pentru a nu mai scrie 'GetPlayerVehicleID(playerid)'
GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective); // Stocam informatiile despre masina in variabilile create; // La fel ca mai sus doar ca opusu (o pornim daca e oprita)
if(lights == VEHICLE_PARAMS_ON) SetVehicleParamsEx(vid, engine, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective); // Daca lumina este pornita , o oprim - Traducere mot-a-mot :P
if(lights == VEHICLE_PARAMS_OFF) SetVehicleParamsEx(vid, engine, VEHICLE_PARAMS_ON, alarm, doors, bonnet, boot, objective);
}
}
return 1;
}