Blinker. Posted November 6, 2014 Posted November 6, 2014 Hello Folks , i've made a gui which shows online Admins ,smods and mods. the problem is not all admins,smods and mods are showing in the gui , not even in the chatbox(for test). here's my script (server side): local onlineplayers = getElementsByType("player") function checkadmins() Admins = "" for i ,v in ipairs (onlineplayers) do if isObjectInACLGroup("user.".. getAccountName(getPlayerAccount(v)),aclGetGroup'Admin') then Admins = getPlayerName(v):gsub("#%x%x%x%x%x%x", "").." - Admin\n" end end return Admins end function checksmod() smod = "" for i ,v in ipairs (onlineplayers) do if isObjectInACLGroup("user.".. getAccountName(getPlayerAccount(v)),aclGetGroup'SuperModerator') then smod = getPlayerName(v):gsub("#%x%x%x%x%x%x", "").." - Supermoderator\n" end end return smod end function checkmod() mod = "" for i ,v in ipairs (onlineplayers) do if isObjectInACLGroup("user.".. getAccountName(getPlayerAccount(v)),aclGetGroup'Moderator') then mod = getPlayerName(v):gsub("#%x%x%x%x%x%x", "").." - Moderator\n" end end return mod end function checkall () admins = checkadmins() smod = checksmod() mod = checkmod() outputChatBox(mod..smod..admins) triggerClientEvent("Triggered:data",root,admins,smod,mod) end addEvent("checkall",true) addEventHandler("checkall",root,checkall) edit : forgot to mention , checkall is triggered by the client side when the player opens the gui.
MTA Team botder Posted November 6, 2014 MTA Team Posted November 6, 2014 mod = getPlayerName(v):gsub("#%x%x%x%x%x%x", "").." - Moderator\n" You are replacing the variable with a fresh content. You have to append the content to the variable: mod = mod .. getPlayerName(v):gsub("#%x%x%x%x%x%x", "").." - Moderator\n" You have to do it for SMod and Admin too.
Blinker. Posted November 7, 2014 Author Posted November 7, 2014 Hello , i've got another problem , when i start the script , i can see online admins,smods and mods , but when i reconnect , i can't see them and get erros , i need to restart the script in order to make it work. errors :bad argument at 'getPlayerAccount' (expected element at argument 1 ) bad argument at 'getAccountName' [expected element at argument 1 got boolean] both at this line if isObjectInACLGroup("user.".. getAccountName(getPlayerAccount(v)),aclGetGroup'Admin') then Thanks in advance.
MTA Team botder Posted November 7, 2014 MTA Team Posted November 7, 2014 Because you should update the onlineplayers table when you call checkall() function checkall() onlineplayers = getElementsByType("player") -- .. rest of your code end
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