Connorlolz

bLARGH

Aug 31st, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.34 KB | None | 0 0
  1.  
  2. CMD:lights(playerid, params[])
  3. {
  4.     if(IsPlayerInAnyVehicle(playerid)) // Yep
  5.     {
  6.         if(GetPlayerState(playerid) == 2) //seat.
  7.         {
  8.             new veh = GetPlayerVehicleID(playerid); //self explanitory
  9.             new engine, lights, alarm, doors, bonnet, boot, objective; //required "new's"
  10.             GetVehicleParamsEx(veh, engine, lights, alarm, doors, bonnet, boot, objective); //get the params.
  11.             switch(lights) //switch statement, easy, most commonly used in dialogs.
  12.             {
  13.                 case 0: //if the lights are set to 0
  14.                 {
  15.                     new string[128];
  16.                     format(string, sizeof(string), "%s has turned on their headlights"); //string
  17.                     NearByMessage(playerid, ORANGE, string);
  18.                     SetVehicleParamsEx(veh, engine, 1, alarm, doors, bonnet, boot, objective); //Set them
  19.                 }
  20.                 case 1: //if the lights are set to 1.
  21.                 {
  22.                     new string[128];
  23.                     format(string, sizeof(string), "%s has turned off their headlights."); //string
  24.                     NearByMessage(playerid, ORANGE, string);
  25.                     SetVehicleParamsEx(veh, engine, 0, alarm, doors, bonnet, boot, objective); //Set them
  26.                 }
  27.             }
  28.         }
  29.         else return SendClientMessage(playerid, WHITE, "Bro, passengers don't control lights."); //returning errors.
  30.     }
  31.     else return SendClientMessage(playerid, WHITE, "Since when the fuck were you in a car?"); //another return
  32.     return 1; //required.
  33. }
Advertisement
Add Comment
Please, Sign In to add comment