Liberty Unleashed
Scripting => Script Help => Topic started by: Peavy on June 08, 2013, 10:52:44 pm
-
player.Vehicle.RGBColour1 = Colour( Co, Co, Co );
That is the line, anyone see a issue in it? I'm using the line I got from Pop.
-
Please, post on the forum instead of PMing members. Also, Co is not defined, and has no sense.
In the Colour( ) function, you pass bytes ( in our case, integers ). Which range from 0 to 255, according to RGB Format ( red,green,blue ), each of the integers representing the intensity of the colour, 255,255,255 would be white, 0,0,0 would be black, 255,0,0 red, and so on.
-
Please, post on the forum instead of PMing members. Also, Co is not defined, and has no sense.
In the Colour( ) function, you pass bytes ( in our case, integers ). Which range from 0 to 255, according to RGB Format ( red,green,blue ), each of the integers representing the intensity of the colour, 255,255,255 would be white, 0,0,0 would be black, 255,0,0 red, and so on.
I didn't PM anyone, he randomly PM'd it to me.
Anyways, so what is it that I'm missing?
Also I think I should probably stop listening to Pop considering that he doesn't ever tell me what I did wrong and he gave me that bad string.
-
I didn't PM anyone, he randomly PM'd it to me.
Anyways, so what is it that I'm missing?
Also I think I should probably stop listening to Pop considering that he doesn't ever tell me what I did wrong and he gave me that bad string.
Co is not defined, and has no sense.
In the Colour( ) function, you pass bytes ( in our case, integers ). Which range from 0 to 255, according to RGB Format ( red,green,blue ), each of the integers representing the intensity of the colour, 255,255,255 would be white, 0,0,0 would be black, 255,0,0 red, and so on.
Example of usage: player.Vehicle.RGBColour1 = Colour(255,255,0); // This would make the car yellow
By combining R(ed), G(reen) and B(lue), you can obtain new colours.
Please read the entire posts.
-
I did read the entire post, I know how the RGB scale works and such.
So I should take and replace "Co" with an integer?
-
yes, each of them.
-
yes, each of them.
Alright, thanks.
I apologize in advance if I somehow mess this up while fixing.
-
:( man Co mean the color.ID
-
:( man Co mean the color.ID
There is no such thing as color.ID. Check up the RGB Scale next time.
-
:( man Co mean the color.ID
There is no such thing as color.ID. Check up the RGB Scale next time.
Shit Man ,I Mean Like This > player.Vehicle.RGBColour1 = Colour(255 ,0 ,0 );
-
Well I managed to make it change to black and nothing more, should I use what mido_pop said and put the 255 in the first 0?
-
It depends on what color you want for the car. Using Colour(255,0,0) will turn it red.
Tell us what color are you trying to use, and maybe we can help.
-
Oh, you must have misunderstood me. I mean a command that lets you select the color, not have a set color.
-
Maybe this will help. It's untested and a pretty lengthy piece of code, but it should do the trick.
function onPlayerCommand( player, command, params )
{
switch( command.tolower() )
{
case "c1":
if( player.Vehicle )
{
if( params )
{
if( NumTok( params, " " ) == 3 )
{
local red = GetTok( params, " ", 1 );
local green = GetTok( params, " ", 2 );
local blue = GetTok( params, " ", 3 );
if( IsNum( red ) && IsNum( blue ) && IsNum( red ) )
{
if( red >= 0 && red <= 255 && green >= 0 && green <= 255 && blue >= 0 && blue <= 255 )
{
player.Vehicle.RGBColour1 = Colour( red, green, blue );
}
else
{
MessagePlayer("All the colors must be between 0 and 255!", player, Colour( 255, 0, 0 ) );
}
}
else
{
MessagePlayer("All the colors must be numbers!", player, Colour( 255, 0, 0 ) );
}
}
else
{
MessagePlayer("Usage: /c1 <red> <green> <blue>", player, Colour( 200, 200, 200 ) );
}
}
else
{
MessagePlayer("Usage: /c1 <red> <green> <blue>", player, Colour( 200, 200, 200 ) );
}
}
else
{
MessagePlayer("You must be in a vehicle!", player, Colour( 255, 0, 0 ) );
}
break;
case "c2":
if( player.Vehicle )
{
if( params )
{
if( NumTok( params, " " ) == 3 )
{
local red = GetTok( params, " ", 1 );
local green = GetTok( params, " ", 2 );
local blue = GetTok( params, " ", 3 );
if( IsNum( red ) && IsNum( blue ) && IsNum( red ) )
{
if( red >= 0 && red <= 255 && green >= 0 && green <= 255 && blue >= 0 && blue <= 255 )
{
player.Vehicle.RGBColour2 = Colour( red, green, blue );
}
else
{
MessagePlayer("All the colors must be between 0 and 255!", player, Colour( 255, 0, 0 ) );
}
}
else
{
MessagePlayer("All the colors must be numbers!", player, Colour( 255, 0, 0 ) );
}
}
else
{
MessagePlayer("Usage: /c2 <red> <green> <blue>", player, Colour( 200, 200, 200 ) );
}
}
else
{
MessagePlayer("Usage: /c2 <red> <green> <blue>", player, Colour( 200, 200, 200 ) );
}
}
else
{
MessagePlayer("You must be in a vehicle!", player, Colour( 255, 0, 0 ) );
}
break;
}
}
-
I'm about to test it. Sorry I hadn't checked here yesterday, stuff came up.