Jump to content

loggin admin


Sasu

Recommended Posts

-------------------------------------------------------------------------------------------- 
--                              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 :S

Link to comment
  • Moderators
-------------------------------------------------------------------------------------------- 
--                              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
-------------------------------------------------------------------------------------------- 
--                              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
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
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 :D but It has an error on debugscript:

WARNING: Bad argument @ 'removeEventHandler' [Expected string at argument 1, got root]

Link to comment
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 :D but It has an error on debugscript:

WARNING: Bad argument @ 'removeEventHandler' [Expected string at argument 1, got root]

Link to comment

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
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

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
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
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
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. ::oops:

No problem.Thanks you very much. But I have a problem. Only the admin can see dxDrawText :o Any solution?

Link to comment
-------------------------------------------------------------------------------------------- 
--                              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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...