Jump to content

Color


Arsilex

Recommended Posts

Posted

Hola en muchos servidores race eh visto que el color de loc coches es mas vivo y en mi caso en mi sv los colores son del GTA normal como puedo cambiarlo ay alguen archivo o algo??????

o tengo que crear un script que cuando empieza el mapa se cambie a un color aleatorio de los que yo ponga

tambien pense en cojer el vehclepicker de freeroam pero no me funciona por que tengo que ponerlo en un gui creo ._.

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

Ah, estas hablando de los colores R, G, B, esos los podes usar en setVehicleColor.

Esto le pone el color rojo y verde a un vehiculo:

setVehicleColor ( theVehicle, 255, 0, 0, 0, 255, 0 ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Usa la funcion:

math.random 

Hace click en la funcion para obtener informacion sobre la misma.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (edited)
  
function Color(theVehicle) 
    color1=setVehicleColor ( theVehicle, 255, 0, 0, 0, 255, 0 ) 
    color2=setVehicleColor2 ( theVehicle, 0, 255, 0, 0, 255, 0 ) 
    color3=setVehicleColor3 ( theVehicle, 0, 255, 0, 0, 255, 0 ) 
math.random = color1,color2,color3 
end 
  

asi queria mas o menos?

Edited by Guest
rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

Eso no tiene sentido.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
function Colores(theVehicle) 
Color1=setVehicleColor ( theVehicle, 255, 0, 0, 0, 255, 0 ) 
Color2=setVehicleColor ( theVehicle, 255, 0, 0, 0, 255, 0 ) 
Color3=setVehicleColor ( theVehicle, 255, 0, 0, 0, 255, 0 ) 
Color4=setVehicleColor ( theVehicle, 255, 0, 0, 0, 255, 0 ) 
Color5=setVehicleColor ( theVehicle, 255, 0, 0, 0, 255, 0 ) 
  
math.random (Color (1,2,3,4,5)) 
end 
  
addEvent("ChangeVehicleColor", true) 
addEventHandler("ChangeVehicleColor",getRootElement(),Colores) 
  

asi estaria bien?

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

Por favor, podrias por lo menos leer el sintaxis de las funciones?

setVehicleColor retorna un boolean: true o false.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
  
function doColorChange(theVehicle) 
    setVehicleColor (theVehicle, math.random(255),math.random(255),math.random(255),math.random(255)) 
end 
addEvent("changevehiclecolor", true) 
addEventHandler("changevehiclecolor",getRootElement(),doColorChange) 

eso sirve ?

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

Eso esta mejor, pero se que no lo hiciste vos.

P.D: Te falto algo para ejecutar la funcion.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Eso funcionaria, si, pero sigue sin tener algo que lo ejecute.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
function doColorChange(theVehicle) 
    setVehicleColor (theVehicle, math.random(255),math.random(255),math.random(255),math.random(255)) 
end 
addEvent("changevehiclecolor", true) 
addEventHandler("changevehiclecolor",getRootElement(),doColorChange) 
addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), doColorChange ) 

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

No te das cuenta que sigue sin tener sentido? 'theVehicle' no esta definido en ninguna parte.

Te aconsejo que vuelvas a lo basico.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
function doColorChange() 
    for i, car in ipairs( getElementsByType( "vehicle" ) ) do 
        local color = {} 
        color[1] = math.random(255) 
        setVehicleColor ( car, color[1] ) 
    end 
end 
  
  
addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), doColorChange ) 

esto es lo ultimo que se me vino a la cabeza ya no tengo mas ideas :S

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

Estas copiando y pegando, no estas estudiando las funciones.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
function doColorChange(doColorChange,Source) 
    setVehicleColor (Source, math.random(255),math.random(255),math.random(255),math.random(255)) 
end 
addEvent("changevehiclecolor", true) 
addEventHandler("changevehiclecolor",getRootElement(),doColorChange) 
addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), doColorChange ) 

asi dices tu?

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

Asi:

addEventHandler ( 'onClientResourceStart', resourceRoot, 
    function ( ) 
        for _, car in ipairs ( getElementsByType 'vehicle' ) do 
            setVehicleColor ( car, math.random ( 0, 255 ), math.random ( 0, 255 ), math.random ( 0, 255 ) ); 
        end 
    end 
) 

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

  • Recently Browsing   0 members

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