SA-MP Forums Archive
->Vehicle color change<- - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: ->Vehicle color change<- (/showthread.php?tid=153556)



->Vehicle color change<- - Nonameman - 09.06.2010

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


Re: ->Vehicle color change<- - DeathOnaStick - 09.06.2010

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


Re: ->Vehicle color change<- - Nonameman - 09.06.2010

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;



Re: ->Vehicle color change<- - Hiddos - 09.06.2010

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?


Re: ->Vehicle color change<- - Joe_ - 09.06.2010

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;
}



Re: ->Vehicle color change<- - Nonameman - 09.06.2010

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


Re: ->Vehicle color change<- - Joe_ - 09.06.2010

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


Re: ->Vehicle color change<- - Nonameman - 09.06.2010

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