Sasu Posted February 21, 2013 Share Posted February 21, 2013 -------------------------------------------------------------------------------------------- -- Scripting by Sasuke -- Server-Side -------------------------------------------------------------------------------------------- addEventHandler("onPlayerLogin", getRootElement(), function (p) for i,v in pairs(getElementsByType("player")) do local account = getPlayerAccount ( v ) if isObjectInACLGroup ( "user." .. getAccountName(account), aclGetGroup ( "Admin" ) ) then triggerClientEvent ( "admin",getRootElement() ) end end end ) -------------------------------------------------------------------------------------------- -- Scripting by Sasuke -- Client-Side -------------------------------------------------------------------------------------------- addEventHandler("onClientResourceStart", resourceRoot, function() end ) function logueoadmin( thePlayer ) dxDrawRectangle(417, 648, 461, 30, tocolor(5, 0, 5, 141), true) dxDrawText( getPlayerName( thePlayer ).." (Admin |Lv4|) Ha iniciado sesion", 422, 649, 845, 668, tocolor(200, 0, 0, 141), 1, "pricedown", "left", "top", false, false, true, false, false) end addEvent("admin", true) addEventHandler("admin", getRootElement(), logueoadmin) setTimer ( logueoadmin, 7000, 1 ) I have errors on debugscript 3: WARNING: logueo\admin_C.lua:9: Bad argument @ 'getPlayerName'[Expected player at argument 1, got nil] ERROR: logueo\admn_C.lua:9: attempt to concatenate a boolean value Thank you very much. Sorry for post. I learning scripter. Client side is dificult for me Link to comment
mjau Posted February 21, 2013 Share Posted February 21, 2013 The first error is that u are trying to use thePlayer parameter but u never passed it from the server side, Second, are u sure that error is on the client side ? Link to comment
DNL291 Posted February 21, 2013 Share Posted February 21, 2013 -------------------------------------------------------------------------------------------- -- Scripting by Sasuke -- Server-Side -------------------------------------------------------------------------------------------- addEventHandler("onPlayerLogin", getRootElement(), function () local account = getPlayerAccount(source) if isObjectInACLGroup ( "user." .. getAccountName(account), aclGetGroup ( "Admin" ) ) then triggerClientEvent ( source, "admin", source ) end end -------------------------------------------------------------------------------------------- -- Scripting by Sasuke -- Client-Side -------------------------------------------------------------------------------------------- function logueoadmin() dxDrawRectangle(417, 648, 461, 30, tocolor(5, 0, 5, 141), true) dxDrawText( getPlayerName(localPlayer).." (Admin |Lv4|) Ha iniciado sesion", 422, 649, 845, 668, tocolor(200, 0, 0, 141), 1, "pricedown", "left", "top", false, false, true, false, false) end addEventHandler("onClientRender", root, logueoadmin) addEvent("admin", true) addEventHandler("admin", getRootElement(), logueoadmin) Link to comment
Sasu Posted February 21, 2013 Author Share Posted February 21, 2013 -------------------------------------------------------------------------------------------- -- Scripting by Sasuke -- Server-Side -------------------------------------------------------------------------------------------- addEventHandler("onPlayerLogin", getRootElement(), function () local account = getPlayerAccount(source) if isObjectInACLGroup ( "user." .. getAccountName(account), aclGetGroup ( "Admin" ) ) then triggerClientEvent ( source, "admin", source ) end end -------------------------------------------------------------------------------------------- -- Scripting by Sasuke -- Client-Side -------------------------------------------------------------------------------------------- function logueoadmin() dxDrawRectangle(417, 648, 461, 30, tocolor(5, 0, 5, 141), true) dxDrawText( getPlayerName(localPlayer).." (Admin |Lv4|) Ha iniciado sesion", 422, 649, 845, 668, tocolor(200, 0, 0, 141), 1, "pricedown", "left", "top", false, false, true, false, false) end addEventHandler("onClientRender", root, logueoadmin) addEvent("admin", true) addEventHandler("admin", getRootElement(), logueoadmin) Thanks you for try but I forgot to say that I need dx appear for 7 seconds. Sorry for my english. Link to comment
Fury Posted February 21, 2013 Share Posted February 21, 2013 addEvent("admin", true) addEventHandler("admin", getRootElement(), function() addEventHandler("onClientRender", root, logueoadmin) setTimer(removeEventHandler,7000,1,root, logueoadmin) end) function logueoadmin() dxDrawRectangle(417, 648, 461, 30, tocolor(5, 0, 5, 141), true) dxDrawText( getPlayerName(localPlayer).." (Admin |Lv4|) Ha iniciado sesion", 422, 649, 845, 668, tocolor(200, 0, 0, 141), 1, "pricedown", "left", "top", false, false, true, false, false) end Link to comment
Sasu Posted February 21, 2013 Author Share Posted February 21, 2013 addEvent("admin", true) addEventHandler("admin", getRootElement(), function() addEventHandler("onClientRender", root, logueoadmin) setTimer(removeEventHandler,7000,1,root, logueoadmin) end) function logueoadmin() dxDrawRectangle(417, 648, 461, 30, tocolor(5, 0, 5, 141), true) dxDrawText( getPlayerName(localPlayer).." (Admin |Lv4|) Ha iniciado sesion", 422, 649, 845, 668, tocolor(200, 0, 0, 141), 1, "pricedown", "left", "top", false, false, true, false, false) end Thank you for try but It has an error on debugscript: WARNING: Bad argument @ 'removeEventHandler' [Expected string at argument 1, got root] Link to comment
Sasu Posted February 21, 2013 Author Share Posted February 21, 2013 addEvent("admin", true) addEventHandler("admin", getRootElement(), function() addEventHandler("onClientRender", root, logueoadmin) setTimer(removeEventHandler,7000,1,root, logueoadmin) end) function logueoadmin() dxDrawRectangle(417, 648, 461, 30, tocolor(5, 0, 5, 141), true) dxDrawText( getPlayerName(localPlayer).." (Admin |Lv4|) Ha iniciado sesion", 422, 649, 845, 668, tocolor(200, 0, 0, 141), 1, "pricedown", "left", "top", false, false, true, false, false) end Thank you for try but It has an error on debugscript: WARNING: Bad argument @ 'removeEventHandler' [Expected string at argument 1, got root] Link to comment
csiguusz Posted February 21, 2013 Share Posted February 21, 2013 try this: addEvent("admin", true) addEventHandler("admin", getRootElement(), function() addEventHandler("onClientRender", root, logueoadmin) setTimer(removeEventHandler,7000,1, "onClientRender", root, logueoadmin) end) function logueoadmin() dxDrawRectangle(417, 648, 461, 30, tocolor(5, 0, 5, 141), true) dxDrawText( getPlayerName(localPlayer).." (Admin |Lv4|) Ha iniciado sesion", 422, 649, 845, 668, tocolor(200, 0, 0, 141), 1, "pricedown", "left", "top", false, false, true, false, false) end Link to comment
Sasu Posted February 21, 2013 Author Share Posted February 21, 2013 try this: addEvent("admin", true) addEventHandler("admin", getRootElement(), function() addEventHandler("onClientRender", root, logueoadmin) setTimer(removeEventHandler,7000,1, "onClientRender", root, logueoadmin) end) function logueoadmin() dxDrawRectangle(417, 648, 461, 30, tocolor(5, 0, 5, 141), true) dxDrawText( getPlayerName(localPlayer).." (Admin |Lv4|) Ha iniciado sesion", 422, 649, 845, 668, tocolor(200, 0, 0, 141), 1, "pricedown", "left", "top", false, false, true, false, false) end WARNING: Bad argument @ 'removeEventHandler'[Expected function at argument 3, got nil] Link to comment
csiguusz Posted February 21, 2013 Share Posted February 21, 2013 Hm, strange error. But this should work addCommandHandler("ad", function() addEventHandler("onClientRender", root, logueoadmin) setTimer( function() removeEventHandler("onClientRender", root, logueoadmin) end,7000,1) end) function logueoadmin() dxDrawRectangle(417, 648, 461, 30, tocolor(5, 0, 5, 141), true) dxDrawText( getPlayerName(localPlayer).." (Admin |Lv4|) Ha iniciado sesion", 422, 649, 845, 668, tocolor(200, 0, 0, 141), 1, "pricedown", "left", "top", false, false, true, false, false) end Link to comment
Sasu Posted February 21, 2013 Author Share Posted February 21, 2013 Sorry, but I dont want to use a command to appear dx. But thank you for try. Link to comment
Baseplate Posted February 21, 2013 Share Posted February 21, 2013 addEvent("admin", true) addEventHandler("admin", getRootElement(), function() addEventHandler("onClientRender", root, logueoadmin) setTimer( function() removeEventHandler("onClientRender", root, logueoadmin) end,7000,1) end) function logueoadmin() dxDrawRectangle(417, 648, 461, 30, tocolor(5, 0, 5, 141), true) dxDrawText( getPlayerName(localPlayer).." (Admin |Lv4|) Ha iniciado sesion", 422, 649, 845, 668, tocolor(200, 0, 0, 141), 1, "pricedown", "left", "top", false, false, true, false, false) end Link to comment
Sasu Posted February 21, 2013 Author Share Posted February 21, 2013 addEvent("admin", true) addEventHandler("admin", getRootElement(), function() addEventHandler("onClientRender", root, logueoadmin) setTimer( function() removeEventHandler("onClientRender", root, logueoadmin) end,7000,1) end) function logueoadmin() dxDrawRectangle(417, 648, 461, 30, tocolor(5, 0, 5, 141), true) dxDrawText( getPlayerName(localPlayer).." (Admin |Lv4|) Ha iniciado sesion", 422, 649, 845, 668, tocolor(200, 0, 0, 141), 1, "pricedown", "left", "top", false, false, true, false, false) end Perfect Samer! It works. Thank all for try. Link to comment
Baseplate Posted February 21, 2013 Share Posted February 21, 2013 No problem. Thank others , cause I didn't do much. Link to comment
Sasu Posted February 21, 2013 Author Share Posted February 21, 2013 No problem.Thank others , cause I didn't do much. JAJAJA Thanks "ALL" Link to comment
csiguusz Posted February 21, 2013 Share Posted February 21, 2013 Sorry, but I dont want to use a command to appear dx. But thank you for try. Sorry... I made the command just for testing and then forgot to change it back before posting. Link to comment
Sasu Posted February 21, 2013 Author Share Posted February 21, 2013 Sorry, but I dont want to use a command to appear dx. But thank you for try. Sorry... I made the command just for testing and then forgot to change it back before posting. No problem.Thanks you very much. But I have a problem. Only the admin can see dxDrawText Any solution? Link to comment
csiguusz Posted February 21, 2013 Share Posted February 21, 2013 Mabye the event is only triggered for the admin and not for all players? Link to comment
Sasu Posted February 21, 2013 Author Share Posted February 21, 2013 Mabye the event is only triggered for the admin and not for all players? And.... What should I do? Link to comment
Castillo Posted February 21, 2013 Share Posted February 21, 2013 What exactly are you trying to do? Link to comment
Sasu Posted February 21, 2013 Author Share Posted February 21, 2013 What are you trying to do exactly? I am trying to do a script when an admin loggin appear dxDrawText for all players with admin's name. Link to comment
DNL291 Posted February 21, 2013 Share Posted February 21, 2013 Try trigger the event for everyone [root]. Link to comment
Castillo Posted February 21, 2013 Share Posted February 21, 2013 What are you trying to do exactly? I am trying to do a script when an admin loggin appear dxDrawText for all players with admin's name. Post your entire code, client and server. Link to comment
Sasu Posted February 21, 2013 Author Share Posted February 21, 2013 -------------------------------------------------------------------------------------------- -- Scripting by Sasuke -- Client-Side -------------------------------------------------------------------------------------------- addEvent("admin", true) addEventHandler("admin", getRootElement(), function() addEventHandler("onClientRender", getRootElement(), logueoadmin) setTimer( function() removeEventHandler("onClientRender", getRootElement(), logueoadmin) end,7000,1) end) function logueoadmin() dxDrawRectangle(417, 648, 500, 30, tocolor(0, 0, 0, 0), true) dxDrawText( getPlayerName(localPlayer).." (Admin |Lv4|) Ha iniciado Sesion!", 422, 649, 845, 668, tocolor(255, 255, 255, 255), 1, "pricedown", "left", "top", false, false, true, false, false) end -------------------------------------------------------------------------------------------- -- Scripting by Sasuke -- Server-Side -------------------------------------------------------------------------------------------- addEventHandler("onPlayerLogin", getRootElement(), function() local account = getPlayerAccount(source) if isObjectInACLGroup ( "user." .. getAccountName(account), aclGetGroup ( "Admin" ) ) then triggerClientEvent ( getRootElement(), "admin", getRootElement() ) end end ) Link to comment
Castillo Posted February 21, 2013 Share Posted February 21, 2013 Well, that's wrong, because it'll show the local player name, not the admin who logged. Try this: -- client side: -------------------------------------------------------------------------------------------- -- Scripting by Sasuke -- Client-Side -------------------------------------------------------------------------------------------- local adminName = "" addEvent ( "admin", true ) addEventHandler ( "admin", getRootElement(), function ( name ) adminName = name addEventHandler ( "onClientRender", getRootElement(), logueoadmin ) setTimer ( function ( ) removeEventHandler ( "onClientRender", getRootElement(), logueoadmin ) end ,7000, 1 ) end ) function logueoadmin ( ) dxDrawRectangle(417, 648, 500, 30, tocolor(0, 0, 0, 0), true) dxDrawText( adminName .." (Admin |Lv4|) Ha iniciado Sesion!", 422, 649, 845, 668, tocolor(255, 255, 255, 255), 1, "pricedown", "left", "top", false, false, true, false, false) end -- server side: -------------------------------------------------------------------------------------------- -- Scripting by Sasuke -- Server-Side -------------------------------------------------------------------------------------------- addEventHandler ( "onPlayerLogin", getRootElement(), function ( _, account ) if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( "Admin" ) ) then triggerClientEvent ( root, "admin", root, getPlayerName ( source ) ) end end ) 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