15.08.2015, 21:32
-.-
Код:
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; }