ViRuZGamiing Posted December 21, 2013 Posted December 21, 2013 (edited) Hello function buyMsg (player) if showRoomVehicles[source] then setVehicleLocked ( source, true ) outputChatBox ("To buy this car write /buy", player, 255, 100, 0) end end I have this in Server Side but I want it to chance the outputChatBox to a dxDraw but dxDraw is client how can I get it in? should I do this; -- server function buyMsg (player) if showRoomVehicles[source] then setVehicleLocked ( source, true ) triggerClientEvent ( dxDraw, root ) end end --client function dxDraw ( player ) DxDrawRectangle(......) end addEvent( "dxDraw", true ) addEventHandler( "dxDraw", root, dxDraw ) Edited December 21, 2013 by Guest "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
bandi94 Posted December 21, 2013 Posted December 21, 2013 Server function buyMsg (player) if showRoomVehicles[source] then setVehicleLocked ( source, true ) triggerClientEvent (player, "dxDraw", player ) end end Client function dxDraw ( ) DxDrawRectangle(0,0,100,100) end addEvent( "dxDraw", true ) addEventHandler( "dxDraw", root, function() addEventHandler("onClientRender",root,dxDraw) setTimer(function() removeEventHandler("onClientRender",root,dxDraw) end ,3000,1) end ) it will Draw the Rectangel for 3 secounds Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
ViRuZGamiing Posted December 21, 2013 Author Posted December 21, 2013 Going to test it but you seem pretty trusted with dxDraw, so Thanks in advance "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
ViRuZGamiing Posted December 21, 2013 Author Posted December 21, 2013 Yes! I works fine i've changed time to 10 secs can I add that after 10secs alpha changes from 255 to 0 (fade out)? "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
ViRuZGamiing Posted December 21, 2013 Author Posted December 21, 2013 Is there a possibility to change the alpha of a dxDraw? if yes then how? "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
bandi94 Posted December 21, 2013 Posted December 21, 2013 using "tocolor" on DxDraw. tocolor has 4 arguments RGBA where A is alpha 0-255. local fade_a local do_fade function dxDraw ( ) DxDrawRectangle(0,0,100,100,tocolor(0,0,0,fade_a)) if do_fade then -- if fade is enabled fade_a = fade_a - 1 -- decrease alpha on every frame until is 0 end if do_fade and fade_a <=0 then -- if fade alpha is 0 turn the DxDraw off removeEventHandler("onClientRender",root,dxDraw) end end addEvent( "dxDraw", true ) addEventHandler( "dxDraw", root, function() fade_a = 255 -- set alpha to max. do_fade = false -- set fade effect off addEventHandler("onClientRender",root,dxDraw) setTimer(function() do_fade = true end ,10000,1) -- after 10s enable fade end ) Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
johny46 Posted December 21, 2013 Posted December 21, 2013 According to wiki, it is possible: bool dxDrawRectangle ( int startX, int startY, float width, float height [, int color = white, bool postGUI = false] ) For example, to make the rectangle half visible, you'd use this: bool dxDrawRectangle ( 100, 100, 50, 50, tocolor(255,255,255,128) ) In order to make the rectangle fade out, you'd have to calculate the new alpha value in some time interval or simply "onClientRender".
ViRuZGamiing Posted December 21, 2013 Author Posted December 21, 2013 using "tocolor" on DxDraw. tocolor has 4 arguments RGBA where A is alpha 0-255. local fade_a local do_fade function dxDraw ( ) DxDrawRectangle(0,0,100,100,tocolor(0,0,0,fade_a)) if do_fade then -- if fade is enabled fade_a = fade_a - 1 -- decrease alpha on every frame until is 0 end if do_fade and fade_a <=0 then -- if fade alpha is 0 turn the DxDraw off removeEventHandler("onClientRender",root,dxDraw) end end addEvent( "dxDraw", true ) addEventHandler( "dxDraw", root, function() fade_a = 255 -- set alpha to max. do_fade = false -- set fade effect off addEventHandler("onClientRender",root,dxDraw) setTimer(function() do_fade = true end ,10000,1) -- after 10s enable fade end ) Again it works, I like you "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
ViRuZGamiing Posted December 22, 2013 Author Posted December 22, 2013 function testHit ( thePlayer, matchingDimension ) local elementType = getElementType( thePlayer ) if (elementType) then triggerClientEvent (source, "testMessage", root) end end addEventHandler( "onMarkerHit", testMarker, testHit ) How can I get testMarker, it's in another function "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
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