Advertisement
itchiban

You owe me.

Aug 19th, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.75 KB | None | 0 0
  1. /******************************************************************************************
  2.  #Version 1.2#
  3.  
  4.     Includes: All Flashing Lights command
  5.  
  6.     - VcmdFlashingLights
  7.  
  8.     Script by Hoppah
  9.        
  10.     Usage of this script in other mods is NOT allowed without permission of Hoppah
  11.  
  12.     Edited by itchboy for PottyScotty. You owe me bruh
  13.  
  14. ********************************************************************************************/
  15.  
  16. int DummyGroup = 24;
  17. const char SND_BUTTON[]         = "mod:Audio/FX/emerg_lights.wav";
  18.  
  19. object VcmdFlashingLights : CommandScript
  20. {
  21.     VcmdFlashingLights()
  22.     {
  23.         SetIcon("flashinglightson");
  24.         SetCursor("flashinglights");
  25.         SetGroupID(DummyGroup);
  26.         SetGroupLeader(true);
  27.         SetRestrictions(RESTRICT_SELFEXECUTE);
  28.     }
  29.  
  30.     bool CheckPossible(GameObject *Caller)
  31.     {
  32.         if (!Caller->IsValid())
  33.             return false;
  34.  
  35.         Vehicle v(Caller);
  36.         if (v.IsBlueLightEnabled())
  37.             SetIcon("flashinglightsoff");
  38.         else
  39.             SetIcon("flashinglightson");
  40.  
  41.         if (Caller->GetType() == ACTOR_VEHICLE)
  42.             return true;
  43.  
  44.         return false;
  45.     }
  46.  
  47.     bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
  48.     {
  49.         if (!Caller->IsValid() || !Target->IsValid() || Target->GetID() != Caller->GetID())
  50.             return false;
  51.  
  52.         if (Caller->GetType() == ACTOR_VEHICLE)
  53.             return true;
  54.         return true;
  55.     }
  56.  
  57.     void PushActions(GameObject *Caller, Actor *Target, int childID)
  58.     {
  59.         Vehicle v(Caller);
  60.         if (v.IsBlueLightEnabled())
  61.             v.EnableBlueLights(false);
  62.         else if (!v.IsBlueLightEnabled())
  63.             v.EnableBlueLights(true);
  64.         if(v.IsSpecialLightEnabled())
  65.         {
  66.             Game::ExecuteCommand("VcmdDirectionalLightsOff", &v, &v);
  67.             (!v.IsBlueLightEnabled())
  68.                 v.EnableBlueLights(true);
  69.         }
  70.         Audio::PlaySample3D(SND_BUTTON, v.GetPosition());
  71.     }
  72. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement