[MTA]Weed Posted August 28, 2017 Share 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? Link to comment
mahmod3 Posted August 28, 2017 Share 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 Link to comment
Moderators IIYAMA Posted August 28, 2017 Moderators Share 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 Link to comment
[MTA]Weed Posted August 28, 2017 Author Share Posted August 28, 2017 its giving me a nil value here: local accountname = getAccountName (getPlayerAccount(player)) Link to comment
Ahmed Ly Posted August 28, 2017 Share 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 Link to comment
[MTA]Weed Posted August 28, 2017 Author Share Posted August 28, 2017 i tryed using server side, but its not opening the gui, not showing nothing on debug too... Link to comment
Moderators IIYAMA Posted August 28, 2017 Moderators Share 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 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