->Vehicle color change<-
#1

Hey,

I'm trying to create a miniscript which changes the vehicle's color when you press the 'KEY_SUBMISSION'. But when i press this key, the colors don't change correctly. Can anyone write me some lines how to create it?

Thanks
Nonameman
Reply
#2

I'd recommend you to post the code that youve done so far. I think that would be help you better.
Reply
#3

Quote:
Originally Posted by DeathOnaStick
I'd recommend you to post the code that youve done so far. I think that would be help you better.
Код:
if(PRESSED(KEY_ANALOG_RIGHT))
	{
	  if(IsPlayerInAnyVehicle(playerid))
	  {
	    if(GetPlayerState(playerid) == 2)
	    {
		   new vehicleid = GetPlayerVehicleID(playerid);
		   #define MAX_VEHICLE_COLORS 126
	       for(new c = 0; c < MAX_VEHICLE_COLORS; c++)
		   {
		     ChangeVehicleColor(vehicleid, c, c);
		   }
		   PlayerPlaySound(playerid, 1134, 0.0, 0.0, 0.0);
		}
      }
	}
	return 1;
Reply
#4

Quote:
Originally Posted by Nonameman
Quote:
Originally Posted by DeathOnaStick
I'd recommend you to post the code that youve done so far. I think that would be help you better.
Код:
if(PRESSED(KEY_ANALOG_RIGHT))
	{
	  if(IsPlayerInAnyVehicle(playerid))
	  {
	    if(GetPlayerState(playerid) == 2)
	    {
		  new vehicleid = GetPlayerVehicleID(playerid);
		  #define MAX_VEHICLE_COLORS 126
	      for(new c = 0; c < MAX_VEHICLE_COLORS; c++)
		  {
		     ChangeVehicleColor(vehicleid, c, c);
		   }
		   PlayerPlaySound(playerid, 1134, 0.0, 0.0, 0.0);
		}
      }
	}
	return 1;
Why would you loop it ,if it would result in 126?
Reply
#5

pawn Код:
if(PRESSED(KEY_ANALOG_RIGHT))
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if(!vehicleid) return 0;
   
    if(GetPlayerState(playerid) == 2)
    {
        #define MAX_VEHICLE_COLORS 126
    ChangeVehicleColor(vehicleid, Random(MAX_VEHICLE_COLORS), Random(MAX_VEHICLE_COLORS);
    PlayerPlaySound(playerid, 1134, 0.0, 0.0, 0.0);
    }
    return 1;
}
Reply
#6

Quote:
Originally Posted by Hiddos
Quote:
Originally Posted by Nonameman
Quote:
Originally Posted by DeathOnaStick
I'd recommend you to post the code that youve done so far. I think that would be help you better.
Код:
if(PRESSED(KEY_ANALOG_RIGHT))
	{
	  if(IsPlayerInAnyVehicle(playerid))
	  {
	    if(GetPlayerState(playerid) == 2)
	    {
		  new vehicleid = GetPlayerVehicleID(playerid);
		  #define MAX_VEHICLE_COLORS 126
	      for(new c = 0; c < MAX_VEHICLE_COLORS; c++)
		  {
		     ChangeVehicleColor(vehicleid, c, c);
		   }
		   PlayerPlaySound(playerid, 1134, 0.0, 0.0, 0.0);
		}
      }
	}
	return 1;
Why would you loop it ,if it would result in 126?
I don't know how is 'for' works, just trying to use it

Quote:
Originally Posted by Joe_
pawn Код:
if(PRESSED(KEY_ANALOG_RIGHT))
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if(!vehicleid) return 0;
   
    if(GetPlayerState(playerid) == 2)
    {
        #define MAX_VEHICLE_COLORS 126
    ChangeVehicleColor(vehicleid, Random(MAX_VEHICLE_COLORS), Random(MAX_VEHICLE_COLORS);
    PlayerPlaySound(playerid, 1134, 0.0, 0.0, 0.0);
    }
    return 1;
}
Thanks I don't want to create it like this, but it's better
Reply
#7

That does the same as your code does, altough it sets a random colour (Which I assume was what you was trying to do?)
Reply
#8

No, I know how to use random, I wanted to the user can go through the colors from 0-126. And I think MAX_VEHICLE_COLORS have to be 127 then, i didn't count the 0
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)