XaskeL

shtorka govna na xccd

Jan 12th, 2020
178
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Slider = {};
  2. Slider.data = {};
  3. Slider.states = {};
  4. Slider.timers = {};
  5. Slider.targets = {};
  6. Slider.procces = {};
  7. Slider.animation = {};
  8.  
  9. Slider.key = "h";
  10.  
  11. function Slider:shader(vehicle)
  12. --print(self,vehicle)
  13. if self.data[vehicle] == nil then
  14. self.data[vehicle] = DxShader("files/texReplace.fx",0,0,true);
  15. self.targets[vehicle] = dxCreateRenderTarget(235,50,true)
  16. self.procces[vehicle] = 0;
  17. end
  18. return self.data[vehicle];
  19. end
  20.  
  21. function Slider:work(_,vehicle)
  22. local shader = Slider:shader(vehicle)
  23. end
  24.  
  25.  
  26. addEventHandler("onClientRender",root,function()
  27. for vehicle,shader in pairs(Slider.data) do
  28. self = Slider
  29. if isElement(vehicle) then
  30. if self.states[vehicle] then
  31. self.procces[vehicle] = self.procces[vehicle] + 15
  32. else
  33. self.procces[vehicle] = self.procces[vehicle] - 15
  34. end
  35. if Slider.animation[vehicle] then
  36. dxSetRenderTarget(self.targets[vehicle],true)
  37. dxDrawRectangle(
  38. 0,
  39. 0,
  40. 235,
  41. self.procces[vehicle]/2,
  42. tocolor(0,0,0,255)
  43. );
  44. dxSetRenderTarget()
  45.  
  46. dxSetShaderValue(shader, "gTexture", self.targets[vehicle])
  47. engineApplyShaderToWorldTexture(shader, "Nomer", vehicle)
  48. end
  49.  
  50.  
  51. if self.procces[vehicle] > 110 or self.procces[vehicle] < -1 then
  52. if self.procces[vehicle] > 110 then
  53. self.procces[vehicle] = 110
  54. else
  55. self.procces[vehicle] = 0
  56. end
  57.  
  58. Slider.animation[vehicle] = false
  59. else
  60. vehicle:setData("SliderProcces",self.procces[vehicle])
  61. Slider.animation[vehicle] = true
  62. end
  63. else
  64. --shader:destroy()
  65. shader = nil
  66. end
  67. end
  68. end)
  69.  
  70.  
  71. addEventHandler("onClientKey",root,function(key,state)
  72. if key == Slider.key and state then
  73. if localPlayer.vehicle and localPlayer.vehicle:getOccupant() == localPlayer then
  74. if (localPlayer.vehicle:getData("SliderBuyed") or false) then
  75. local vehicle = localPlayer.vehicle
  76. if Slider.states[vehicle] == nil then
  77. Slider.states[vehicle] = true
  78. else
  79. Slider.states[vehicle] = not Slider.states[vehicle]
  80. end
  81. vehicle:setData("SliderState",Slider.states[vehicle])
  82. Slider:work(_,vehicle)
  83. end
  84. end
  85. end
  86. end)
  87.  
  88. addEventHandler("onClientElementDataChange",root,function(data,_,value)
  89. if data == "SliderState" and source.type == "vehicle" then
  90. Slider.states[source] = value
  91. if Slider.data[source] == nil then
  92. Slider:work(_,source)
  93. end
  94. end
  95. if data == "SliderProcces" and source.type == "vehicle" then
  96. --Slider.procces[source] = value
  97. end
  98. end)
  99.  
  100. addEventHandler("onClientRestore",root,function()
  101. for k,vehicle in ipairs(getElementsByType("vehicle")) do
  102. if isElementStreamedIn(vehicle) then
  103. --print('Восстановлено')
  104. Slider.animation[vehicle] = true
  105. end
  106. end
  107. end)
  108.  
  109. addEventHandler("onClientElementStreamIn",root,function()
  110. if source.type == "vehicle" then
  111. if (source:getData("SliderState") or false) then
  112. Slider.states[source] = true
  113. Slider.procces[source] = source:getData("SliderProcces") or 0
  114. end
  115. end
  116. end)
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×