golanu21 Posted March 23, 2013 Share Posted March 23, 2013 local Key = "0" -- this is the key client Side --start window addEvent("GUI", true) function caine () guiSetVisible(fereastra, true) showCursor(true) guiLabelSetColor(GUIEditor.label[5],math.random(0, 255), math.random(0, 255), math.random(0, 255)) end addEventHandler("GUI", root, caine) bindKey("Key","down", caine) server side --adminsOnly addEventHandler( 'onPlayerLogin', root, function( ) if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( "Admin" ) ) then triggerClientEvent(source, "GUI", source) else outputChatBox("You are not an admin") end end ) no errors in debugscript don't work [14:13:07] WARNING: Gamemode\vehicles\server.lua:4: Bad argument @ 'getAccountName' [Expected account at argument 1, got nil] [14:13:07] ERROR: Gamemode\vehicles\server.lua:4: attempt to concatenate a boolean value Link to comment
Sasu Posted March 23, 2013 Share Posted March 23, 2013 if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount(source) ), aclGetGroup( "Admin" ) ) then Link to comment
golanu21 Posted March 23, 2013 Author Share Posted March 23, 2013 work for Everyone , and when i login as admin : outputChatBox("You are not an admin") Link to comment
Ab-47 Posted March 23, 2013 Share Posted March 23, 2013 try adding this to your server side: local acc = getAccountName(getPlayerAccount(source)) Link to comment
golanu21 Posted March 23, 2013 Author Share Posted March 23, 2013 try adding this to your server side: local acc = getAccountName(getPlayerAccount(source)) work for Everyone , and when i login as admin : outputChatBox("You are not an admin") Link to comment
iPrestege Posted March 23, 2013 Share Posted March 23, 2013 -- Client -- bindKey (Key, "down", function() if getElementData( localPlayer, 'Show_GUI') ~= nil then guiSetVisible(fereastra, not guiGetVisible(fereastra)) showCursor(guiGetVisible(fereastra)) end end ) addEvent( 'LogOutSetVisible', true ) addEventHandler( 'LogOutSetVisible', root, function() if guiGetVisible(fereastra) then guiSetVisible( fereastra, false ) showCursor( false ) end end ) -- Server -- addEventHandler ( "onResourceStart", resourceRoot, function ( ) for i, player in ipairs( getElementsByType( 'player' ) ) do if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( "allowedGroup" ) ) then setElementData( player, 'Show_GUI', true) else setElementData( player, 'Show_GUI', nil) end end end ) addEventHandler( 'onPlayerJoin', root, function() setElementData( source, 'Show_GUI', nil) end ) addEventHandler( 'onPlayerLogin', root, function( _, acc ) if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( allowedGroup ) ) then setElementData( source, 'Show_GUI', true) else setElementData( source, 'Show_GUI', nil) end end ) addEventHandler( 'onPlayerLogout', root, function( _, acc ) triggerClientEvent( source, 'LogOutSetVisible', root) setElementData( source, 'Show_GUI', nil) end ) Try it -_-" Link to comment
GTX Posted March 23, 2013 Share Posted March 23, 2013 --adminsOnly addEventHandler( 'onPlayerLogin', root, function( _, acc ) if isObjectInACLGroup( 'user.'..acc, aclGetGroup( "Admin" ) ) then triggerClientEvent(source, "GUI", source) else outputChatBox("You are not an admin", source) end end ) Link to comment
PaiN^ Posted March 23, 2013 Share Posted March 23, 2013 --adminsOnly addEventHandler( 'onPlayerLogin', root, function( _, acc ) if isObjectInACLGroup( 'user.'..acc, aclGetGroup( "Admin" ) ) then triggerClientEvent(source, "GUI", source) else outputChatBox("You are not an admin", source) end end ) addEventHandler( 'onPlayerLogin', root, function( _, acc ) if isObjectInACLGroup( 'user.'..getAccountName ( acc ), aclGetGroup( "Admin" ) ) then triggerClientEvent(source, "GUI", source) else outputChatBox("You are not an admin", source) end end ) NOTE : this will make the GUI appear to an Admin when he loges in !, Better use Mr.Pres[T]ege code .. Link to comment
iPrestege Posted March 23, 2013 Share Posted March 23, 2013 My code will check much time and better than login . Link to comment
golanu21 Posted March 23, 2013 Author Share Posted March 23, 2013 -- Client -- bindKey (Key, "down", function() if getElementData( localPlayer, 'Show_GUI') ~= nil then guiSetVisible(fereastra, not guiGetVisible(fereastra)) showCursor(guiGetVisible(fereastra)) end end ) addEvent( 'LogOutSetVisible', true ) addEventHandler( 'LogOutSetVisible', root, function() if guiGetVisible(fereastra) then guiSetVisible( fereastra, false ) showCursor( false ) end end ) -- Server -- addEventHandler ( "onResourceStart", resourceRoot, function ( ) for i, player in ipairs( getElementsByType( 'player' ) ) do if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( "allowedGroup" ) ) then setElementData( player, 'Show_GUI', true) else setElementData( player, 'Show_GUI', nil) end end end ) addEventHandler( 'onPlayerJoin', root, function() setElementData( source, 'Show_GUI', nil) end ) addEventHandler( 'onPlayerLogin', root, function( _, acc ) if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( allowedGroup ) ) then setElementData( source, 'Show_GUI', true) else setElementData( source, 'Show_GUI', nil) end end ) addEventHandler( 'onPlayerLogout', root, function( _, acc ) triggerClientEvent( source, 'LogOutSetVisible', root) setElementData( source, 'Show_GUI', nil) end ) Try it -_-" i use your code... but BAD ARGUMENT:20: @ aclGetGroup( allowedGroup ) -- SERVER SIDE Link to comment
PaiN^ Posted March 23, 2013 Share Posted March 23, 2013 Make it a string : ( 'allowedGroup' ) Link to comment
iPrestege Posted March 23, 2013 Share Posted March 23, 2013 Make it a string : ( 'allowedGroup' ) Sorry : addEventHandler ( "onResourceStart", resourceRoot, function ( ) for i, player in ipairs( getElementsByType( 'player' ) ) do if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( "Admin" ) ) then setElementData( player, 'Show_GUI', true) else setElementData( player, 'Show_GUI', nil) end end end ) addEventHandler( 'onPlayerJoin', root, function() setElementData( source, 'Show_GUI', nil) end ) addEventHandler( 'onPlayerLogin', root, function( _, acc ) if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( "Admin" ) ) then setElementData( source, 'Show_GUI', true) else setElementData( source, 'Show_GUI', nil) end end ) addEventHandler( 'onPlayerLogout', root, function( _, acc ) triggerClientEvent( source, 'LogOutSetVisible', root) setElementData( source, 'Show_GUI', nil) end ) Link to comment
golanu21 Posted March 23, 2013 Author Share Posted March 23, 2013 don't work, WTFFFF ?? :|, i Link to comment
iPrestege Posted March 23, 2013 Share Posted March 23, 2013 What? But work's with me ? post the gui and the server side for open the gui! and the client too Link to comment
golanu21 Posted March 23, 2013 Author Share Posted March 23, 2013 clientside --gui GUIEditor = { label = {}, } fereastra = guiCreateWindow(773, 239, 607, 576, "Admin Panel", false) guiWindowSetSizable(fereastra, false) Close = guiCreateButton(415, 475, 183, 92, "Close", false, fereastra) guiSetProperty(Close, "NormalTextColour", "FFAAAAAA") pos = guiCreateGridList(9, 357, 239, 210, false, fereastra) poscol = guiGridListAddColumn(pos, "Posibilites", 0.9) kick = guiCreateGridList(10, 145, 238, 211, false, fereastra) guiGridListAddColumn(kick, "Kick Player", 0.9) kickbtn = guiCreateButton(248, 145, 124, 59, "Kick Him", false, fereastra) guiSetProperty(kick, "NormalTextColour", "FFAAAAAA") set = guiCreateButton(250, 427, 134, 59, "set", false, fereastra) guiSetProperty(set, "NormalTextColour", "FFAAAAAA") ban = guiCreateButton(248, 298, 124, 58, "Ban Him", false, fereastra) guiSetProperty(ban, "NormalTextColour", "FFAAAAAA") freeze = guiCreateButton(248, 204, 124, 94, "Freeze Him", false, fereastra) guiSetProperty(freeze, "NormalTextColour", "FFAAAAAA") vehicles = guiCreateGridList(379, 145, 219, 208, false, fereastra) guiGridListAddColumn(vehicles, "Vehicles", 0.9) giveveh = guiCreateButton(426, 356, 144, 55, "Give", false, fereastra) guiSetProperty(giveveh, "NormalTextColour", "FFAAAAAA") GUIEditor.label[1] = guiCreateLabel(9, 21, 36, 15, "Name:", false, fereastra) GUIEditor.label[2] = guiCreateLabel(10, 42, 39, 15, "Health:", false, fereastra) GUIEditor.label[3] = guiCreateLabel(10, 62, 44, 15, "Armour:", false, fereastra) GUIEditor.label[5] = guiCreateLabel(248, 50, 326, 57, "Admin Panel", false, fereastra) guiSetFont(GUIEditor.label[5], "sa-header") guiLabelSetColor(GUIEditor.label[5], 0, 0, 0) numele = guiCreateLabel(46, 21, 120, 15, "", false, fereastra) viata = guiCreateLabel(49, 42, 117, 15, "", false, fereastra) armura = guiCreateLabel(59, 62, 114, 15, "", false, fereastra) guiSetVisible(fereastra, false ) -- Script -- --close button addEventHandler("onClientGUIClick",Close, function () guiSetVisible(fereastra, false ) showCursor(false) end ) --start window bindKey ("0", "down", function() if getElementData( localPlayer, 'Show_GUI') ~= nil then guiSetVisible(fereastra, not guiGetVisible(fereastra)) showCursor(guiGetVisible(fereastra)) end end ) addEvent( 'LogOutSetVisible', true ) addEventHandler( 'LogOutSetVisible', root, function() if guiGetVisible(fereastra) then guiSetVisible( fereastra, false ) showCursor( false ) end end ) serverside --adminsOnly addEventHandler ( "onResourceStart", resourceRoot, function ( ) for i, player in ipairs( getElementsByType( 'player' ) ) do if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( "Admin" ) ) then setElementData( player, 'Show_GUI', true) else setElementData( player, 'Show_GUI', nil) end end end ) addEventHandler( 'onPlayerJoin', root, function() setElementData( source, 'Show_GUI', nil) end ) addEventHandler( 'onPlayerLogin', root, function( _, acc ) if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( "Admin" ) ) then setElementData( source, 'Show_GUI', true) else setElementData( source, 'Show_GUI', nil) end end ) addEventHandler( 'onPlayerLogout', root, function( _, acc ) triggerClientEvent( source, 'LogOutSetVisible', root) setElementData( source, 'Show_GUI', nil) end ) Link to comment
Castillo Posted March 23, 2013 Share Posted March 23, 2013 addEventHandler( 'onPlayerJoin', root, function() setElementData( source, 'Show_GUI', nil) end ) That part is useless, the data will be already "nil". Link to comment
golanu21 Posted March 23, 2013 Author Share Posted March 23, 2013 and i need to delete it ? Link to comment
Castillo Posted March 23, 2013 Share Posted March 23, 2013 As I said, is useless, so remove it. Link to comment
golanu21 Posted March 23, 2013 Author Share Posted March 23, 2013 i remove it... and don't work , Link to comment
iPrestege Posted March 23, 2013 Share Posted March 23, 2013 -- Server -- --adminsOnly addEventHandler ( "onResourceStart", resourceRoot, function ( ) for i, player in ipairs( getElementsByType( 'player' ) ) do if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( "Admin" ) ) then setElementData( player, 'Show_GUI', true) else setElementData( player, 'Show_GUI', nil) end end end ) addEventHandler( 'onPlayerLogin', root, function( _, acc ) if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( "Admin" ) ) then setElementData( source, 'Show_GUI', true) else setElementData( source, 'Show_GUI', nil) end end ) addEventHandler( 'onPlayerLogout', root, function( _, acc ) triggerClientEvent( source, 'LogOutSetVisible', root) setElementData( source, 'Show_GUI', nil) end ) -- Client -- --gui GUIEditor = { label = {}, } fereastra = guiCreateWindow(773, 239, 607, 576, "Admin Panel", false) guiWindowSetSizable(fereastra, false) Close = guiCreateButton(415, 475, 183, 92, "Close", false, fereastra) guiSetProperty(Close, "NormalTextColour", "FFAAAAAA") pos = guiCreateGridList(9, 357, 239, 210, false, fereastra) poscol = guiGridListAddColumn(pos, "Posibilites", 0.9) kick = guiCreateGridList(10, 145, 238, 211, false, fereastra) guiGridListAddColumn(kick, "Kick Player", 0.9) kickbtn = guiCreateButton(248, 145, 124, 59, "Kick Him", false, fereastra) guiSetProperty(kick, "NormalTextColour", "FFAAAAAA") set = guiCreateButton(250, 427, 134, 59, "set", false, fereastra) guiSetProperty(set, "NormalTextColour", "FFAAAAAA") ban = guiCreateButton(248, 298, 124, 58, "Ban Him", false, fereastra) guiSetProperty(ban, "NormalTextColour", "FFAAAAAA") freeze = guiCreateButton(248, 204, 124, 94, "Freeze Him", false, fereastra) guiSetProperty(freeze, "NormalTextColour", "FFAAAAAA") vehicles = guiCreateGridList(379, 145, 219, 208, false, fereastra) guiGridListAddColumn(vehicles, "Vehicles", 0.9) giveveh = guiCreateButton(426, 356, 144, 55, "Give", false, fereastra) guiSetProperty(giveveh, "NormalTextColour", "FFAAAAAA") GUIEditor.label[1] = guiCreateLabel(9, 21, 36, 15, "Name:", false, fereastra) GUIEditor.label[2] = guiCreateLabel(10, 42, 39, 15, "Health:", false, fereastra) GUIEditor.label[3] = guiCreateLabel(10, 62, 44, 15, "Armour:", false, fereastra) GUIEditor.label[5] = guiCreateLabel(248, 50, 326, 57, "Admin Panel", false, fereastra) guiSetFont(GUIEditor.label[5], "sa-header") guiLabelSetColor(GUIEditor.label[5], 0, 0, 0) numele = guiCreateLabel(46, 21, 120, 15, "", false, fereastra) viata = guiCreateLabel(49, 42, 117, 15, "", false, fereastra) armura = guiCreateLabel(59, 62, 114, 15, "", false, fereastra) guiSetVisible(fereastra, false ) -- Script -- --close button addEventHandler("onClientGUIClick",Close, function () guiSetVisible(fereastra, false ) showCursor(false) end ) --start window bindKey ("0", "down", function() if getElementData( localPlayer, 'Show_GUI') ~= nil then guiSetVisible(fereastra, not guiGetVisible(fereastra)) showCursor(guiGetVisible(fereastra)) end end ) addEvent( 'LogOutSetVisible', true ) addEventHandler( 'LogOutSetVisible', root, function() if guiGetVisible(fereastra) then guiSetVisible( fereastra, false ) showCursor( false ) end end ) Press number 0 and work Link to comment
iPrestege Posted March 23, 2013 Share Posted March 23, 2013 Post the fuck meta! i just test it and work with me what's the problem! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now