Jump to content

loggin admin


Sasu

Recommended Posts

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

State: Inactive

Posted

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 ?

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted
-------------------------------------------------------------------------------------------- 
--                              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.

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

Posted
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

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

State: Inactive

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

State: Inactive

Posted

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

Posted
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

Posted

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

Posted
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 

Posted
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

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

Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003

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

State: Inactive

Posted
Mabye the event is only triggered for the admin and not for all players?

And.... What should I do?

State: Inactive

Posted

What exactly are you trying to do?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

Posted

Try trigger the event for everyone [root].

Please do not PM me with scripting related question nor support, use the forums instead.

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

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

Posted

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.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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