15.08.2015, 19:52
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;
}