golanu21 Posted March 22, 2013 Posted March 22, 2013 bindKey(Key,"down", function () guiSetVisible(fereastra,not guiGetVisible(fereastra)) showCursor(guiGetVisible(fereastra)) if ( guiGetVisible(fereastra) == true ) then guiLabelSetColor(GUIEditor.label[5],math.random(0, 255), math.random(0, 255), math.random(0, 255)) end end) how i make this to work for Admin in acl ? [Dev]BloWnRPG - We BloW the World [1%]
EstrategiaGTA Posted March 22, 2013 Posted March 22, 2013 What? Explain better, do you want to do it only for Admin or what?
golanu21 Posted March 22, 2013 Author Posted March 22, 2013 yes, only for admins [Dev]BloWnRPG - We BloW the World [1%]
EstrategiaGTA Posted March 22, 2013 Posted March 22, 2013 isObjectInACLGroup getAccountName getPlayerAccount aclGetGroup
golanu21 Posted March 22, 2013 Author Posted March 22, 2013 like this ?> bindKey(Key,"down", function (thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then guiSetVisible(fereastra,not guiGetVisible(fereastra)) showCursor(guiGetVisible(fereastra)) return end if ( guiGetVisible(fereastra) == true ) then guiLabelSetColor(GUIEditor.label[5],math.random(0, 255), math.random(0, 255), math.random(0, 255)) end end) [Dev]BloWnRPG - We BloW the World [1%]
EstrategiaGTA Posted March 22, 2013 Posted March 22, 2013 like this ?> bindKey(Key,"down", function (thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then guiSetVisible(fereastra,not guiGetVisible(fereastra)) showCursor(guiGetVisible(fereastra)) return end if ( guiGetVisible(fereastra) == true ) then guiLabelSetColor(GUIEditor.label[5],math.random(0, 255), math.random(0, 255), math.random(0, 255)) end end) Try it and post if It works or not.
iPrestege Posted March 22, 2013 Posted March 22, 2013 No it's not right u should to use triggerClientEvent isObject > server only!
golanu21 Posted March 22, 2013 Author Posted March 22, 2013 No it's not right u should to use triggerClientEvent isObject > server only! how [Dev]BloWnRPG - We BloW the World [1%]
X-SHADOW Posted March 22, 2013 Posted March 22, 2013 ---ClientSide addEvent('GUI', true) addEventHandler('GUI', root, bindKey(Key,"down", function () guiSetVisible(fereastra,not guiGetVisible(fereastra)) showCursor(guiGetVisible(fereastra)) if ( guiGetVisible(fereastra) == true ) then guiLabelSetColor(GUIEditor.label[5],math.random(0, 255), math.random(0, 255), math.random(0, 255)) end end )) ---ServerSide addEventHandler('onResourceStart', resourceRoot, function ( ) if isObjectInACLGroup('user.'..getAccountName(getPlayerAccount(source)),aclGetGroup('admin')) then triggerClientEvent(source, 'GUI', source) else outputChatBox('Your Not Admin', source, 255, 0, 0) end end ) i write it fast it should work . My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
golanu21 Posted March 22, 2013 Author Posted March 22, 2013 [22:19:35] WARNING: Gamemode\vehicles\server.lua:17: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean] [22:19:35] ERROR: Gamemode\vehicles\server.lua:17: attempt to concatenate a boolean value [Dev]BloWnRPG - We BloW the World [1%]
golanu21 Posted March 22, 2013 Author Posted March 22, 2013 [22:23:07] WARNING: Gamemode\vehicles\server.lua:17: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got resource-data] [22:23:07] WARNING: Gamemode\vehicles\server.lua:17: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean] [22:23:07] ERROR: Gamemode\vehicles\server.lua:18: attempt to concatenate local 'accName' (a boolean value) [Dev]BloWnRPG - We BloW the World [1%]
X-SHADOW Posted March 22, 2013 Posted March 22, 2013 ---ServerSide ----ServerSide addEventHandler('onResourceStart', resourceRoot, function(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then triggerClientEvent(thePlayer, 'GUI', thePlayer ) end end ) My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
golanu21 Posted March 22, 2013 Author Posted March 22, 2013 [22:29:32] WARNING: Gamemode\vehicles\server.lua:4: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got resource-data] [22:29:32] WARNING: Gamemode\vehicles\server.lua:4: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean] [22:29:32] ERROR: Gamemode\vehicles\server.lua:5: attempt to concatenate local 'accName' (a boolean value) [Dev]BloWnRPG - We BloW the World [1%]
iPrestege Posted March 22, 2013 Posted March 22, 2013 -- Client -- xShowPanelFunction_ = function () guiSetVisible(fereastra,not guiGetVisible(fereastra)); showCursor(guiGetVisible(fereastra)); if ( guiGetVisible(fereastra) == true ) then guiLabelSetColor(GUIEditor.label[5],math.random(0, 255), math.random(0, 255), math.random(0, 255)) end end bindKey(Key,"down",xShowPanelFunction_); addEventHandler("Show",root,xShowPanelFunction_); addEvent("Show",true); -- Server -- CheckAdminFunction_ = function ( ) if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Admin" ) ) then triggerClientEvent("Show",source); end end addEventHandler("onPlayerLogin",root,CheckAdminFunction_); logout and login again .
EstrategiaGTA Posted March 22, 2013 Posted March 22, 2013 No it's not right u should to use triggerClientEvent isObject > server only! Ah true, is a Server function... Thanks Pres[T]ege.
X-SHADOW Posted March 22, 2013 Posted March 22, 2013 You Have A resource that dont let the Account work Correct post full code . My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
golanu21 Posted March 22, 2013 Author Posted March 22, 2013 -- Client -- xShowPanelFunction_ = function () guiSetVisible(fereastra,not guiGetVisible(fereastra)); showCursor(guiGetVisible(fereastra)); if ( guiGetVisible(fereastra) == true ) then guiLabelSetColor(GUIEditor.label[5],math.random(0, 255), math.random(0, 255), math.random(0, 255)) end end bindKey(Key,"down",xShowPanelFunction_); addEventHandler("Show",root,xShowPanelFunction_); addEvent("Show",true); -- Server -- CheckAdminFunction_ = function ( ) if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Admin" ) ) then triggerClientEvent("Show",source); end end addEventHandler("onPlayerLogin",root,CheckAdminFunction_); logout and login again . work for Everyone WTF??? [Dev]BloWnRPG - We BloW the World [1%]
golanu21 Posted March 22, 2013 Author Posted March 22, 2013 You Have A resource that dont let the Account work Correct post full code . it's a big script but i can put that 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 xShowPanelFunction_ = function () guiSetVisible(fereastra,not guiGetVisible(fereastra)); showCursor(guiGetVisible(fereastra)); if ( guiGetVisible(fereastra) == true ) then guiLabelSetColor(GUIEditor.label[5],math.random(0, 255), math.random(0, 255), math.random(0, 255)) end end bindKey(Key,"down",xShowPanelFunction_); addEventHandler("Show",root,xShowPanelFunction_); addEvent("Show",true); [Dev]BloWnRPG - We BloW the World [1%]
X-SHADOW Posted March 22, 2013 Posted March 22, 2013 i dont want client-Side . Need ServerSide . My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
golanu21 Posted March 22, 2013 Author Posted March 22, 2013 nothing, all what i have in server side is for other functions [Dev]BloWnRPG - We BloW the World [1%]
iPrestege Posted March 22, 2013 Posted March 22, 2013 -- Server -- addEventHandler( 'onPlayerLogin', root, function( _, acc ) if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( "Admin" ) ) then setElementData( source, 'OpenPanel', true) else setElementData( source, 'OpenPanel', nil) end end ) addEventHandler( 'onPlayerJoin', root, function() setElementData( source, 'OpenPanel', nil) end ) -- Client -- bindKey(Key,"down", function () if getElementData( localPlayer, 'OpenPanel') ~= nil then guiSetVisible(fereastra,not guiGetVisible(fereastra)); showCursor(guiGetVisible(fereastra)); if ( guiGetVisible(fereastra) == true ) then guiLabelSetColor(GUIEditor.label[5],math.random(0, 255), math.random(0, 255), math.random(0, 255)) end end end )
X-SHADOW Posted March 22, 2013 Posted March 22, 2013 Try Add Resource to acl group Admin like this resource.xxx xxx = replace with name of resource . My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
Sasu Posted March 22, 2013 Posted March 22, 2013 if getElementData( localPlayer, 'OpenPanel') ~= nil then ._.? It would be: if getElementData( localPlayer, 'OpenPanel') ~= true then State: Inactive
iPrestege Posted March 22, 2013 Posted March 22, 2013 if getElementData( localPlayer, 'OpenPanel') ~= nil then ._.? It would be: if getElementData( localPlayer, 'OpenPanel') ~= true then No becuase in the server side i set it if the player not admin set the data to nil .
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