mint3d Posted October 15, 2013 Share Posted October 15, 2013 So i want this to close after a time of 1 min cant get it to work so here it is function drawStuff() dxDrawRectangle ( x/3.8, y/3.8, x/2.02, y/2, tocolor ( 0, 0, 0, 150 ) ) dxDrawText ( "Welcome to\nLos Santos Roleplay " .. playerName, x/3.5, y/3.6, x, y, tocolor ( 255, 255, 255, 255 ), 1, "bankgothic" ) . dxDrawText ( "Welcome to\nLos Santos Roleplay " .. playerName, x/3.48, y/3.58, x, y, tocolor ( 0, 0, 0, 255 ), 1, "bankgothic" ) end addEventHandler("onClientRender", root, drawStuff) Link to comment
Castillo Posted October 15, 2013 Share Posted October 15, 2013 Use setTimer and removeEventHandler. Link to comment
mint3d Posted October 15, 2013 Author Share Posted October 15, 2013 function drawStuff() dxDrawRectangle ( x/3.8, y/3.8, x/2.02, y/2, tocolor ( 0, 0, 0, 150 ) ) dxDrawText ( "Welcome to\nLos Santos Roleplay " .. playerName, x/3.5, y/3.6, x, y, tocolor ( 255, 255, 255, 255 ), 1, "bankgothic" ) dxDrawText ( "Welcome to\nLos Santos Roleplay " .. playerName, x/3.48, y/3.58, x, y, tocolor ( 0, 0, 0, 255 ), 1, "bankgothic" ) end function closedrawstuff () guiSetVisible (drawstuff, false) end local seconds = 50 setTimer ( closedrawstuff, ( seconds * 100 ), 1 ) Thats not right is it? Link to comment
pa3ck Posted October 15, 2013 Share Posted October 15, 2013 (edited) You want to set the drawstuff gui invisible, but you have no gui. Solidsnake gave you a function ( removeEventHandler ) and use it like this: function drawStuff() dxDrawRectangle ( x/3.8, y/3.8, x/2.02, y/2, tocolor ( 0, 0, 0, 150 ) ) dxDrawText ( "Welcome to\nLos Santos Roleplay " .. playerName, x/3.5, y/3.6, x, y, tocolor ( 255, 255, 255, 255 ), 1, "bankgothic" ) dxDrawText ( "Welcome to\nLos Santos Roleplay " .. playerName, x/3.48, y/3.58, x, y, tocolor ( 0, 0, 0, 255 ), 1, "bankgothic" ) end addEventHandler('onClientRender', getRootElement(), drawStuff) local seconds = 50 setTimer ( function() removeEventHandler("onClientRender", getRootElement(), drawStuff) end, ( seconds * 100 ), 1 ) OR function drawStuff() dxDrawRectangle ( x/3.8, y/3.8, x/2.02, y/2, tocolor ( 0, 0, 0, 150 ) ) dxDrawText ( "Welcome to\nLos Santos Roleplay " .. playerName, x/3.5, y/3.6, x, y, tocolor ( 255, 255, 255, 255 ), 1, "bankgothic" ) dxDrawText ( "Welcome to\nLos Santos Roleplay " .. playerName, x/3.48, y/3.58, x, y, tocolor ( 0, 0, 0, 255 ), 1, "bankgothic" ) end addEventHandler('onClientRender', getRootElement(), drawStuff) function closedrawstuff() removeEventHandler("onClientRender", getRootElement(), drawStuff) end local seconds = 50 setTimer ( closedrawstuff, ( seconds * 100 ), 1 ) They're the same thing, but the second one is easier Edited October 15, 2013 by Guest Link to comment
mint3d Posted October 15, 2013 Author Share Posted October 15, 2013 Thanks didn't see that and I don't see anything Link to comment
pa3ck Posted October 15, 2013 Share Posted October 15, 2013 Thanks didn't see that and I don't see anything I can't understand you. Is it not working, is that what you mean by "I don't see anything" Link to comment
mint3d Posted October 15, 2013 Author Share Posted October 15, 2013 Ye The dx Doesn't load Link to comment
pa3ck Posted October 15, 2013 Share Posted October 15, 2013 Any errors in /debugscript 3? Link to comment
pa3ck Posted October 15, 2013 Share Posted October 15, 2013 Can you show me the whole script? Link to comment
pa3ck Posted October 16, 2013 Share Posted October 16, 2013 (edited) Okay, than you have to define the following variables: x, y, and playerName as none of them is defined anywhere. ( Also, you SHOULD get errors in debugscript 3 with that code ) Edited October 16, 2013 by Guest Link to comment
mint3d Posted October 16, 2013 Author Share Posted October 16, 2013 How do i do that? Link to comment
pa3ck Posted October 16, 2013 Share Posted October 16, 2013 local playerName = getPlayerName(getLocalPlayer()) For x and y actually you can just sub in the numbers like so: dxDrawRectangle ( x/3.8, y/3.8, x/2.02, y/2, tocolor ( 0, 0, 0, 150 ) ) --You had it like this dxDrawRectangle ( posX, posY, sizeX, sizeY, tocolor ( 0, 0, 0, 150 ) ) -- You need it like this Same for the dxDrawText's Link to comment
mint3d Posted October 16, 2013 Author Share Posted October 16, 2013 local x,y = guiGetScreenSize() local playerName = getPlayerName ( localPlayer ) function drawStuff() dxDrawRectangle ( x/3.8, y/3.8, x/2.02, y/2, tocolor ( 0, 0, 0, 150 ) ) dxDrawText ( "Welcome to\nLos Santos Roleplay " .. playerName, x/3.5, y/3.6, x, y, tocolor ( 255, 255, 255, 255 ), 1, "bankgothic" ) dxDrawText ( "Welcome to\nLos Santos Roleplay " .. playerName, x/3.48, y/3.58, x, y, tocolor ( 0, 0, 0, 255 ), 1, "bankgothic" ) end addEventHandler('onClientRender', getRootElement(), drawStuff) function closedrawstuff() removeEventHandler("onClientRender", getRootElement(), drawStuff) end local seconds = 50 setTimer ( closedrawstuff, ( seconds * 100 ), 1 ) I took it my own way and this works thanks for the help tho Link to comment
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