Advertisement
Borsuk93

Skrypt PAWN - stroboskopy

Apr 13th, 2018
559
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.32 KB | None | 0 0
  1. #define FILTERSCRIPT
  2.  
  3. #include <a_samp>
  4. #include <zcmd>
  5.  
  6. #if defined FILTERSCRIPT
  7.  
  8. new pLights[MAX_PLAYERS];
  9. new sLight;
  10. new sLight2;
  11.  
  12. forward TimerStrobo(vehicleid);
  13. forward TimerStrobo2(vehicleid);
  14. forward StroboOn(playerid);
  15. forward StroboOff(playerid);
  16. forward encode_lights(light1, light2, light3, light4);
  17.  
  18. #else
  19.  
  20. main(){}
  21.  
  22. #endif
  23.  
  24. public OnPlayerConnect(playerid)
  25. {
  26.     ClearCache(playerid);
  27.     return 1;
  28. }
  29.  
  30. public OnPlayerDeath(playerid, killerid, reason)
  31. {
  32.     ClearCache(playerid);
  33.     return 1;
  34. }
  35.  
  36. CMD:silnik(playerid, params[])
  37. {
  38.     new enginem, lights, alarm, doors, bonnet, boot, objective,
  39.         v_model = GetPlayerVehicleID(playerid);
  40.     GetVehicleParamsEx(v_model, enginem, lights, alarm, doors, bonnet, boot, objective);
  41.     SetVehicleParamsEx(v_model, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, alarm, doors, bonnet, boot, objective);
  42.     return 1;
  43. }
  44.  
  45. public OnVehicleSirenStateChange(playerid, vehicleid, newstate)
  46. {
  47.     new enginem, lights, alarm, doors, bonnet, boot, objective;
  48.     GetVehicleParamsEx(vehicleid, enginem, lights, alarm, doors, bonnet, boot, objective);
  49.    
  50.     if(newstate)
  51.     {
  52.         GameTextForPlayer(playerid, "~W~Syreny ~G~wlaczone", 1000, 3);
  53.         SetVehicleParamsEx(vehicleid, enginem, VEHICLE_PARAMS_ON, alarm, doors, bonnet, boot, objective);
  54.         if(pLights[playerid] == 0)
  55.         {
  56.             StroboOn(playerid);
  57.             pLights[playerid] = 1;
  58.         }
  59.     }
  60.     else
  61.     {
  62.         GameTextForPlayer(playerid, "~W~Syreny ~r~wylaczone", 1000, 3);
  63.         SetVehicleParamsEx(vehicleid, enginem, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective);
  64.         if(pLights[playerid] == 1)
  65.         {
  66.             StroboOff(playerid);
  67.             pLights[playerid] = 0;
  68.         }
  69.     }
  70.     return 1;
  71. }
  72.  
  73. public StroboOn(playerid)
  74. {
  75.     if ( IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0 )
  76.     {
  77.         new Panels, Doors1, Lights, Tires;
  78.         GetVehicleDamageStatus(GetPlayerVehicleID(playerid), Panels, Doors1, Lights, Tires);
  79.         UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid), Panels, Doors1, encode_lights(0,0,1,1), Tires);
  80.         sLight = SetTimerEx("TimerStrobo", 100, false, "d", GetPlayerVehicleID(playerid));
  81.     }
  82. }
  83. public StroboOff(playerid)
  84. {
  85.     if ( IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0 )
  86.     {
  87.        KillTimer(sLight);
  88.        KillTimer(sLight2);
  89.        new Panels, Doors1, Lights, Tires;
  90.        GetVehicleDamageStatus(GetPlayerVehicleID(playerid), Panels, Doors1, Lights, Tires);
  91.        UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid), Panels, Doors1, encode_lights(0,0,0,0), Tires);
  92.     }
  93. }
  94. public encode_lights(light1, light2, light3, light4)
  95. {
  96.     return light1 | (light2 << 1) | (light3 << 2) | (light4 << 3);
  97. }
  98. public TimerStrobo(vehicleid)
  99. {
  100.         new Panels, Doors1, Lights, Tires;
  101.         GetVehicleDamageStatus(vehicleid, Panels, Doors1, Lights, Tires);
  102.         UpdateVehicleDamageStatus(vehicleid, Panels, Doors1, encode_lights(1,1,0,0), Tires);
  103.         sLight2 = SetTimerEx("TimerStrobo2", 100, false, "d", vehicleid);
  104. }
  105. public TimerStrobo2(vehicleid)
  106. {
  107.         new Panels, Doors1, Lights, Tires;
  108.         GetVehicleDamageStatus(vehicleid, Panels, Doors1, Lights, Tires);
  109.         UpdateVehicleDamageStatus(vehicleid, Panels, Doors1, encode_lights(0,0,1,1), Tires);
  110.         sLight = SetTimerEx("TimerStrobo", 100, false, "d", vehicleid);
  111. }
  112.  
  113. stock ClearCache(playerid)
  114. {
  115.     pLights[playerid] = 0;
  116.     return 1;
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement