Jump to content

لون التاج علي حسب التيم


3ssol

Recommended Posts

السلام عليكم

شباب ابي اعرف كيف اسوي

اذا دخلت تيم لونه احمر يصير تاج ادمنيتك احمر واذا رحت تيم اخضر يصير لون تاج ادمنيتك اخضر وكذا علي حسب التيم

كيف؟

Link to comment
function myTeamColor(Player,Command) -- adding the function 
playerTeam = getPlayerTeam(Player) 
   if playerTeam then 
      r,g,b = getTeamColor(playerTeam) 
          if r and g and b then 
             outputChatBox("your team color is : "..RGBToHex(r,g,b)) 
          end 
   end 
end 
addCommandHandler("myteamcolor",myTeamColor) 

مثال من الويكي

Link to comment

* For Ex.:

-- Server Side # 
function RGBToHex(red, green, blue, alpha) 
    if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then 
        return nil 
    end 
    if(alpha) then 
        return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha) 
    else 
        return string.format("#%.2X%.2X%.2X", red,green,blue) 
    end 
end 
  
addEventHandler ( "onPlayerChat", root, 
    function ( msg, msgtype ) 
        local account = getAccountName ( getPlayerAccount ( source ) ) 
        local name = getPlayerName ( source ) 
        local r, g, b = getPlayerNametagColor ( source ) 
        local HexCode = RGBToHex ( r, g, b ) 
        if ( msgtype == 0 ) then 
            if ( isObjectInACLGroup ( "user." .. account, aclGetGroup ( "Console" ) ) ) then 
                cancelEvent ( ) 
                outputChatBox ( "* #DD0000[Console] " .. HexCode .. "" .. name .. ": #FFFFFF" .. msg, root, 255, 255, 255, true  
  
) 
            elseif ( isObjectInACLGroup ( "user." .. account, aclGetGroup ( "Admin" ) ) ) then 
                cancelEvent ( ) 
                outputChatBox ( "* #FF0000[Admin] " .. HexCode .. "" .. name .. ": #FFFFFF" .. msg, root, 255, 255, 255, true ) 
            elseif ( isObjectInACLGroup ( "user." .. account, aclGetGroup ( "Everyone" ) ) ) then 
                cancelEvent ( ) 
                outputChatBox ( HexCode .. "" .. name .. ": #FFFFFF" .. msg, root, 255, 255, 255, true ) 
            end 
        end 
    end 
) 

.. بتزيد التحققات وغيرهـ getTeamColor للإختصار .. لانه لو بستخدم وظيفة getPlayerNametagColor سويتها لكم على وظيفة

Link to comment

كفوو ضبط يعطيك العافيه يالكنق

بس ممكن تشرحلي هذا

outputChatBox ( "* [Console] " .. HexCode .. "" .. name .. ": #FFFFFF" .. msg, root, 255, 255, 255, true) 

انت مسوي كذا

* [Console] " .. HexCode .. "

ليه ؟ مو المفروض تكون كذا

" .. HexCode .. "* [Console]

وراء التاج عشان يتلون التاج وبس كيف انت حطيتها بعد التاج وتلون التاج ؟

Link to comment
خلالاص مشكور ي كيننق

عدلت ع الكود خليته ع التيم وضبط وشغال 100 % 100 يعطيك الف عااافيه

. حيآكـ // انا احسبك تبي تاج الادمنية بلون من اختياركـ ولون الإسم يكون ع حسب التيم ع كل حال مافيه فرق .. بالتوفيق

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...