Turbe$Z Posted October 9, 2016 Posted October 9, 2016 local screenW, screenH = guiGetScreenSize() addEventHandler("onClientRender", root, function() dxDrawRectangle(screenW * 0.7951, screenH * 0.1944, screenW * 0.1979, screenH * 0.1033, tocolor(0, 0, 0, 131), false) end ) function greetPlayer ( ) local joinedPlayerName = getPlayerName ( source ) dxDrawText("#00baff" .. joinedPlayerName .. "#FFffFFJött Kockulni!", 1151, 181, 1420, 202, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, true, false) end addEventHandler ( "onPlayerJoin", getRootElement(), greetPlayer )
Mr.Loki Posted October 9, 2016 Posted October 9, 2016 you didnt have to create a new topic and onPlayerJoin is client side dxDrawText is client side those functions do not go together What you can do is create an event so that when the player joins it will render the dx elements for them.
Walid Posted October 9, 2016 Posted October 9, 2016 5 minutes ago, loki2143 said: onPlayerJoin is client side Server side not client side You can use onClientPlayerJoin
Turbe$Z Posted October 9, 2016 Author Posted October 9, 2016 onClientPlayerJoin is show word for 1ms and hide, why?
Mr.Loki Posted October 9, 2016 Posted October 9, 2016 1 minute ago, Walid said: Server side not client side You can use onClientPlayerJoin oops typo lol
Walid Posted October 9, 2016 Posted October 9, 2016 7 minutes ago, Turbo777 said: onClientPlayerJoin is show word for 1ms and hide, why? Put the dxDrawText inside "onClientRender" event and use setTimer to hide the player name.
Turbe$Z Posted October 9, 2016 Author Posted October 9, 2016 9 minutes ago, Turbo777 said: onClientPlayerJoin is show word for 1ms and hide, why? why hide?
Walid Posted October 9, 2016 Posted October 9, 2016 1 minute ago, Turbo777 said: why hide? Read the last post 2 minutes ago, Walid said: Put the dxDrawText inside "onClientRender" event and use setTimer to hide the player name.
Turbe$Z Posted October 9, 2016 Author Posted October 9, 2016 local screenW, screenH = guiGetScreenSize() addEventHandler("onClientRender", root, function() dxDrawRectangle(screenW * 0.7951, screenH * 0.1944, screenW * 0.1979, screenH * 0.1033, tocolor(0, 0, 0, 131), false) end function greetPlayer() dxDrawText("#00baff" .. getPlayerName(source) .. " #FFffFFJött Kockulni!", 1151, 181, 1420, 202, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", true) end addEventHandler ( "onClientPlayerJoin", getRootElement(), greetPlayer ) ) why not working this?
Walid Posted October 9, 2016 Posted October 9, 2016 (edited) local screenW, screenH = guiGetScreenSize() addEventHandler("onClientRender", root, function() if joinedPlayerName then dxDrawRectangle(screenW * 0.7951, screenH * 0.1944, screenW * 0.1979, screenH * 0.1033, tocolor(0, 0, 0, 131), false) dxDrawText("#00baff" .. joinedPlayerName .. "#FFffFFJött Kockulni!", 1151, 181, 1420, 202, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, true, false) end end ) function greetPlayer ( ) joinedPlayerName = getPlayerName (source) setTimer ( function() joinedPlayerName = nil end, 5000, 1 ) end addEventHandler ( "onClientPlayerJoin", getRootElement(), greetPlayer) Untested (i'm using the phone) Edited October 9, 2016 by Walid
Turbe$Z Posted October 9, 2016 Author Posted October 9, 2016 16 minutes ago, Walid said: local screenW, screenH = guiGetScreenSize() addEventHandler("onClientRender", root, function() if joinedPlayerName then dxDrawRectangle(screenW * 0.7951, screenH * 0.1944, screenW * 0.1979, screenH * 0.1033, tocolor(0, 0, 0, 131), false) dxDrawText("#00baff" .. joinedPlayerName .. "#FFffFFJött Kockulni!", 1151, 181, 1420, 202, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, true, false) end end ) function greetPlayer ( ) joinedPlayerName = getPlayerName (source) setTimer ( function() joinedPlayerName = nil end, 5000, 1 ) end addEventHandler ( "onClientPlayerJoin", getRootElement(), greetPlayer) Untested (i'm using the phone) working :DD but, how to add more lines?
Walid Posted October 9, 2016 Posted October 9, 2016 4 minutes ago, Turbo777 said: working :DD but, how to add more lines? use \n to insert a newline.
Turbe$Z Posted October 9, 2016 Author Posted October 9, 2016 12 minutes ago, Walid said: use \n to insert a newline. i know this, but this doesn't add new join message
Walid Posted October 9, 2016 Posted October 9, 2016 1 minute ago, Turbo777 said: i know this, but this doesn't add new join message You need to use tables
Turbe$Z Posted October 9, 2016 Author Posted October 9, 2016 11 minutes ago, Walid said: You need to use tables i tried but not good
Walid Posted October 9, 2016 Posted October 9, 2016 3 minutes ago, Turbo777 said: i tried but not good Donate 5$ to MTA (Click Me) and i will do it for you. or try to do it by yourself then post your code here.
Turbe$Z Posted October 9, 2016 Author Posted October 9, 2016 (edited) 21 minutes ago, Walid said: Donate 5$ to MTA (Click Me) and i will do it for you. or try to do it by yourself then post your code here. local screenW, screenH = guiGetScreenSize() addEventHandler("onClientRender", root, function() dxDrawRectangle(screenW * 0.7951, screenH * 0.1944, screenW * 0.1979, screenH * 0.1033, tocolor(0, 0, 0, 131), false) if join or asd then dxDrawText("#00baff" .. join .. " #FFffFFJött Kockulni!", 1151, 181, 1420, 202, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, true, false) dxDrawText("#00baff" .. quit .. " #DF6464Távozott!", 1151, 181, 1420, 202, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, true, false) elseif join1 or quit1 then dxDrawText("#00baff" .. join1 .. " #FFffFFJött Kockulni!", 1151, 201, 1430, 217, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, true, false) dxDrawText("#00baff" .. quit1 .. " #DF6464Távozott!", 1151, 201, 1430, 217, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, true, false) elseif join2 or quit2 then dxDrawText("#00baff" .. join2 .. " #FFffFFJött Kockulni!", 1151, 222, 1422, 239, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, true, false) dxDrawText("#00baff" .. quit2 .. " #DF6464Távozott!", 1151, 222, 1422, 239, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, true, false) end end ) function greetPlayer ( ) join = getPlayerName (source) join1 = getPlayerName (source) join2 = getPlayerName (source) --setTimer ( function() --joinedPlayerName = nil --end, 5000, 1 ) end addEventHandler ( "onClientPlayerJoin", getRootElement(), greetPlayer) function greetPlayer7 ( ) quit = getPlayerName (source) quit1 = getPlayerName (source) quit2 = getPlayerName (source) --setTimer ( function() --joinedPlayerName = nil --end, 5000, 1 ) end addEventHandler ( "onClientPlayerQuit", getRootElement(), greetPlayer7) i tried this but not good Edited October 9, 2016 by Turbo777
Walid Posted October 9, 2016 Posted October 9, 2016 2 minutes ago, Turbo777 said: i tried this but not good As i told you, you need to use Tables
Turbe$Z Posted October 9, 2016 Author Posted October 9, 2016 2 minutes ago, Walid said: As i told you, you need to use Tables what kind of table?
Walid Posted October 9, 2016 Posted October 9, 2016 (edited) All what you need is: (stop asking for ready codes) Functions: table.insert , table.remove , getTickCount , dxGetTextWidth , dxDrawText , getPlayerName , guiGetScreenSize . Events: onClientPlayerJoin ,onClientPlayerQuit ,onClientRender Edited October 9, 2016 by Walid
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