Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:lights(playerid, params[])
- {
- if(IsPlayerInAnyVehicle(playerid)) // Yep
- {
- if(GetPlayerState(playerid) == 2) //seat.
- {
- new veh = GetPlayerVehicleID(playerid); //self explanitory
- new engine, lights, alarm, doors, bonnet, boot, objective; //required "new's"
- GetVehicleParamsEx(veh, engine, lights, alarm, doors, bonnet, boot, objective); //get the params.
- switch(lights) //switch statement, easy, most commonly used in dialogs.
- {
- case 0: //if the lights are set to 0
- {
- new string[128];
- format(string, sizeof(string), "%s has turned on their headlights"); //string
- NearByMessage(playerid, ORANGE, string);
- SetVehicleParamsEx(veh, engine, 1, alarm, doors, bonnet, boot, objective); //Set them
- }
- case 1: //if the lights are set to 1.
- {
- new string[128];
- format(string, sizeof(string), "%s has turned off their headlights."); //string
- NearByMessage(playerid, ORANGE, string);
- SetVehicleParamsEx(veh, engine, 0, alarm, doors, bonnet, boot, objective); //Set them
- }
- }
- }
- else return SendClientMessage(playerid, WHITE, "Bro, passengers don't control lights."); //returning errors.
- }
- else return SendClientMessage(playerid, WHITE, "Since when the fuck were you in a car?"); //another return
- return 1; //required.
- }
Advertisement
Add Comment
Please, Sign In to add comment