1LoL1 Posted January 3, 2016 Share Posted January 3, 2016 Hello, i created script but doesn't work. I used /test window is showed but outputChatBox is too showed. And i want if player is in group "Premium" then will be show only Window. If player is not in group "Premium" then it says only outputChatBox. I don't know where i'am wrong please can anyone help me? Client: function ShowGUI () TEST() showCursor (true) local screenW,screenH = guiGetScreenSize() local windowW,windowH = guiGetSize(Window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(Window,x,y,false) triggerServerEvent("TESTT", localPlayer) end addCommandHandler("test", ShowGUI) Server: addEvent("TESTT", true) addEventHandler("TESTT", root, function () if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("Premium")) then else cancelEvent() outputChatBox("bla bla bla", source, 255, 0, 0, true) end end) Link to comment
Addlibs Posted January 3, 2016 Share Posted January 3, 2016 You can't cancel a custom event (unless you write code to support that). Also, I don't think it's possible to cancel a remote event (i.e. from client to server or vice versa) Link to comment
1LoL1 Posted January 3, 2016 Author Share Posted January 3, 2016 You can't cancel a custom event (unless you write code to support that).Also, I don't think it's possible to cancel a remote event (i.e. from client to server or vice versa) So how i can in client or in server if player is in group "Premium" window will showed. If not is in "Premium" window will be not showed only outputChatBox. Link to comment
Enargy, Posted January 4, 2016 Share Posted January 4, 2016 addEvent("TESTT", true) addEventHandler("TESTT", root, function () if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("Premium")) then --code else outputChatBox("bla bla bla", source, 255, 0, 0, true) return false end end) Link to comment
1LoL1 Posted January 4, 2016 Author Share Posted January 4, 2016 addEvent("TESTT", true) addEventHandler("TESTT", root, function () if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("Premium")) then --code else outputChatBox("bla bla bla", source, 255, 0, 0, true) return false end end) wtf? it's server-side but i need in client-side. Link to comment
Tails Posted January 4, 2016 Share Posted January 4, 2016 Hi 1LoL1, You can put the commandHandler on the server-side and call the client-side function from there as well. Also, you cannot use "test" as the command, it will not work, use something else like "test1". -- Server function showGUI(source) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("Premium")) then triggerClientEvent(source,"TESTT",root) else outputChatBox("bla bla bla",source,255,0,0,true) end end addCommandHandler("test1",showGUI) -- Client function showGUI() TEST() showCursor(true) local screenW,screenH = guiGetScreenSize() local windowW,windowH = guiGetSize(Window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(Window,x,y,false) end addEvent("TESTT",true) addEventHandler("TESTT",root,showGUI) Link to comment
1LoL1 Posted January 4, 2016 Author Share Posted January 4, 2016 Hi 1LoL1,You can put the commandHandler on the server-side and call the client-side function from there as well. Also, you cannot use "test" as the command, it will not work, use something else like "test1". -- Server function showGUI(source) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("Premium")) then triggerClientEvent(source,"TESTT",root) else outputChatBox("bla bla bla",source,255,0,0,true) end end addCommandHandler("test1",showGUI) -- Client function showGUI() TEST() showCursor(true) local screenW,screenH = guiGetScreenSize() local windowW,windowH = guiGetSize(Window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(Window,x,y,false) end addEvent("TESTT",true) addEventHandler("TESTT",root,showGUI) Thanks!. Works. 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