Jump to content

Nametag images||Class system


yoya99

Recommended Posts

Posted

hi there i have a problem ..i want to draw images next to the nametags for admin,moderators and normal players.... i have this files but it is not working...i tried all but i didnt found a solution....pls help me ...thx in advance :?

basic.lua.

function showImage() 
dxDrawImage() 
  
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, "admin.png" ) 
                      end 
  
  
 if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Moderator" ) ) then 
dxDrawImage ( sx + math.max(nameWidth/2, teamWidth/2) + 0*scale, sy - imageSize, imageSize, imageSize, "moderator.png" ) 
                      end 
  
  
 if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Console" ) ) then 
  
dxDrawImage ( sx + math.max(nameWidth/2, teamWidth/2) + 0*scale, sy - imageSize, imageSize, imageSize, "vip.png" ) 
                      end 
end 
addEventHandler("onClientResourceStart", resourceRoot, function() addEventHandler("onClientRender", root, showImage) end) 

and that one:

function setDataOnLogin() 
    if not isGuestAccount(getPlayerAccount(source)) and isObjectInACLGroup("user."..getAccountName(source), aclGetGroup("Console")) then 
        setElementData(source, "showImage", 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, "showImage", true) 
        end 
    end 
end 
addEventHandler("onResourceStart", resourceRoot, setDataOnResourceStart) 
  

Posted

You better use:

setElementData + getElementData 

It's way better than triggering this time, because you would make each event for each acl group if you triggered it..

Posted
--- I HAVE NOT TRIED.

server.lua

  
  
function setDataOnLogin() 
     if isObjectInACLGroup ("user."..getAccountName (getPlayerAccount( source )),aclGetGroup ( "Console" )) then 
        setElementData(source, "showImage", true) 
    end 
end 
addEventHandler("onPlayerLogin", root, setDataOnLogin) 
  
function setDataOnResourceStart() 
    for i, v in ipairs(getElementsByType("player")) do 
     if isObjectInACLGroup ("user."..getAccountName (getPlayerAccount ( v )), aclGetGroup ( "Console" )) then 
            setElementData(v, "showImage", true) 
        end 
    end 
end 
addEventHandler("onResourceStart", resourceRoot, setDataOnResourceStart) 
  
function removeDataOnLogout() 
        setElementData(source, "showImage", false) 
end 
addEventHandler("onPlayerLogout", root, removeDataOnLogout) 
  

client.lua

function showImage() 
if getElementData(getLocalPlayer(), "showImage") then 
dxDrawImage ( sx + math.max(nameWidth/2, teamWidth/2) + 0*scale, sy - imageSize, imageSize, imageSize, "vip.png" ) 
else 
dxDrawImage ( sx + math.max(nameWidth/2, teamWidth/2) + 0*scale, sy - imageSize, imageSize, imageSize, "player.png" ) 
end 
end 
addEventHandler("onClientRender", root, showImage) 

Posted

Thats all? Just make a meta and ready? Do i see it in my own too or? And what is with admin acl group and moderator acl group? Iam confused :(

Posted

i tried out and it is not working too....error: basic.lua:5 attempt to perform arthimetic on global "sx" (a nil value)

i dont see any image at my head too..HEEELP :?

Posted
i tried out and it is not working too....error: basic.lua:5 attempt to perform arthimetic on global "sx" (a nil value)

i dont see any image at my head too..HEEELP :?

You haven't definied the arguments , you only copied the code from this topic

viewtopic.php?f=91&t=81037

It will never work

Posted

no that is my personal code...i just ask for help becasue i am not a pro scripter..i just learnt it by a friend...

SO you cant help me or??

Posted
I dont call that constructive help now.... If nobody can give me an normal answer then go pls away
isObjectInACLGroup 

is a server side function , you can't use on client side.

You have to use

triggerServerEvent 

Where is sx + math.max(nameWidth/2, teamWidth/2) + 0*scale, sy - imageSize, imageSize, imageSize, "vip.png" definied?

Done, i helped you. happy?

Posted
MY SCRIPT STOLEN FROM CLIENT SIDE NO ONE GIVE HIM MY SERVER SIDE !!

I guess then you stolen the script from grafuroom and he from your server :|

Posted

i did not steal it...how could i post it here?? Zares you compilingyour resources lollike everyone other too so how should i steal it??

Second: With the walking style and the Fighting style were my codes because nobody answered my topics you made a new topic and let users make it for you...If i would write to the community to bnlock your ip of server then you are done or?

Posted
i did not steal it...how could i post it here?? Zares you compilingyour resources lollike everyone other too so how should i steal it??

Second: With the walking style and the Fighting style were my codes because nobody answered my topics you made a new topic and let users make it for you...If i would write to the community to bnlock your ip of server then you are done or?

Lol my Nametags resources is not compiled + Fighting style i mad it my self ! no body answered me so i made it

+ idc stop stealing my codes , Any moderator Close this Topic

Posted
MY SCRIPT STOLEN FROM CLIENT SIDE NO ONE GIVE HIM MY SERVER SIDE !!

I guess then you stolen the script from grafuroom and he from your server :|

I didn't steal it ! My friend helped me with it and he is scripter in this Forum

Posted
i did not steal it...how could i post it here?? Zares you compilingyour resources lollike everyone other too so how should i steal it??

Second: With the walking style and the Fighting style were my codes because nobody answered my topics you made a new topic and let users make it for you...If i would write to the community to bnlock your ip of server then you are done or?

Lol my Nametags resources is not compiled + Fighting style i mad it my self ! no body answered me so i made it

+ idc stop stealing my codes , Any moderator Close this Topic

You use dx functions on server side and you want i belive you? :|

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...