[SOLVED]: Random Color(s) in command.
#1

Hi, When I Typ /help there come some text help. The Color is Orange but I want to change that random. Ex: When I typ /help 2-3 times the color must change .. Anybody who this code can make please? (Sory for my bad english.)
And yes I've searched.
Reply
#2

just create an Array of colors and then just access it by random(sizeof(YourArray));
Reply
#3

example of it in my server..

Code:
  new ServerColors[21] = { // SERVER MESSAGE COLORS.
	  0xADFF2FFF, 0x90EE90FF, 0xFF4500FF, 0x4169FFFF, 0x9ACD32FF,
	  0xFFFF00FF, 0xDA70D6FF, 0x87CEFAFF, 0xFAFAD2FF, 0xFAEBD7FF,
  	0x6495EDFF, 0x4EEE94FF, 0xC0FF3EFF, 0xFFFF00FF, 0xFFB90FFF,
	  0x7171C6FF, 0x9B30FFFF, 0xA2B5CDFF, 0xC0FF3EFF, 0xFFD700FF
  };
Code:
  if(strcmp(cmdtext, "/LV", true) == 0)
  {
    if(IsPlayerInAnyVehicle(playerid))
    {
      new VehicleID;
      VehicleID = GetPlayerVehicleID(playerid);
      new rand = random(2);
      if (rand == 0)
			{
	      SetVehiclePos(VehicleID, 2055.5376,1917.5587,12.1683);
	      SetVehicleZAngle(VehicleID, 178.1285);
	    }
			else if (rand == 1)
      {
        SetVehiclePos(VehicleID, 2039.5123,1916.5410,12.1667);
	      SetVehicleZAngle(VehicleID, 182.2019);
		  }
    }
	  else
	  {
	    SetPlayerPos(playerid, 2004.4939,1914.2422,40.3516);
	    SetPlayerFacingAngle(playerid, 274.3228);
    }
    GameTextForPlayer(playerid,"~w~ Las Ventruas",3000,1);
		SCM(playerid, ServerColors[random(sizeof(ServerColors))], "Welcome - LV [Las Ventruas]");
    SetPlayerInterior(playerid, 0);
	  return 1;
}
Reply
#4

Quote:
Originally Posted by borisblat
example of it in my server..

Code:
  new ServerColors[21] = { // SERVER MESSAGE COLORS.
	  0xADFF2FFF, 0x90EE90FF, 0xFF4500FF, 0x4169FFFF, 0x9ACD32FF,
	  0xFFFF00FF, 0xDA70D6FF, 0x87CEFAFF, 0xFAFAD2FF, 0xFAEBD7FF,
  	0x6495EDFF, 0x4EEE94FF, 0xC0FF3EFF, 0xFFFF00FF, 0xFFB90FFF,
	  0x7171C6FF, 0x9B30FFFF, 0xA2B5CDFF, 0xC0FF3EFF, 0xFFD700FF
  };
Code:
  if(strcmp(cmdtext, "/LV", true) == 0)
  {
    if(IsPlayerInAnyVehicle(playerid))
    {
      new VehicleID;
      VehicleID = GetPlayerVehicleID(playerid);
      new rand = random(2);
      if (rand == 0)
			{
	      SetVehiclePos(VehicleID, 2055.5376,1917.5587,12.1683);
	      SetVehicleZAngle(VehicleID, 178.1285);
	    }
			else if (rand == 1)
      {
        SetVehiclePos(VehicleID, 2039.5123,1916.5410,12.1667);
	      SetVehicleZAngle(VehicleID, 182.2019);
		  }
    }
	  else
	  {
	    SetPlayerPos(playerid, 2004.4939,1914.2422,40.3516);
	    SetPlayerFacingAngle(playerid, 274.3228);
    }
    GameTextForPlayer(playerid,"~w~ Las Ventruas",3000,1);
		SCM(playerid, ServerColors[random(sizeof(ServerColors))], "Welcome - LV [Las Ventruas]");
    SetPlayerInterior(playerid, 0);
	  return 1;
}
Thank you man

SOLVED
Reply
#5

Don't forget to change the topic's subject to [SOLVED].
Reply
#6

Quote:
Originally Posted by cοοp
Don't forget to change the topic's subject to [SOLVED].
Ow yea okй thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)