Jump to content

A question .. [ = DoNe = ]


d43dr4

Recommended Posts

Hello everyone,

I have a question and i hope to find its answer

_ How to save a work on guieditor

_ Is it possible to create a window with buttons etc , to do same job of " Execute command handler " but out of admin panel and just opens for a specified player ( with serial )

I have to find a script that execute commands urgernt please

Thx guys

Edited by Guest
Link to comment

Thats not what i mean ,

You see the Resources TAB on admin panel, there is a client / server button , and something to write there

i delete it from admin panel cause they can crash server from it and for some other reasons

but i want it to open just for me as a lonely window

i have create the window but i cant save it with guieditor so please tell me how

Link to comment
Thats not what i mean ,

You see the Resources TAB on admin panel, there is a client / server button , and something to write there

i delete it from admin panel cause they can crash server from it and for some other reasons

but i want it to open just for me as a lonely window

i have create the window but i cant save it with guieditor so please tell me how

Just go into the admin resource en copy it out, make a new resource with that code and the functions. No need to remaKe all the functions.

Link to comment

Here's the windows code :

GUIEditor = { 
    edit = {}, 
    button = {}, 
    label = {}, 
    window = {}, 
} 
GUIEditor.window[1] = guiCreateWindow(417, 315, 482, 107, "Execute command handler", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
  
GUIEditor.button[2] = guiCreateButton(407, 47, 60, 22, "Client", false, GUIEditor.window[1]) 
GUIEditor.button[3] = guiCreateButton(407, 75, 60, 22, "Server", false, GUIEditor.window[1]) 
GUIEditor.label[1] = guiCreateLabel(10, 26, 329, 18, "Type your command here :", false, GUIEditor.window[1]) 
guiSetFont(GUIEditor.label[1], "clear-normal") 
  
GUIEditor.label[2] = guiCreateLabel(3, 22, 259, 25, "", false, GUIEditor.label[1]) 
  
GUIEditor.label[3] = guiCreateLabel(190, 26, 299, 19, "For advanced users only.", false, GUIEditor.window[1]) 
guiLabelSetColor(GUIEditor.label[3], 255, 0, 0) 
GUIEditor.edit[1] = guiCreateEdit(37, 54, 360, 31, "", false, GUIEditor.window[1]) 
GUIEditor.label[4] = guiCreateLabel(8, 60, 37, 25, "CMD:", false, GUIEditor.window[1]) 

Link to comment

Look guys, Got that window

    GUIEditor = { 
        edit = {}, 
        button = {}, 
        label = {}, 
        window = {}, 
    } 
    GUIEditor.window[1] = guiCreateWindow(417, 315, 482, 107, "Execute command handler", false) 
    guiWindowSetSizable(GUIEditor.window[1], false) 
    guiSetVisible(GUIEditor.window[1], false) 
      
    GUIEditor.button[2] = guiCreateButton(407, 47, 60, 22, "Client", false, GUIEditor.window[1]) 
    GUIEditor.button[3] = guiCreateButton(407, 75, 60, 22, "Server", false, GUIEditor.window[1]) 
    GUIEditor.label[1] = guiCreateLabel(10, 26, 329, 18, "Type your command here :", false, GUIEditor.window[1]) 
    guiSetFont(GUIEditor.label[1], "clear-normal") 
      
    GUIEditor.label[2] = guiCreateLabel(3, 22, 259, 25, "", false, GUIEditor.label[1]) 
      
    GUIEditor.label[3] = guiCreateLabel(190, 26, 299, 19, "For advanced users only.", false, GUIEditor.window[1]) 
    guiLabelSetColor(GUIEditor.label[3], 255, 0, 0) 
    GUIEditor.edit[1] = guiCreateEdit(37, 54, 360, 31, "", false, GUIEditor.window[1]) 
    GUIEditor.label[4] = guiCreateLabel(8, 60, 37, 25, "CMD:", false, GUIEditor.window[1]) 
      
      
    if getPlayerSerial() == "MY SERIAl" then 
        bindKey("F2", "down", 
        function() 
            guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
            showCursor(guiGetVisible(GUIEditor.window[1])) 
        end) 
    end 

How to link it with admin panel functions on admin_main.lua & admin_server.lua

Link to comment

Try this.

Client:

GUIEditor = { 
    edit = {}, 
    button = {}, 
    label = {}, 
    window = {}, 
} 
  
function window () 
    if not GUIEditor.window[1] then 
        GUIEditor.window[1] = guiCreateWindow(417, 315, 482, 107, "Execute command handler", false) 
        guiSetInputEnabled ( true ) 
        showCursor ( true ) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
          
        GUIEditor.button[2] = guiCreateButton(407, 47, 60, 22, "Client", false, GUIEditor.window[1]) 
        GUIEditor.button[3] = guiCreateButton(407, 75, 60, 22, "Server", false, GUIEditor.window[1]) 
        GUIEditor.label[1] = guiCreateLabel(10, 26, 329, 18, "Type your command here :", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[1], "clear-normal") 
          
        GUIEditor.label[2] = guiCreateLabel(3, 22, 259, 25, "", false, GUIEditor.label[1]) 
          
        GUIEditor.label[3] = guiCreateLabel(190, 26, 299, 19, "For advanced users only.", false, GUIEditor.window[1]) 
        guiLabelSetColor(GUIEditor.label[3], 255, 0, 0) 
        GUIEditor.edit[1] = guiCreateEdit(37, 54, 360, 31, "", false, GUIEditor.window[1]) 
        GUIEditor.label[4] = guiCreateLabel(8, 60, 37, 25, "CMD:", false, GUIEditor.window[1]) 
         
        addEventHandler ( "onClientGUIClick", GUIEditor.window[1], 
            function () 
                local text = guiGetText ( GUIEditor.edit[1] ) 
                if source == GUIEditor.button[2] and text ~= "" then 
                    local func = loadstring ( "return " .. text )() 
                    if isElement ( func ) then 
                        return_ = " Element [" .. getElementType ( func) .. "]" 
                        outputChatBox ( "Command executed! Result: " .. return_  , 10, 60, 255)  
                    else 
                        outputChatBox ( "Command executed! Result: " .. tostring ( func ) , 10, 60, 255)  
                    end  
                elseif source == GUIEditor.button[3] and text ~= "" then 
                    triggerServerEvent ( "runCommand", localPlayer , text ) 
                end 
            end ) 
         
        return 
    elseif guiGetVisible(GUIEditor.window[1]) then 
       guiSetVisible(GUIEditor.window[1], false) 
       showCursor ( false ) 
       guiSetInputEnabled ( false ) 
       return     
    end 
        guiSetInputEnabled ( true ) 
        showCursor ( true ) 
        guiSetVisible(GUIEditor.window[1], true) 
end 
  
 if getPlayerSerial() == "MY SERIAl" then 
    bindKey("F2", "down", 
    function() 
        window () 
    end) 
end  

Server:

addEvent ( "runCommand", true ) 
addEventHandler ( "runCommand", root,  
    function ( cmd ) 
        local func = loadstring ( "return " ..  cmd ) () 
        if isElement ( func ) then 
            return_ = " Element [" .. getElementType ( func ) .. "]" 
            outputChatBox ( "Command executed! Result: " .. return_  , source,  10, 60, 255)  
        else 
            outputChatBox ( "Command executed! Result: " .. tostring ( func ) , source, 10, 60, 255)  
        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...