mint3d Posted October 15, 2013 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) Skype: Jordan_Nymph
Castillo Posted October 15, 2013 Posted October 15, 2013 Use setTimer and removeEventHandler. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
mint3d Posted October 15, 2013 Author 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? Skype: Jordan_Nymph
pa3ck Posted October 15, 2013 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
mint3d Posted October 15, 2013 Author Posted October 15, 2013 Thanks didn't see that and I don't see anything Skype: Jordan_Nymph
pa3ck Posted October 15, 2013 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"
mint3d Posted October 15, 2013 Author Posted October 15, 2013 Ye The dx Doesn't load Skype: Jordan_Nymph
pa3ck Posted October 16, 2013 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
pa3ck Posted October 16, 2013 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
mint3d Posted October 16, 2013 Author 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 Skype: Jordan_Nymph
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