Re: Untitled

From Stained Cat, 10 Years ago, written in Lua, viewed 770 times. This paste will die in 1 Second. This paste is a reply to Untitled from Sweltering Hornbill - view diff
URL https://paste.godclan.hu/view/7Ch6xOY6 Embed
Download Paste or View Raw
  1. local shader
  2. signTep = { }
  3. signFirstTick = getTickCount ( )
  4. signId1 = 1
  5.  
  6.  
  7. addEventHandler( "onClientResourceStart", resourceRoot,
  8.         function()
  9.                 shader, tec = dxCreateShader ( "texreplace.fx" )
  10.                 if not shader then
  11.                         outputChatBox( "Could not create shader. Please use debugscript 3" )
  12.                 else
  13.                         engineApplyShaderToWorldTexture ( shader, "heat_02" )
  14.                         if not loadPrutTextures ( ) then
  15.                                 outputChatBox ( "Loading sign textures failed")
  16.                                 destroyElement ( shader )
  17.                                 return
  18.                         end
  19.                         dxSetShaderValue ( shader, "gTexture", signTep[1] )
  20.                         addEventHandler ( "onClientHUDRender", getRootElement (), renderAap )
  21.                 end
  22.         end
  23. )
  24.  
  25.  
  26.  
  27. function loadPrutTextures ( )
  28.         for i = 0, 3 do
  29.                 local tex = dxCreateTexture ( "stopbord/left/lframe"..i..".png" )
  30.                 if not tex then
  31.                         unloadPrutTextures ( )
  32.                         return false
  33.                 end
  34.                 table.insert ( signTep, tex )
  35.         end
  36.        
  37.         return true
  38. end
  39.  
  40. function unloadPrutTextures ( )
  41.         for index, tex in ipairs ( signTep ) do
  42.                 destroyElement ( tex )
  43.         end
  44. end
  45.  
  46. function renderAap ( )
  47.         if getTickCount ( ) - signFirstTick < 100 then
  48.                 return
  49.         end
  50.         signId1 = signId1 + 1
  51.         if signId1 > #signTep then
  52.                 signId1 = signId1 - #signTep
  53.         end
  54.         dxSetShaderValue ( shader, "gTexture", signTep [ signId1 ] )
  55.         signFirstTick = getTickCount ( )
  56. end
  57.  

Reply to "Re: Untitled"

Here you can reply to the paste above