Jump to content

[HELP] Gui visible


Seba500PLK

Recommended Posts

Posted

Hi, how to do just admin to see button in the gui. Help Please

  
--My Client  
function shopInterface5() 
  
local screenWidth, screenHeight = guiGetScreenSize() 
window1baza5 = guiCreateWindow(screenWidth * 0.24, screenHeight * 0.2, 771, 457, "Base", false) 
guiWindowSetSizable(window1baza5, false) 
guiSetVisible(window1baza5,false) 
  
baza5button4 = guiCreateButton(10, 255, 246, 78, "Add", false, window1baza5) 
guiSetFont(baza5button4, "sa-header") 
guiSetProperty(baza5button4, "NormalTextColour", "FF33DFEF") 
  
end 
addEventHandler("onClientResourceStart", resourceRoot, shopInterface5) 
  
function toggleGUI2() 
    if guiGetVisible(baza5button4) == true then 
        guiSetVisible(baza5button4,false) 
  
    else 
        guiSetVisible(baza5button4,true) 
  
  
    end 
end 
addEvent("toggleGUI2",true) 
addEventHandler("toggleGUI2",root,toggleGUI2) 
  

  
--My Server 
addEventHandler("onResourceStart",resourceRoot, 
function () 
    for index, player in ipairs(getElementsByType("player")) do 
        showGUI2(player) 
    end 
end) 
  
function showGUI2(thePlayer) 
    if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("Baza4A")) then 
        triggerClientEvent(thePlayer,"toggleGUI2",thePlayer) 
    end 
end 
  
  

Posted

/debugscript 3

or:

  
  
--My Server 
addEventHandler("onResourceStart",resourceRoot, 
function () 
    for index, player in ipairs(getElementsByType("player")) do 
        showGUI2(player) 
    end 
end) 
  
function showGUI2(thePlayer) 
    if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("Admin")) then 
        triggerClientEvent(thePlayer,"toggleGUI2",thePlayer) 
    end 
end 
  

Only for Admin ACL.

Posted
Bad argument @ 'isObjectInACLGroup' [Expected acl-group at argument 2, got boolean]

Which means 'aclGetGroup' couldn't find any ACL Group with that name. Which means the group doesn't exists.

Posted

ok, something I did:

  
--Server 
function toggleGUI22 (thePlayer) 
  
    if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("Baza1A")) then 
        triggerClientEvent(thePlayer,"toggleGUI222",getRootElement(),thePlayer) 
    end 
end 
addEventHandler( "onMarkerHit", marker1, toggleGUI22 ) 
addEventHandler("onResourceStart",resourceRoot, toggleGUI22) 
  

  
--Client 
function toggleGUI2() 
  
        guiSetVisible(button4baza1,false) 
  
end 
addEvent("toggleGUI222",true) 
addEventHandler("toggleGUI222",root,toggleGUI2) 
  

everything works except:

if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("Baza1A")) then 

not know what's going on

[2014-08-21 11:14:15] ERROR: [DayZ-MTA]/baza1marker2/baza1marker2s.lua:195: attempt to concatenate a boolean value

[2014-08-21 11:14:15] WARNING: [DayZ-MTA]/baza1marker2/baza1marker2s.lua:195: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean]

[2014-08-21 11:14:15] WARNING: [DayZ-MTA]/baza1marker2/baza1marker2s.lua:195: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got resource-data]

Line 195 is: if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("Baza1A")) then

Posted

Event 'onResourceStart' triggers no player with it, so that is why the 'getPlayerAccount' failed and so, gave an error. Event 'onMarkerHit' gives every element which hits the marker, and so if it is not a player, 'getPlayerAccount' will fail.

Instead of using event 'onMarkerHit' it's easier to use 'onPlayerMarkerHit'. Note with this event the 'source' is the player.

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