Jump to content

[HELP] Problem with Event


GrubaS

Recommended Posts

Hello guys,

I want make script when Player join then it will be shows color team.

I trying with setTimer bcz without setTimer it will be get "Spectators" team color :x after 2 secs CWSCRIPT moves players to team. (cwscript is decompiled) but when join players are in team "Spectators" :|

It's my code. + this setTimer dont working :x

function gowno(gowno) 
setTimer( function () 
local r,g,b = getTeamColor(getPlayerTeam(source)) 
local hex = RGBToHex(r,g,b) 
outputChatBox("* "..hex..""..getPlayerName(source):gsub("#%x%x%x%x%x%x","").." #FF6464has joined the game", gowno, 255, 100, 100, true) 
end, 5000, 1) 
end 
addEventHandler('onPlayerJoin', root, gowno ) 
  
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 

Sorry for my bad english.

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