Charlie_Jefferson Posted January 14, 2012 Share Posted January 14, 2012 Hi. I'm trying to make an admin "hud". It's basically some labels, which display down the screen, so you know your account name, admin level and nickname. I can't seem to get it working though. No errors are displayed. I checked both, server window and debugscript. It's a simple thing, thought I can't do it... Help? :3 Client code function createGUI(acc, atype, pname) accname = guiCreateLabel(11,745,96,18,string(acc),false) admtype = guiCreateLabel(135,745,96,18,string(atype),false) nick = guiCreateLabel(280,745,96,18,string(pname),false) end addEvent("infosend", true) addEventHandler("infosend", root, createGUI) Server code function check() acc = getAccountName(source) if isObjectInACLGroup("user."..acc, ACLGetGroup("admin")) then atype = "admin" pname = getPlayerName(source) triggerClientEvent("infosend", root, acc, atype, pname) else end end Note: I only wrote 1 acl group yet, for the testing to be easier. I made this script quickly(2 minutes) because I was on a rush. Link to comment
Castillo Posted January 14, 2012 Share Posted January 14, 2012 function check() local acc = getPlayerAccount(source) local accName = getAccountName(acc) if isObjectInACLGroup("user."..acc, aclGetGroup("admin")) then atype = "admin" pname = getPlayerName(source) triggerClientEvent(source, "infosend", source, accName, atype, pname) end end Link to comment
Charlie_Jefferson Posted January 14, 2012 Author Share Posted January 14, 2012 See, I told you I fail... Link to comment
Xeno Posted January 14, 2012 Share Posted January 14, 2012 I would suggest you build the Labels outisde of the function and use guiSetVisible in the triggered function. Link to comment
TAPL Posted January 14, 2012 Share Posted January 14, 2012 it's 'aclGetGroup' not 'ACLGetGroup' function check() local acc = getPlayerAccount(source) local accName = getAccountName(acc) if isObjectInACLGroup("user."..acc, aclGetGroup("admin")) then atype = "admin" pname = getPlayerName(source) triggerClientEvent(source, "infosend", source, accName, atype, pname) end end Link to comment
Charlie_Jefferson Posted January 14, 2012 Author Share Posted January 14, 2012 Oh. Noob mistake there, for me... Anyway, strange that the debugscript and server window weren't displaying a function error. Link to comment
TAPL Posted January 14, 2012 Share Posted January 14, 2012 how you are calling the function check ? Link to comment
Charlie_Jefferson Posted January 14, 2012 Author Share Posted January 14, 2012 That's also right, TAPL. Thanks . Edit: Errors I get when I run it: [2012-01-15 00:16:20] WARNING: adminhud\adminhud_s.lua:3: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean] [2012-01-15 00:16:20] ERROR: adminhud\adminhud_s.lua:5: attempt to concatenate local 'acc' (a boolean value) Link to comment
Charlie_Jefferson Posted January 15, 2012 Author Share Posted January 15, 2012 Sorry for this bump, but no one was looking at this and I need it badly. Link to comment
Al3grab Posted January 15, 2012 Share Posted January 15, 2012 attach the "onPlayerLogin" event to the function : addEventHandler("onPlayerLogin",root,check) 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