Sasu Posted February 21, 2013 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 State: Inactive
mjau Posted February 21, 2013 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 ?
DNL291 Posted February 21, 2013 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) Please do not PM me with scripting related question nor support, use the forums instead.
Sasu Posted February 21, 2013 Author 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. State: Inactive
Fury Posted February 21, 2013 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 Destruction Derby
Sasu Posted February 21, 2013 Author 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] State: Inactive
Sasu Posted February 21, 2013 Author 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] State: Inactive
csiguusz Posted February 21, 2013 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 Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
Sasu Posted February 21, 2013 Author 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] State: Inactive
csiguusz Posted February 21, 2013 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 Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
Sasu Posted February 21, 2013 Author Posted February 21, 2013 Sorry, but I dont want to use a command to appear dx. But thank you for try. State: Inactive
Baseplate Posted February 21, 2013 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
Sasu Posted February 21, 2013 Author 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. State: Inactive
Baseplate Posted February 21, 2013 Posted February 21, 2013 No problem. Thank others , cause I didn't do much.
Sasu Posted February 21, 2013 Author Posted February 21, 2013 No problem.Thank others , cause I didn't do much. JAJAJA Thanks "ALL" State: Inactive
csiguusz Posted February 21, 2013 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. Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
Sasu Posted February 21, 2013 Author 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? State: Inactive
csiguusz Posted February 21, 2013 Posted February 21, 2013 Mabye the event is only triggered for the admin and not for all players? Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
Sasu Posted February 21, 2013 Author Posted February 21, 2013 Mabye the event is only triggered for the admin and not for all players? And.... What should I do? State: Inactive
Castillo Posted February 21, 2013 Posted February 21, 2013 What exactly are you trying to do? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Sasu Posted February 21, 2013 Author 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. State: Inactive
DNL291 Posted February 21, 2013 Posted February 21, 2013 Try trigger the event for everyone [root]. Please do not PM me with scripting related question nor support, use the forums instead.
Castillo Posted February 21, 2013 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. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Sasu Posted February 21, 2013 Author 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 ) State: Inactive
Castillo Posted February 21, 2013 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 ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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