[MTA]Weed Posted August 28, 2017 Posted August 28, 2017 function toggleHatGUI() local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "VIP") ) then if vip==false then vip="No" end if guiGetVisible(VipHats) then guiSetVisible(VipHats, false) showCursor(false) elseif vip=="Yes" then guiSetVisible(VipHats, true) showCursor(true) end what is wrong here, anyone?
mahmod3 Posted August 28, 2017 Posted August 28, 2017 Where end You need 3 end in your code function toggleHatGUI() local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "VIP") ) then if vip==false then vip="No" end if guiGetVisible(VipHats) then guiSetVisible(VipHats, false) showCursor(false) elseif vip=="Yes" then guiSetVisible(VipHats, true) showCursor(true) end end end 1
Moderators IIYAMA Posted August 28, 2017 Moderators Posted August 28, 2017 You guys can't mix clientside code with serverside code. Those are running on two different applications. One of your MTA client(clientside) and one on your server (serverside) . Client functions: https://wiki.multitheftauto.com/wiki/Client_Scripting_Functions Server functions: https://wiki.multitheftauto.com/wiki/Server_Scripting_Functions
[MTA]Weed Posted August 28, 2017 Author Posted August 28, 2017 its giving me a nil value here: local accountname = getAccountName (getPlayerAccount(player))
Ahmed Ly Posted August 28, 2017 Posted August 28, 2017 2 minutes ago, [MTA]Weed said: its giving me a nil value here: local accountname = getAccountName (getPlayerAccount(player)) use this functions in server side not in client side
[MTA]Weed Posted August 28, 2017 Author Posted August 28, 2017 i tryed using server side, but its not opening the gui, not showing nothing on debug too...
Moderators IIYAMA Posted August 28, 2017 Moderators Posted August 28, 2017 (edited) As I said before, you can't use the same code on the same application! Like my words are just trash, seriously... So split it in two: Clientside if not guiGetVisible(VipHats) then triggerServerEvent("requestOpenVIPWindow", resourceRoot) else -- close the vip window... end Serverside addEvent("requestOpenVIPWindow", true) addEventHandler("requestOpenVIPWindow", resourceRoot, function () if isElement(client) then local account = getPlayerAccount(client) if account and not isGuestAccount(account) then local accName = getAccountName(account) if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "VIP") ) then triggerClientEvent(client, "openVIPWindow", resourceRoot) end end end end) Clientside addEvent("openVIPWindow", true) addEventHandler("openVIPWindow", resourceRoot, function () -- open the vip window... end) Edited August 28, 2017 by IIYAMA 1
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