Jump to content

Recommended Posts

So, my problem is, that i made a GUI, and when it opens, it opens for all the players online and the setElementFrozen affects every player, etc.

The GUI is attached to markers, so when you enter the marker, the GUI pops up. But it pops up for everyone. If you're not in the ACL group, you're not allowed to use the GUI, so it closes, when you press a button and outputs a message that you're not allowed to use it.

I have the same problem with outputChatBox. The message appears for everyone.

So my question is, that how could is make the GUI appear and affect only the actual user, and the outputChatBox appear only for the player i want?

If you need the Scripts, just let me know and I'll instert it here.

Thanks for the help.

Edited by StormFighter
Expansion
  • Like 1
Link to comment
35 minutes ago, StormFighter said:

So, my problem is, that i made a GUI, and when it opens, it opens for all the players online and the setElementFrozen affects every player, etc.

The GUI is attached to markers, so when you enter the marker, the GUI pops up. But it pops up for everyone. If you're not in the ACL group, you're not allowed to use the GUI, so it closes, when you press a button and outputs a message that you're not allowed to use it.

I have the same problem with outputChatBox. The message appears for everyone.

So my question is, that how could is make the GUI appear and affect only the actual user, and the outputChatBox appear only for the player i want?

If you need the Scripts, just let me know and I'll instert it here.

Thanks for the help.

cp1 = createMarker(4914.28515625, 458.64270019531, 10.090900421143, "cylinder", 1, 0, 0, 0, 0)
cp2 = createMarker(4914.2919921875, 458.64190673828, 17.132400512695, "cylinder", 1, 0, 0, 0, 0)
cp3 = createMarker(4896.943359375, 458.64270019531, 10.090900421143, "cylinder", 1, 0, 0, 0, 0)
cp4 = createMarker(4896.9321289063, 458.64190673828, 17.132400512695, "cylinder", 1, 0, 0, 0, 0)
cp5 = createMarker(4891.5668945313, 497.73672485352, 17.0546875, "cylinder", 1, 0, 0, 0, 0)
cp6 = createMarker(4891.5668945313, 497.73672485352, 10.044687271118, "cylinder", 1, 0, 0, 0, 0)

CLIENT SIDE
GUIEditor = {
    button = {},
    staticimage = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
local screenW, screenH = guiGetScreenSize()
        GUIEditor.staticimage[1] = guiCreateWindow((screenW - 149) / 2, (screenH - 246) / 2, 149, 246, "Panel", false)

        gomb2 = guiCreateButton(10, 10, 127, 107, "Fel", false, GUIEditor.staticimage[1])

        gomb1 = guiCreateButton(10, 127, 127, 107, "Le", false, GUIEditor.staticimage[1])
        
        guiSetVisible(GUIEditor.staticimage[1], false)
    end
)

function ShowGui()
local Show = guiSetVisible(GUIEditor.staticimage[1], true)
setTimer(function()
setElementFrozen(getLocalPlayer(), true)
end, 100, 1)
showCursor(true)
end
addEventHandler("onClientMarkerHit", cp1, ShowGui)
addEventHandler("onClientMarkerHit", cp2, ShowGui)
addEventHandler("onClientMarkerHit", cp3, ShowGui)
addEventHandler("onClientMarkerHit", cp4, ShowGui)
addEventHandler("onClientMarkerHit", cp5, ShowGui)
addEventHandler("onClientMarkerHit", cp6, ShowGui)

function HideGui()
local Hide = guiSetVisible(GUIEditor.staticimage[1], false)
showCursor(false)
end
addEventHandler("onClientMarkerLeave", cp1, HideGui)
addEventHandler("onClientMarkerLeave", cp2, HideGui)
addEventHandler("onClientMarkerLeave", cp3, HideGui)
addEventHandler("onClientMarkerLeave", cp4, HideGui)
addEventHandler("onClientMarkerLeave", cp5, HideGui)
addEventHandler("onClientMarkerLeave", cp6, HideGui)

