Jump to content

ped immortality and the question


Matevsz

Recommended Posts

Hi, how do to pad was immortal and you could not overthrow him, and object?

And my question is how to make the gui opened after the entry into the marker and the person has to be in a group that gives Admin ACL

function Job(thePlayer) 
Police=createTeam("Police", 214, 121, 22) 
local playerName = getAccountName(getPlayerName(thePlayer)) 
if isObjectInACLGroup("user."..PlayerName,aclGetGroup("Police")) then 
if isElementWithinMarker then 
showCursor(true) 
guiSetVisible(GUIEditor.window[1], true) 
end 
end 
addCommandHandler("Police", Job) 

doesn't work

Link to comment

You need to use client-side scripting to create the GUI of-course.

On the server side, create a marker, and in onMarkerHit check to see if the player is in the Admin ACL group with isObjectInACLGroup (see wiki for an example), and if they are trigger a client event (triggerClientEvent). On the client side, then you need to add the event, and handle it with a function that sets the GUI visibility to true.

Link to comment

Server side:

addEventHandler("onResourceStart", "onMarkerHit", marker, resourceRoot, 
function() 
    for i, player in ipairs(getElementsByType("player")) do 
        if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("DJ")) then 
            if isElementWithInMarker("player") then 
                setElementData(player, "Show_GUI", true) 
        else 
                setElementData(player, "Show_GUI", nil) 
            end 
        end 
    end 
end 
) 
  
  
  
addEventHandler("onPlayerLogin", root, function(_, acc) 
    if isObjectInACLGroup("user."..getAccountName(acc), aclGetGroup("DJ")) then 
        setElementData(source, "Show_GUI", true) 
    else 
        setElementData(source, "Show_GUI", nil) 
    end 
end 
) 
addEventHandler("onPlayerLogout", root, function(_, acc) 
    tiggerClientEvent(source, "LogOutSetVisible", root) 
    setElementData(source, "Show_GUI", nil) 
end 
) 

Client side:

GUIEditor = { 
    button = {}, 
    window = {}, 
    label = {}, 
    memo = {}, 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(242, 216, 1224, 670, "DjPanel By Matevsz", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
  
        GUIEditor.button[1] = guiCreateButton(22, 39, 360, 32, "Wlacz dym", false, GUIEditor.window[1]) 
        GUIEditor.button[2] = guiCreateButton(23, 93, 359, 34, "Wylacz dym", false, GUIEditor.window[1]) 
        GUIEditor.memo[1] = guiCreateMemo(23, 179, 359, 32, "", false, GUIEditor.window[1]) 
        GUIEditor.label[1] = guiCreateLabel(81, 159, 253, 15, "Wpisz tekst, ktory bedzie pokazany na scianie", false, GUIEditor.window[1]) 
        GUIEditor.browser[1] = guiCreateBrowser(396, 39, 810, 609, "", false, GUIEditor.window[1]) 
        GUIEditor.button[3] = guiCreateButton(13, 624, 108, 34, "Zamknij", false, GUIEditor.window[1]) 
        GUIEditor.button[4] = guiCreateButton(91, 228, 222, 29, "Pokaz tekst", false, GUIEditor.window[1]) 
        local theBrowser = guiGetBrowser(GUIEditor.browser[1]) 
        guiSetVisible(GUIEditor.window[1], false) 
end 
) 
addEventHandler("onClientBrowserCreated", theBrowser, 
    function() 
        loadBrowserURL(source, "https://www.youtube.com") 
end 
) 
end 
end 
  
function openGUI() 
    if getElementData(localPlayer, "Show_GUI") ~= nil then 
        guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
        showCursor(guiSetVisible(GUIEditor.window[1]) 
    end 
end 
) 
  
  
addEventHandler("onClientGUIClick", Zamknij, -- close GUI 
    function () 
        guiSetVisible(GUIEditor.window[1], false) 
        showCursor(false) 
    end 
) 
  
addEvent("LogOutSetVisible", true) 
addEventHandler("LogOutSetVisible", root, 
    function() 
        if guiGetVisible(GUIEditor.window[1]) then 
            guiSetVisible(GUIEditor.window[1], false) 
            showCursor(false) 
        end 
    end 
) 

if something is wrong please write

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