Vazern Posted March 14, 2018 Posted March 14, 2018 (edited) Hello guys! I'm having a little problem, I'm a beginner in scripting, and I made this function because I'm creating a "police work" system, but when the event is executed, nothing happens that was written on the server, nor any error in the debug. (Sorry for English, I use a translator.) Server-side: function tornarPM(thePlayer) if not (isElement(thePlayer)) then return end local accountName = getAccountName(getPlayerAccount(thePlayer)) if accountName then aclGroupAddObject(aclGetGroup("PMESP"), "user."..accountName) exports.dxmessages:outputDx(thePlayer, "Seja bem vindo a PMESP! Vá até a garagem para aprender como funciona o trabalho!", "success") end end addEvent("ingressar",true) addEventHandler("ingressar", root, tornarPM) Client-side: function tornarPM(_,state) if isEventHandlerAdded("onClientRender", root, menu) then if state == "down" then if isCursorOnElement(screenW * 0.4066, screenH * 0.5117, screenW * 0.1574, screenH * 0.0651) then triggerServerEvent("ingressar", localPlayer) removeEventHandler("onClientRender", root, menu) showChat(true) showCursor(false) playSound("sfx/hit.mp3", false) if l_0_1 then l_0_1 = false end end end end end addEventHandler("onClientClick", root, tornarPM) Screenshot: https://i.imgur.com/ZYroOks.jpg Edited March 14, 2018 by VazErn
' A F . Posted March 14, 2018 Posted March 14, 2018 in server side change thePlayer to source and try Dis ; AF.#0941
Vazern Posted March 14, 2018 Author Posted March 14, 2018 The end result was this, I changed to this mode and it worked, thanks for the help! function tornarPM() if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("PMESP")) then aclGroupAddObject(aclGetGroup("PMESP"), "user."..getAccountName(getPlayerAccount(source))) exports.dxmessages:outputDx(source, "Seja bem vindo a PMESP! Vá até a garagem para aprender como funciona o trabalho!", "success") else exports.dxmessages:outputDx(source, "Você já é policial.", "error") end end addEvent("ingressar",true) addEventHandler("ingressar", root, tornarPM) 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