function Button()
    if isElementWithinMarker(getLocalPlayer(), cp1 or cp2) or isElementWithinMarker(getLocalPlayer(), cp3 or cp4)==true then
        if source==gomb1 then
        triggerServerEvent("lift1le", getRootElement())
        guiSetVisible(GUIEditor.staticimage[1], false)
        setElementFrozen(getLocalPlayer(), false)
        showCursor(false)
        end
    elseif isElementWithinMarker(getLocalPlayer(), cp5 or cp6)==true then
        if source==gomb1 then
        triggerServerEvent("lift2le", getRootElement())
        guiSetVisible(GUIEditor.staticimage[1], false)
        setElementFrozen(getLocalPlayer(), false)
        showCursor(false)
        end
    end
end
addEventHandler("onClientGUIClick", getRootElement(), Button)

local function SecButton()
    if isElementWithinMarker(getLocalPlayer(), cp1 or cp2) or isElementWithinMarker(getLocalPlayer(), cp3 or cp4)==true then    
        if source==gomb2 then
        triggerServerEvent("lift1fel", getRootElement())
        guiSetVisible(GUIEditor.staticimage[1], false)
        setElementFrozen(getLocalPlayer(), false)
        showCursor(false)
        end
    elseif isElementWithinMarker(getLocalPlayer(), cp5 or cp6)==true then
        if source==gomb2 then
        triggerServerEvent("lift2fel", getRootElement())
        guiSetVisible(GUIEditor.staticimage[1], false)
        setElementFrozen(getLocalPlayer(), false)
        showCursor(false)
        end
    end
end
addEventHandler("onClientGUIClick", getRootElement(), SecButton)

function errormsg()
outputChatBox("Nem vagy erre jogosult", client)
end
addEvent("nono", true)
addEventHandler("nono", getRootElement(), errormsg)

SERVER SIDE

 

elevator = createObject(3115, 4905.5927734375, 464.69729614258, 15.79759979248, 0, 0, 90)
elevator2 = createObject(3114, 4890.4399414063, 506.95001220703, 15.529999732971, 0, 0, 90)

function lift1down()
object = getAccountName(getPlayerAccount(client))
check = isObjectInACLGroup("user."..object, aclGetGroup("BaseACL"))
    if check==true then
    moveObject(elevator, 5000, 4905.5927734375, 464.69729614258, 8.7557001113892, 0, 0, 0)
    else
    triggerClientEvent("nono", getRootElement())
    end
end
addEvent("lift1le", true)
addEventHandler("lift1le", getRootElement(), lift1down)
addCommandHandler("teszt", lift1down)

function lift1up()
object = getAccountName(getPlayerAccount(client))
check = isObjectInACLGroup("user."..object, aclGetGroup("BaseACL"))
    if check==true then
    moveObject(elevator, 5000, 4905.5927734375, 464.69729614258, 15.79759979248, 0, 0, 0)
    else
    triggerClientEvent("nono", getRootElement())
    end
end
addEvent("lift1fel", true)
addEventHandler("lift1fel", getRootElement(), lift1up)
addCommandHandler("teszt2", lift1up)

function lift2down()
object = getAccountName(getPlayerAccount(client))
check = isObjectInACLGroup("user."..object, aclGetGroup("BaseACL"))
    if check==true then
    moveObject(elevator2, 5000, 4890.4399414063, 506.95001220703, 8.4899997711182, 0, 0, 0)
    else
    triggerClientEvent("nono", getRootElement())
    end
end
addEvent("lift2le", true)
addEventHandler("lift2le", getRootElement(), lift2down)
addCommandHandler("teszt3", lift2down)

function lift2up()
object = getAccountName(getPlayerAccount(client))
check = isObjectInACLGroup("user."..object, aclGetGroup("BaseACL"))
    if check==true then
    moveObject(elevator2, 5000,4890.4399414063, 506.95001220703, 15.529999732971, 0, 0, 0)
    else
    triggerClientEvent("nono", getRootElement())
    end
end
addEvent("lift2fel", true)
addEventHandler("lift2fel", getRootElement(), lift2up)
addCommandHandler("teszt4", lift2up)

 

Quote

 

  • Like 1
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...