iFoReX Posted March 20, 2012 Posted March 20, 2012 please help me I dont know what are bad :c addEventHandler('onClientPlayerJoin', root, function() dxDrawText("'* ' .. getPlayerName(source) .. ' a entrado al server",504.0,4.0,574.0,20.0,tocolor(200,0,0,255),0.7,"sans","left","top",false,false,false) end ) addEventHandler('onClientPlayerChangeNick', root, function(oldNick, newNick) outputChatBox('* ' .. oldNick .. ' is now known as ' .. newNick, 255, 100, 100) end ) addEventHandler('onClientPlayerQuit', root, function(reason) dxDrawText("'* ' .. getPlayerName(source) .. ' a salido del server [' .. reason .. ']'",503.0,16.0,573.0,32.0,tocolor(0,0,255,170),0.7,"sans","left","top",false,false,false) end ) elMota/elFoReX De Vuelta En MTA *---------* Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3 https://www.youtube.com/user/KillersGPs
Castillo Posted March 20, 2012 Posted March 20, 2012 (edited) local messageJoin = "" local messageQuit = "" function renderPlayerJoined ( ) dxDrawText("* ".. messageJoin,504.0,4.0,574.0,20.0,tocolor(200,0,0,255),0.7,"sans","left","top",false,false,false) end function renderPlayerLeft ( ) dxDrawText("* ".. messageQuit,503.0,16.0,573.0,32.0,tocolor(0,0,255,170),0.7,"sans","left","top",false,false,false) end addEventHandler('onClientPlayerJoin', root, function() messageJoin = getPlayerName(source) .. " a entrado al servidor." addEventHandler ( "onClientRender", root, renderPlayerJoined ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, renderPlayerJoined ) end ,5000,1 ) end ) addEventHandler('onClientPlayerChangeNick', root, function(oldNick, newNick) outputChatBox('* ' .. oldNick .. ' is now known as ' .. newNick, 255, 100, 100) end ) addEventHandler('onClientPlayerQuit', root, function(reason) messageQuit = getPlayerName(source) .. " a salido del server [" .. reason .. "]" addEventHandler ( "onClientRender", root, renderPlayerLeft ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, renderPlayerLeft ) end ,5000,1 ) end ) Edited March 20, 2012 by Guest San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
drk Posted March 20, 2012 Posted March 20, 2012 local messageJoin = "" local messageQuit = "" function renderPlayerJoined ( ) dxDrawText("* ".. messageJoin,504.0,4.0,574.0,20.0,tocolor(200,0,0,255),0.7,"sans","left","top",false,false,false) end function renderPlayerLeft ( ) dxDrawText("* ".. messageQuit,503.0,16.0,573.0,32.0,tocolor(0,0,255,170),0.7,"sans","left","top",false,false,false) end addEventHandler('onClientPlayerJoin', root, function() messageJoin = getPlayerName(source) .. " a entrado al servidor." addEventHandler ( "onClientRender", root, renderPlayerJoin ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, renderPlayerJoin ) end ,5000,1, ) end ) addEventHandler('onClientPlayerChangeNick', root, function(oldNick, newNick) outputChatBox('* ' .. oldNick .. ' is now known as ' .. newNick, 255, 100, 100) end ) addEventHandler('onClientPlayerQuit', root, function(reason) messageQuit = getPlayerName(source) .. " a salido del server [" .. reason .. "]" addEventHandler ( "onClientRender", root, renderPlayerLeft ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, renderPlayerLeft ) end ,5000,1, ) end ) EPT Team Server Development: 0% Learning C++ | C++ is amazing
Castillo Posted March 20, 2012 Posted March 20, 2012 May I ask what did you change on my script? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
drk Posted March 20, 2012 Posted March 20, 2012 In onClientPlayerQuit event you wrote messageLeft instead of messageQuit. EPT Team Server Development: 0% Learning C++ | C++ is amazing
iFoReX Posted March 20, 2012 Author Posted March 20, 2012 thnx I go to test in my server elMota/elFoReX De Vuelta En MTA *---------* Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3 https://www.youtube.com/user/KillersGPs
Castillo Posted March 20, 2012 Posted March 20, 2012 In onClientPlayerQuit event you wrote messageLeft instead of messageQuit. Oh, I see, btw, you forgot to remove the extra commas in the timer(s). San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
iFoReX Posted March 20, 2012 Author Posted March 20, 2012 the dxtext dont appear only in chatbox elMota/elFoReX De Vuelta En MTA *---------* Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3 https://www.youtube.com/user/KillersGPs
Castillo Posted March 20, 2012 Posted March 20, 2012 Copy my code again. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
drk Posted March 20, 2012 Posted March 20, 2012 In onClientPlayerQuit event you wrote messageLeft instead of messageQuit. Oh, I see, btw, you forgot to remove the extra commas in the timer(s). you forgot to remove the extra commas in the timer(s). Where? LOL EPT Team Server Development: 0% Learning C++ | C++ is amazing
Castillo Posted March 20, 2012 Posted March 20, 2012 setTimer ( function ( ) removeEventHandler ( "onClientRender", root, renderPlayerJoin ) end ,5000,1, -- Here. ) If you run the script, you'll notice. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
drk Posted March 20, 2012 Posted March 20, 2012 I've not seen this, I have only changed the variable name EPT Team Server Development: 0% Learning C++ | C++ is amazing
iFoReX Posted March 20, 2012 Author Posted March 20, 2012 thnx man nice JoinQuit elMota/elFoReX De Vuelta En MTA *---------* Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3 https://www.youtube.com/user/KillersGPs
Castillo Posted March 20, 2012 Posted March 20, 2012 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
iFoReX Posted March 20, 2012 Author Posted March 20, 2012 and how I can do for the colorcodes dont appear ? elMota/elFoReX De Vuelta En MTA *---------* Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3 https://www.youtube.com/user/KillersGPs
drk Posted March 20, 2012 Posted March 20, 2012 Use the function dxDrawColorText. You can find this function in the forums EPT Team Server Development: 0% Learning C++ | C++ is amazing
iFoReX Posted March 21, 2012 Author Posted March 21, 2012 I dont find the function man :c elMota/elFoReX De Vuelta En MTA *---------* Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3 https://www.youtube.com/user/KillersGPs
drk Posted March 21, 2012 Posted March 21, 2012 viewtopic.php?f=91&t=40706&p=413114&hilit=dxDrawColorText#p413114 EPT Team Server Development: 0% Learning C++ | C++ is amazing
iFoReX Posted March 21, 2012 Author Posted March 21, 2012 I do this ? function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, left, top, clip, wordbreak, postGUI) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font ) ax = ax + w color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end last = e + 1 s, e, cap, col = str:find( pat, last ) end if last <= #str then cap = str:sub( last ) local w = dxGetTextWidth( cap, scale, font ) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font, left, top, clip, wordbreak, postGUI ) end end local messageJoin = "" local messageQuit = "" function renderPlayerJoined ( ) dxDrawText("* ".. messageJoin,504.0,4.0,574.0,20.0,tocolor(200,0,0,255),0.7,"sans","left","top",false,false,false) end function renderPlayerLeft ( ) dxDrawText("* ".. messageQuit,503.0,16.0,573.0,32.0,tocolor(0,0,255,170),0.7,"sans","left","top",false,false,false) end addEventHandler('onClientPlayerJoin', root, function() messageJoin = getPlayerName(source) .. " a entrado al servidor." addEventHandler ( "onClientRender", root, renderPlayerJoined ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, renderPlayerJoined ) end ,6000,1 ) end ) addEventHandler('onClientPlayerChangeNick', root, function(oldNick, newNick) outputChatBox('* ' .. oldNick .. ' is now known as ' .. newNick, 255, 100, 100) end ) addEventHandler('onClientPlayerQuit', root, function(reason) messageQuit = getPlayerName(source) .. " a salido del server [" .. reason .. "]" addEventHandler ( "onClientRender", root, renderPlayerLeft ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, renderPlayerLeft ) end ,6000,1 ) end ) ? elMota/elFoReX De Vuelta En MTA *---------* Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3 https://www.youtube.com/user/KillersGPs
drk Posted March 21, 2012 Posted March 21, 2012 LOL function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, left, top, clip, wordbreak, postGUI) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font ) ax = ax + w color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end last = e + 1 s, e, cap, col = str:find( pat, last ) end if last <= #str then cap = str:sub( last ) local w = dxGetTextWidth( cap, scale, font ) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font, left, top, clip, wordbreak, postGUI ) end end local messageJoin = "" local messageQuit = "" function renderPlayerJoined ( ) dxDrawColorText("* ".. messageJoin,504.0,4.0,574.0,20.0,tocolor(200,0,0,255),0.7,"sans","left","top",false,false,false) end function renderPlayerLeft ( ) dxDrawColorText("* ".. messageQuit,503.0,16.0,573.0,32.0,tocolor(0,0,255,170),0.7,"sans","left","top",false,false,false) end addEventHandler('onClientPlayerJoin', root, function() messageJoin = getPlayerName(source) .. " #ffffffa entrado al servidor." addEventHandler ( "onClientRender", root, renderPlayerJoined ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, renderPlayerJoined ) end ,6000,1 ) end ) addEventHandler('onClientPlayerChangeNick', root, function(oldNick, newNick) outputChatBox('* ' .. oldNick .. ' #ffffffis now known as ' .. newNick, 255, 100, 100) end ) addEventHandler('onClientPlayerQuit', root, function(reason) messageQuit = getPlayerName(source) .. " #ffffffa salido del server [" .. reason .. "]" addEventHandler ( "onClientRender", root, renderPlayerLeft ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, renderPlayerLeft ) end ,6000,1 ) end ) EPT Team Server Development: 0% Learning C++ | C++ is amazing
iFoReX Posted March 21, 2012 Author Posted March 21, 2012 thnx man sorry Im very nob elMota/elFoReX De Vuelta En MTA *---------* Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3 https://www.youtube.com/user/KillersGPs
drk Posted March 21, 2012 Posted March 21, 2012 No problem EPT Team Server Development: 0% Learning C++ | C++ is amazing
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