Jump to content

طلب اكواد النك نيم


Recommended Posts

اذا عندك تاج بتلاقي فيه سطر كذاا

local name = getPlayerName(source) 

خليه كذاا

local name = getElementData(source,"CustomTag") or getPlayerName(source) 

ضيف ذاا الكود

addEventHandler("onResourceStart",resourceRoot, 
    function () 
        for i,p in ipairs(getElementsByType("player")) do 
            if not isGuestAccount(getPlayerAccount(p)) then 
                if getAccountData(getPlayerAccount(p),"CustomTag") then 
                    setElementData(p,"CustomTag",getAccountData(getPlayerAccount(p),"CustomTag")) 
                end 
            end 
        end 
    end 
) 
  
addEventHandler("onPlayerLogin",root, 
    function (_,acc) 
        if getAccountData(acc,"CustomTag") then 
            setElementData(acc,"CustomTag",getAccountData(acc,"CustomTag")) 
        end 
    end 
) 

Link to comment

مافهمت الكود ذا ممكن تشرح لي لا هنت ؟

    addEventHandler("onResourceStart",resourceRoot, 
        function () 
            for i,p in ipairs(getElementsByType("player")) do 
                if not isGuestAccount(getPlayerAccount(p)) then 
                    if getAccountData(getPlayerAccount(p),"CustomTag") then 
                        setElementData(p,"CustomTag",getAccountData(getPlayerAccount(p),"CustomTag")) 
                    end 
                end 
            end 
        end 
    ) 
      
    addEventHandler("onPlayerLogin",root, 
        function (_,acc) 
            if getAccountData(acc,"CustomTag") then 
                setElementData(acc,"CustomTag",getAccountData(acc,"CustomTag")) 
            end 
        end 
    ) 

+ كيف يحفظ في الحساب؟

مافيه setAccountData

Link to comment
-- Server Side # 
addCommandHandler ( "supernick", 
    function ( player, _, nick ) 
        if ( isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( player ) ), aclGetGroup ( "Admin" ) ) ) then 
            if ( nick ) and ( string.len ( nick ) <= 80 ) then 
                setElementData  ( player, "CustomTag", tostring ( nick ) ) 
                outputChatBox ( "[superNick]#FFFFFF Your SuperNick is: " .. tostring ( nick ) .. " #FFFFFF.", player, 255, 136, 0, true ) 
            end 
        else 
            outputChatBox ( "[ERROR] #ffffffOops! You are not allowed to do this.", player, 255, 0, 0, true ) 
        end 
    end 
) 
  
addEventHandler ( "onPlayerChat", root, 
    function ( msg ) 
        local r, g, b = getPlayerNametagColor ( source ) 
        local value = getElementData ( source, "CustomTag" ) 
        if ( value ) then 
            cancelEvent ( ) 
            outputChatBox( value .. " : #FFFFFF" .. msg, root, r, g, b, true ) 
        end 
    end 
) 
  
addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
            local acc = getPlayerAccount ( player ) 
            if ( acc ) and not ( isGuestAccount ( acc ) ) and ( getAccountData ( acc, "CustomTag" ) ) then 
                setElementData ( player, "CustomTag", getAccountData( acc, "CustomTag" ) ) 
            end 
        end 
    end 
) 
  
addEventHandler ( "onPlayerLogin", root, 
    function ( _, acc ) 
        if ( getAccountData ( acc, "CustomTag" ) ) then 
            setElementData ( source, "CustomTag", getAccountData ( acc, "CustomTag" ) ) 
        end 
    end 
) 
  
addEventHandler ( "onPlayerQuit", root, 
    function ( ) 
        local acc = getPlayerAccount ( source ) 
        if ( acc ) and not ( isGuestAccount ( acc ) ) and ( getElementData ( source, "CustomTag" ) ) then 
            setAccountData ( acc, "CustomTag", getElementData ( source, "CustomTag" ) ) 
        end 
    end 
) 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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