SnoopCat Posted April 30, 2011 Share Posted April 30, 2011 hello i have a Gui that i want to make it open only for a specific Group in acl How i can do this??? there is the Gui code and also i tried to make it open whit M button but it doesnt work GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Window[1] = guiCreateWindow(244,192,289,309,"Panel Miembros Que Pagan",false) GUIEditor_Button[1] = guiCreateButton(73,31,124,39,"Repair",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(72,83,129,38,"Flip",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(71,140,124,39,"Get Nitro",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(19,275,237,25,"Close [M]",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(11,199,266,17,"Todo En este panel No tiene Costo Para Ti.",false,GUIEditor_Window[1]) GUIEditor_Label[2] = guiCreateLabel(64,220,166,43,"premium!",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],255,0,0,0) guiSetFont(GUIEditor_Label[2],"sa-gothic") bindKey("m", "down", function () guiSetVisible ( GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1])) showCursor(not isCursorShowing()) end) addEventHandler("onClientGUIClick",getRootElement(), function () if (source == GUIEditor_Button[4]) then guiSetVisible ( GUIEditor_Window[1], false ) showCursor(false) end end Link to comment
Ruma Posted May 1, 2011 Share Posted May 1, 2011 Try this function showTheGUI (key,keySate) if isObjectInACLGroup (source,aclGetGroup("Admin")) then if guiGetVisible (GUIEditor_Window[1]) == false then guiSetVisible ( GUIEditor_Window[1],true) showCursor (true) else guiSetVisible ( GUIEditor_Window[1],false) showCursor (false) end else outputChatBox ("You Are not admin") end end bindKey ("m","down",showTheGUI) Im not sure if it works Link to comment
SnoopCat Posted May 1, 2011 Author Share Posted May 1, 2011 that is not working it just shows the gui but u cant close it and the mouse is not showing Link to comment
Ruma Posted May 1, 2011 Share Posted May 1, 2011 Did you replace this: bindKey("m", "down", function () guiSetVisible ( GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1])) showCursor(not isCursorShowing()) end) for this function showTheGUI (key,keySate) if isObjectInACLGroup (source,aclGetGroup("Admin")) then if guiGetVisible (GUIEditor_Window[1]) == false then guiSetVisible ( GUIEditor_Window[1],true) showCursor (true) else guiSetVisible ( GUIEditor_Window[1],false) showCursor (false) end else outputChatBox ("You Are not admin") end end bindKey ("m","down",showTheGUI) Link to comment
CowTurbo Posted May 1, 2011 Share Posted May 1, 2011 function showTheGUI (key,keySate) if isObjectInACLGroup (source,aclGetGroup("Admin")) then -- isObjectInACLGroup -> Only server side function. if guiGetVisible (GUIEditor_Window[1]) == false then guiSetVisible ( GUIEditor_Window[1],true) showCursor (true) else guiSetVisible ( GUIEditor_Window[1],false) showCursor (false) end else outputChatBox ("You Are not admin") end end bindKey ("m","down",showTheGUI) So, we have to do some check's in server side, and then trigger client side event to open gui. -- Server side function onPlayerLogin () if isObjectInACLGroup (source,aclGetGroup("Admin")) then bindKey ( source, "m, "down", showWindow ) end end addEventHandler ( "onPlayerLogin", getRootElement(), onPlayerLogin ) function showWindow () triggerClientEvent ( thePlayer, "showWindowClientSide", thePlayer ) end -- Client Side function showWindowClientSide() if guiGetVisible (GUIEditor_Window[1]) == false then guiSetVisible ( GUIEditor_Window[1],true) showCursor (true) else guiSetVisible ( GUIEditor_Window[1],false) showCursor (false) end end addEvent ( "showWindowClientSide", true ) addEventHandler ( "showWindowClientSide", getRootElement(), showWindowClientSide ) Next time use /debugscript 3 <-- That was should output error isObjectInACLGroup ( a nil value ). Hope it works Link to comment
SnoopCat Posted May 1, 2011 Author Share Posted May 1, 2011 cow im having same problem as first try i see gui but i cant close it and it apears when i join the server and also i get an error saying : [09:55:45] SCRIPT ERROR: Ppanel\GuiS.lua:3: ')' expected near 'down' [09:55:45] WARNING: Loading script failed: Ppanel\GuiS.lua:3: ')' expected near 'down' Link to comment
CowTurbo Posted May 1, 2011 Share Posted May 1, 2011 Ok, i missed one " -- Server side function onPlayerLogin () if isObjectInACLGroup (source,aclGetGroup("Admin")) then bindKey ( source, "m", "down", showWindow ) end end addEventHandler ( "onPlayerLogin", getRootElement(), onPlayerLogin ) function showWindow () triggerClientEvent ( thePlayer, "showWindowClientSide", thePlayer ) end -- Client Side GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Window[1] = guiCreateWindow(244,192,289,309,"Panel Miembros Que Pagan",false) GUIEditor_Button[1] = guiCreateButton(73,31,124,39,"Repair",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(72,83,129,38,"Flip",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(71,140,124,39,"Get Nitro",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(19,275,237,25,"Close [M]",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(11,199,266,17,"Todo En este panel No tiene Costo Para Ti.",false,GUIEditor_Window[1]) GUIEditor_Label[2] = guiCreateLabel(64,220,166,43,"premium!",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],255,0,0,0) guiSetFont(GUIEditor_Label[2],"sa-gothic") guiSetVisible ( GUIEditor_Window[1], false ) -- You have to add that, if you dont, u will see gui everytime when script starts.. addEventHandler("onClientGUIClick",getRootElement(), function () if (source == GUIEditor_Button[4]) then guiSetVisible ( GUIEditor_Window[1], false ) showCursor(false) end end function showWindowClientSide() if guiGetVisible (GUIEditor_Window[1]) == false then guiSetVisible ( GUIEditor_Window[1],true) showCursor (true) else guiSetVisible ( GUIEditor_Window[1],false) showCursor (false) end end addEvent ( "showWindowClientSide", true ) addEventHandler ( "showWindowClientSide", getRootElement(), showWindowClientSide ) now should work. Link to comment
SnoopCat Posted May 1, 2011 Author Share Posted May 1, 2011 gui is not opening at this time Link to comment
Castillo Posted May 1, 2011 Share Posted May 1, 2011 --Client side GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Window[1] = guiCreateWindow(244,192,289,309,"Panel Miembros Que Pagan",false) guiSetVisible ( GUIEditor_Window[1], false ) GUIEditor_Button[1] = guiCreateButton(73,31,124,39,"Repair",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(72,83,129,38,"Flip",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(71,140,124,39,"Get Nitro",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(19,275,237,25,"Close [M]",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(11,199,266,17,"Todo En este panel No tiene Costo Para Ti.",false,GUIEditor_Window[1]) GUIEditor_Label[2] = guiCreateLabel(64,220,166,43,"premium!",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],255,0,0,0) guiSetFont(GUIEditor_Label[2],"sa-gothic") addEventHandler("onClientGUIClick",getRootElement(), function () if (source == GUIEditor_Button[4]) then guiSetVisible ( GUIEditor_Window[1], false ) showCursor(false) end end) addEvent("openPremiumPanel",true) addEventHandler("openPremiumPanel",getRootElement(), function () guiSetVisible (GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1])) showCursor(not isCursorShowing()) end) --Server side function showPremiumPanel(thePlayer) local account = getPlayerAccount(thePlayer) if account then local accountname = getAccountName(account) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Sr.Admin" )) then triggerClientEvent (thePlayer, "openPremiumPanel", getRootElement()) else outputChatBox ("Premium: Access denied", thePlayer, 255, 0, 0) end end end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), function () for index, player in ipairs ( getElementsByType ( "player" ) ) do bindKey ( player, "M", "down", showPremiumPanel ) end end) addEventHandler ( "onPlayerJoin", getRootElement(), function () bindKey ( source, "M", "down", showPremiumPanel ) end) addEventHandler ( "onResourceStop", getResourceRootElement ( getThisResource() ), function () for index, player in ipairs ( getElementsByType ( "player" ) ) do unbindKey ( player, "M", "down", showPremiumPanel ) end end) Works (tested). Link to comment
SnoopCat Posted May 1, 2011 Author Share Posted May 1, 2011 it doest works solid it is giving me this error: [20:01:02] SCRIPT ERROR: Ppanel\GuiS.lua:17: 'end' expected (to close 'function' at line 14) near '<eof>' [20:01:02] WARNING: Loading script failed: Ppanel\GuiS.lua:17: 'end' expected (t o close 'function' at line 14) near '<eof>' Link to comment
Castillo Posted May 1, 2011 Share Posted May 1, 2011 That's impossible, it works without errors here. Link to comment
Castillo Posted May 1, 2011 Share Posted May 1, 2011 I suposed you we're wrong, no problem btw. Link to comment
SnoopCat Posted May 1, 2011 Author Share Posted May 1, 2011 well now i have to add functions to the gui like fixing car and droping barrel and get nitro For Free. there is the client part i tried to made but idk how to make the server side part Client side: GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Window[1] = guiCreateWindow(244,192,289,309,"Panel Miembros Que Pagan",false) guiSetVisible ( GUIEditor_Window[1], false ) GUIEditor_Button[1] = guiCreateButton(73,31,124,39,"Repair",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(72,83,129,38,"mine",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(71,140,124,39,"Get Nitro",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(19,275,237,25,"Close [M]",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(11,199,266,17,"Todo En este panel No tiene Costo Para Ti.",false,GUIEditor_Window[1]) GUIEditor_Label[2] = guiCreateLabel(64,220,166,43,"premium!",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],255,0,0,0) guiSetFont(GUIEditor_Label[2],"sa-gothic") addEventHandler("onClientGUIClick",getRootElement(), function () if (source == GUIEditor_Button[4]) then guiSetVisible ( GUIEditor_Window[1], false ) showCursor(false) end end) addEvent("openPremiumPanel",true) addEventHandler("openPremiumPanel",getRootElement(), function () guiSetVisible (GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1])) showCursor(not isCursorShowing()) end) function onGuiClick (button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[1]) then triggerServerEvent ("buyfix", getLocalPlayer()) elseif (source == GUIEditor_Button[3]) then triggerServerEvent ("buynitro", getLocalPlayer()) elseif (source == GUIEditor_Button[2]) then triggerServerEvent ("buymine", getLocalPlayer()) Server side: function showPremiumPanel(thePlayer) local account = getPlayerAccount(thePlayer) if account then local accountname = getAccountName(account) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "premium" )) then triggerClientEvent (thePlayer, "openPremiumPanel", getRootElement()) else outputChatBox ("Premium: Access denied", thePlayer, 255, 0, 0) end end end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), function () for index, player in ipairs ( getElementsByType ( "player" ) ) do bindKey ( player, "M", "down", showPremiumPanel ) end end) addEventHandler ( "onPlayerJoin", getRootElement(), function () bindKey ( source, "M", "down", showPremiumPanel ) end) addEventHandler ( "onResourceStop", getResourceRootElement ( getThisResource() ), function () for index, player in ipairs ( getElementsByType ( "player" ) ) do unbindKey ( player, "M", "down", showPremiumPanel ) end end) Link to comment
SnoopCat Posted May 2, 2011 Author Share Posted May 2, 2011 srry for double post butt... ANY help plz? Link to comment
Castillo Posted May 2, 2011 Share Posted May 2, 2011 GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Window[1] = guiCreateWindow(244,192,289,309,"Panel Miembros Que Pagan",false) guiSetVisible ( GUIEditor_Window[1], false ) GUIEditor_Button[1] = guiCreateButton(73,31,124,39,"Repair",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(72,83,129,38,"mine",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(71,140,124,39,"Get Nitro",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(19,275,237,25,"Close [M]",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(11,199,266,17,"Todo En este panel No tiene Costo Para Ti.",false,GUIEditor_Window[1]) GUIEditor_Label[2] = guiCreateLabel(64,220,166,43,"premium!",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],255,0,0,0) guiSetFont(GUIEditor_Label[2],"sa-gothic") addEventHandler("onClientGUIClick",getRootElement(), function () if (source == GUIEditor_Button[4]) then guiSetVisible ( GUIEditor_Window[1], false ) showCursor(false) elseif (source == GUIEditor_Button[1]) then triggerServerEvent ("buyfix", getLocalPlayer()) elseif (source == GUIEditor_Button[3]) then triggerServerEvent ("buynitro", getLocalPlayer()) elseif (source == GUIEditor_Button[2]) then triggerServerEvent ("buymine", getLocalPlayer()) end end) addEvent("openPremiumPanel",true) addEventHandler("openPremiumPanel",getRootElement(), function () guiSetVisible (GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1])) showCursor(not isCursorShowing()) end) Link to comment
SnoopCat Posted May 3, 2011 Author Share Posted May 3, 2011 hey i tried this can any one say me why is not working and where is error? Client: GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Window[1] = guiCreateWindow(244,192,289,309,"Panel Miembros Que Pagan",false) guiSetVisible ( GUIEditor_Window[1], false ) GUIEditor_Button[1] = guiCreateButton(73,31,124,39,"Reparar Vehiculo",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(72,83,129,38,"Poner Bomba",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(71,140,124,39,"Obtener nitro",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(19,275,237,25,"cerrar [M]",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(11,199,266,17,"Todo En este panel No tiene Costo Para Ti.",false,GUIEditor_Window[1]) GUIEditor_Label[2] = guiCreateLabel(64,220,166,43,"premium!",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],255,0,0,0) guiSetFont(GUIEditor_Label[2],"sa-gothic") addEventHandler("onClientGUIClick",getRootElement(), function () if (source == GUIEditor_Button[4]) then guiSetVisible ( GUIEditor_Window[1], false ) showCursor(false) elseif (source == GUIEditor_Button[1]) then triggerServerEvent ("buyfix", getLocalPlayer()) elseif (source == GUIEditor_Button[3]) then triggerServerEvent ("buynitro", getLocalPlayer()) elseif (source == GUIEditor_Button[2]) then triggerServerEvent ("buybomb", getLocalPlayer()) end end) addEvent("openPremiumPanel",true) addEventHandler("openPremiumPanel",getRootElement(), function () guiSetVisible (GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1])) showCursor(not isCursorShowing()) end) Server: function showPremiumPanel(thePlayer) local account = getPlayerAccount(thePlayer) if account then local accountname = getAccountName(account) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "premium" )) then triggerClientEvent (thePlayer, "openPremiumPanel", getRootElement()) else outputChatBox ("Premium: Access denied", thePlayer, 255, 0, 0) end end end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), function () for index, player in ipairs ( getElementsByType ( "player" ) ) do bindKey ( player, "M", "down", showPremiumPanel ) end end) addEventHandler ( "onPlayerJoin", getRootElement(), function () bindKey ( source, "M", "down", showPremiumPanel ) end) addEventHandler ( "onResourceStop", getResourceRootElement ( getThisResource() ), function () for index, player in ipairs ( getElementsByType ( "player" ) ) do unbindKey ( player, "M", "down", showPremiumPanel ) end end) addEvent("buybomb", true) addEventHandler("buybomb", getRootElement(), function() if local x,y,z = getElementPosition( source ) setTimer(function()createObject ( 1225, x, y, z, 90, 0, 0 )end,3000,1) outputChatBox("*Poniendo Mina en 3 Segundos",source,0,255,0) outputChatBox("*Premium: "..getPlayerName(source).." a Tirado una Mina",getRootElement(),0,255,0) account = getPlayerAccount(source) end ) addEvent("buyfix", true) addEventHandler("buyfix", getRootElement(), function() if isPedInVehicle(source) then fixVehicle( getPedOccupiedVehicle(source) ) outputChatBox("*Premium: "..getPlayerName(source).." Se ha Reparado",getRootElement(),0,255,0) account = getPlayerAccount(source) end end ) addEvent("buynitro", true) addEventHandler("buynitro", getRootElement(), function() if isPedInVehicle(source) then addVehicleUpgrade(getPedOccupiedVehicle(source),1010) outputChatBox("*Premium: "..getPlayerName(source).." Se Puso Nitro",getRootElement(),0,255,0) account = getPlayerAccount(source) end end ) Link to comment
Castillo Posted May 3, 2011 Share Posted May 3, 2011 function showPremiumPanel(thePlayer) local account = getPlayerAccount(thePlayer) if account then local accountname = getAccountName(account) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "premium" )) then triggerClientEvent (thePlayer, "openPremiumPanel", getRootElement()) else outputChatBox ("Premium: Access denied", thePlayer, 255, 0, 0) end end end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), function () for index, player in ipairs ( getElementsByType ( "player" ) ) do bindKey ( player, "M", "down", showPremiumPanel ) end end) addEventHandler ( "onPlayerJoin", getRootElement(), function () bindKey ( source, "M", "down", showPremiumPanel ) end) addEventHandler ( "onResourceStop", getResourceRootElement ( getThisResource() ), function () for index, player in ipairs ( getElementsByType ( "player" ) ) do unbindKey ( player, "M", "down", showPremiumPanel ) end end) addEvent("buybomb", true) addEventHandler("buybomb", getRootElement(), function() if isPedInVehicle(source) then local x,y,z = getElementPosition( source ) setTimer(function()createObject ( 1225, x, y, z, 90, 0, 0 )end,3000,1) outputChatBox("*Poniendo Mina en 3 Segundos",source,0,255,0) outputChatBox("*Premium: "..getPlayerName(source).." a Tirado una Mina",getRootElement(),0,255,0) end end ) addEvent("buyfix", true) addEventHandler("buyfix", getRootElement(), function() if isPedInVehicle(source) then fixVehicle( getPedOccupiedVehicle(source) ) outputChatBox("*Premium: "..getPlayerName(source).." Se ha Reparado",getRootElement(),0,255,0) end end ) addEvent("buynitro", true) addEventHandler("buynitro", getRootElement(), function() if isPedInVehicle(source) then addVehicleUpgrade(getPedOccupiedVehicle(source),1010) outputChatBox("*Premium: "..getPlayerName(source).." Se Puso Nitro",getRootElement(),0,255,0) end end ) Link to comment
ProDMRac3r Posted May 10, 2011 Share Posted May 10, 2011 Cast Can I Take It I DO That But When I'm Open It Say Premium:Acecces Denied Link to comment
Castillo Posted May 10, 2011 Share Posted May 10, 2011 Well, the script was designed by him (most of code by me but well), i don't think you should take it. Link to comment
JR10 Posted June 15, 2011 Share Posted June 15, 2011 Dude, the post was a month ago and you are just posting "ok" ? DONT POST WITHOUT A REASON. Your just trying to increase your posts. 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