ZeyadGTX Posted September 24, 2014 Posted September 24, 2014 I would like to draw image for Console's Only if in Group ACL Console ! draws image for him next to nametag using that dxDrawImage ( sx + math.max(nameWidth/2, teamWidth/2) + 1*scale, sy - imageSize, imageSize, imageSize, ":Admin/Image/Admin.png" )
Castillo Posted September 24, 2014 Posted September 24, 2014 You can use element data, set it when the player logs in if he's in the ACL group.
#DRAGON!FIRE Posted September 24, 2014 Posted September 24, 2014 use "onResourceStart" with isObjectInACLGroup + setElementData and "onPlayerLogin" with isObjectInACLGroup + setElementData and don't forget isGuestAccount and Check in Client if player have the data and make your code .
ZeyadGTX Posted September 28, 2014 Author Posted September 28, 2014 can you explain by small script ?
xeon17 Posted September 28, 2014 Posted September 28, 2014 can you explain by small script ? Every wiki page have a example..
ZeyadGTX Posted September 28, 2014 Author Posted September 28, 2014 I tried and failed and i'm not pro scripter so i need help
xeon17 Posted September 28, 2014 Posted September 28, 2014 I tried and failed and i'm not pro scripter so i need help Of course we can help you , but we won't create the script for you. If you tried then post your code.
ZeyadGTX Posted October 4, 2014 Author Posted October 4, 2014 HelHelp I tried that code not working if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Everyone" ) ) then dxDrawImage ( sx + math.max(nameWidth/2, teamWidth/2) + 0*scale, sy - imageSize, imageSize, imageSize, "player.png" ) end if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then dxDrawImage ( sx + math.max(nameWidth/2, teamWidth/2) + 0*scale, sy - imageSize, imageSize, imageSize, "player.png" ) end if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Console" ) ) then dxDrawImage ( sx + math.max(nameWidth/2, teamWidth/2) + 0*scale, sy - imageSize, imageSize, imageSize, "player.png" ) end if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Warden" ) ) then dxDrawImage ( sx + math.max(nameWidth/2, teamWidth/2) + 0*scale, sy - imageSize, imageSize, imageSize, "player.png" ) end
ZeyadGTX Posted October 4, 2014 Author Posted October 4, 2014 I added These line in my Nametags and it's client side : i added that Client side : local accName = getAccountName ( getPlayerAccount ( player ) ) Do i add this server side : ? if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Everyone" ) ) then dxDrawImage ( sx + math.max(nameWidth/2, teamWidth/2) + 0*scale, sy - imageSize, imageSize, imageSize, "player.png" ) end if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then dxDrawImage ( sx + math.max(nameWidth/2, teamWidth/2) + 0*scale, sy - imageSize, imageSize, imageSize, "player.png" ) end if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Console" ) ) then dxDrawImage ( sx + math.max(nameWidth/2, teamWidth/2) + 0*scale, sy - imageSize, imageSize, imageSize, "player.png" ) end if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Warden" ) ) then dxDrawImage ( sx + math.max(nameWidth/2, teamWidth/2) + 0*scale, sy - imageSize, imageSize, imageSize, "player.png" ) end
crismar Posted October 4, 2014 Posted October 4, 2014 I'm not sure what you're trying to achieve but: Server: function setDataOnLogin() if not isGuestAccount(getPlayerAccount(source)) and isObjectInACLGroup("user."..getAccountName(source), aclGetGroup("Console")) then setElementData(source, "showimg", true) end end addEventHandler("onPlayerLogin", root, setDataOnLogin) function setDataOnResourceStart() for i, v in ipairs(getElementsByType("player")) do if not isGuestAccount(getPlayerAccount(v)) and isObjectInACLGroup("user."..getAccountName(v), aclGetGroup("Console")) then setElementData(v, "showimg", true) end end end addEventHandler("onResourceStart", resourceRoot, setDataOnResourceStart) Client: function showImage() dxDrawImage() -- Here will go the rest of your code. end addEventHandler("onClientResourceStart", resourceRoot, function() addEventHandler("onClientRender", root, showImage) end) Please not your Lua knowledge is terrible, you don't seem to know even the basics of it, dxDrawImage is a client-sided function and shall not be used server-side, it won't have any effect and will throw an error. I've made you the script, you only need to do the dxDrawImage part, even so I looked through the rest of your stuff and it's just not making any sense, you copied a few lines from another script and came here asking for help. nameWidth, teamWidth, scale, imageSize,, sy and sx and undefined variables, I don't even know how you expect this to work.
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