daKillar2000 Posted November 7, 2010 Posted November 7, 2010 heey i have a little problem whit this local defR = 255 local defG = 0 local defB = 0 addEventHandler( "onClientPlayerDamage", getLocalPlayer(), function() setTimer( background, 1000, 1, defR, defG, defB ) end ) warnin: bad argument@ 'setTimer' Can Someone Help me please? ohyeah background is a image;)
Aibo Posted November 7, 2010 Posted November 7, 2010 heey i have a little problem whit this local defR = 255 local defG = 0 local defB = 0 addEventHandler( "onClientPlayerDamage", getLocalPlayer(), function() setTimer( background, 1000, 1, defR, defG, defB ) end ) warnin: bad argument@ 'setTimer' Can Someone Help me please? ohyeah background is a image;) setTimer is meant to call a function after specified amount of time, not image. you should put a function there local defR = 255 local defG = 0 local defB = 0 function changeBackground(r,g,b) -- the stuff you'll do with background image end addEventHandler( "onClientPlayerDamage", getLocalPlayer(), function() setTimer(changeBackground, 1000, 1, defR, defG, defB) end )
daKillar2000 Posted November 7, 2010 Author Posted November 7, 2010 it's a dxdraw image background = dxDrawImage(37, 450.5, 147.5, 130,"background.png",0.0,0.0,0.0,tocolor( 255 ,255, 255 ),false,nil) i whil when he Damage change it to red for one sec.
Aibo Posted November 7, 2010 Posted November 7, 2010 it's a dxdraw imagebackground = dxDrawImage(37, 450.5, 147.5, 130,"background.png",0.0,0.0,0.0,tocolor( 255 ,255, 255 ),false,nil) i whil when he Damage change it to red for one sec. well, dxDrawImage needs to be called from "onClientRender" event: local defR = 255 local defG = 255 local defB = 255 function changeBackground(r,g,b) defR, defG, defB = r, g, b end addEventHandler("onClientPlayerDamage", getLocalPlayer(), function() changeBackground(255, 0, 0) setTimer(changeBackground, 1000, 1, 255, 255, 255) end) addEventHandler("onClientRender", getRootElement(), function() dxDrawImage(37, 450.5, 147.5, 130,"background.png",0.0,0.0,0.0,tocolor(defR, defG, defB),false,nil) end)
daKillar2000 Posted November 7, 2010 Author Posted November 7, 2010 yeah i have that but only the color but i whill try this thx:)
Aibo Posted November 7, 2010 Posted November 7, 2010 what exactly "not works"? my phone "not works", can you fix it? seriously, post the whole code that "not works". p.s. i doubt that is the problem, but what is that "nil" in dxDrawImage anyway?
daKillar2000 Posted November 7, 2010 Author Posted November 7, 2010 no men he spams me debug 3 dxdrawimage can't load background.png O_o
Aibo Posted November 7, 2010 Posted November 7, 2010 no men he spams me debug 3 dxdrawimage can't load background.png O_o you have it in place and added it to meta.xml, don't you?
Castillo Posted November 7, 2010 Posted November 7, 2010 he/you forgot about alpha argument.. https://wiki.multitheftauto.com/wiki/DxDrawImage local defR = 255 local defG = 255 local defB = 255 function changeBackground(r,g,b) defR, defG, defB = r, g, b end addEventHandler("onClientPlayerDamage", getLocalPlayer(), function() changeBackground(255, 0, 0) setTimer(changeBackground, 1000, 1, 255, 255, 255) end) addEventHandler("onClientRender", getRootElement(), function() dxDrawImage(37, 450.5, 147.5, 130,"asd.png",0.0,0.0,0.0,tocolor(255, defR, defG, defB),false) end)
Aibo Posted November 7, 2010 Posted November 7, 2010 he/you forgot about alpha argument.. https://wiki.multitheftauto.com/wiki/DxDrawImage tocolor() recieves alpha as last argument and it's optional, so i guessed the value he returns with only 3 color arguments already contains default alpha (255). though need to check that of course
daKillar2000 Posted November 7, 2010 Author Posted November 7, 2010 yea but he dind;t change to red O_o no warnings nothing
Aibo Posted November 7, 2010 Posted November 7, 2010 again, post the code you use, check if the event is triggered at all. like: addEventHandler("onClientPlayerDamage", getLocalPlayer(), function() outputChatBox("onClientPlayerDamage triggered") changeBackground(255, 0, 0) setTimer(changeBackground, 1000, 1, 255, 255, 255) end)
Aibo Posted November 7, 2010 Posted November 7, 2010 whats your hesitation to post your code then? because i've just even tested the code above, and it works fine. so it's a fault on your end.
Aibo Posted November 7, 2010 Posted November 7, 2010 you have your code, you fix it. i can't, because i can't see it. i've already asked like 3? times to post it.
Aibo Posted November 7, 2010 Posted November 7, 2010 well then obviously you're not trying it right, cause when i tried this: local defR = 255 local defG = 255 local defB = 255 function changeBackground(r,g,b) defR, defG, defB = r, g, b end addEventHandler("onClientPlayerDamage", getLocalPlayer(), function() changeBackground(255, 0, 0) setTimer(changeBackground, 1000, 1, 255, 255, 255) end) addEventHandler("onClientRender", getRootElement(), function() dxDrawImage(37, 450.5, 147.5, 130,"background.png",0.0,0.0,0.0,tocolor(defR, defG, defB),false) end) it worked.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now