Jump to content

Math.random


SnoopCat

Recommended Posts

hey here i want to make a script that shows u players loged in all is working fine but i want to put them to show whit random colors and they are not woring can u help me ??? there is the code...

       
  
function playerCount ( ) 
         outputChatBox ( "Ahora Hay"     .. getPlayerCount()..     " Jugadores En el Servidor", getRootElement(), local r,g,b = math.random(0, 255),math.random(0, 255),math.random(0, 255), true ) 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), playerCount ) 
addEventHandler ( "onPlayerQuit", getRootElement(), playerCount ) 
  
  
  

can u plz say me what is wrong?

Link to comment
  • Moderators
function playerCount ( ) 
    outputChatBox ( "Ahora Hay ".. getPlayerCount().." Jugadores En el Servidor", getRootElement(), math.random(0, 255),math.random(0, 255),math.random(0, 255) ) 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), playerCount ) 
addEventHandler ( "onPlayerQuit", getRootElement(), playerCount ) 

Link to comment
  
function playerCount ( ) 
        outputChatBox ( "Ahora Hay ".. getPlayerCount().." Jugadores En el Servidor", root, math.random(255), math.random(255), math.random(255) ) 
    end 
    addEventHandler ( "onPlayerJoin", root, playerCount ) 
    addEventHandler ( "onPlayerQuit", root, playerCount ) 
  

Even shorter. You don't need to specify a lower number in math.random if you want 0. root is the same as getRootElement() just 5 times quicker to type.

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