Random & Round
#5

what if i want my minimum to be 200 and my maximum to be 5000?

its only any good if i want double my minimum to be my maximum.

The script is written to sell vehicles. this is what i have:

Код:
if(strcmp(cmdtext, "/sell", true) == 0){
if(IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) != 0){
 SendClientMessage(playerid, 0xFFFFFFFF, "You are not driving this vehicle!");
}
if(!IsPlayerInAnyVehicle(playerid)){
 SendClientMessage(playerid, 0xFFFFFFFF, "Your not in a vehicle!");
}
if(IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0){

     new carvalue;
     new carvaluedamaged1;
     new carvaluedamaged2;
     new currentveh;
	   	 new Float:health;
	   	 
     currentveh = GetPlayerVehicleID(playerid);

     GetVehicleHealth(currentveh, health);
  // return SendClientMessage(playerid,COLOR_RED,"Doesn't need repairing!");
	   	carvaluedamaged1 = random(2500);
    carvaluedamaged2 = random(900);
    
	   	 if(health == 1000){
     carvalue = random(5000);
     }
     else if (health >999){
	   	 carvalue = carvaluedamaged1;
	   	 }
	   	 else if (health >550){
	   	 carvalue = carvaluedamaged2;
	   	 }
if(!IsPlayerInInvalidSellVehicle(playerid)){
     DestroyVehicle(currentveh);
     format(string, sizeof(string), "You get %i for your vehicle!", carvalue);
     SendClientMessage(playerid, 0xFFFFFFFF, string);
     GivePlayerMoney(playerid, carvalue);
}
else{
  SendClientMessage(playerid, 0xFFFFFFFF, "This vehicle can't be sold!");
}

}
return 1;
}
im not even sure if the health bit is working properly at the moment but i cant see why it wouldnt.

This script does work.
I created this function: IsPlayerInInvalidSellVehicle(playerid)
using the array feature someone else used for their IsPlayerInInvalidNosVehicle() funtion and just changed the name and the vehicle ids

ok well if the random feature isnt flexible enough is there ANY sort of round feature this is the main reason i created the post.
Reply


Messages In This Thread
Random & Round - by adsy - 04.01.2010, 22:58
Re: Random & Round - by MerLow - 04.01.2010, 23:56
Re: Random & Round - by adsy - 05.01.2010, 23:25
Re: Random & Round - by [HiC]TheKiller - 05.01.2010, 23:38
Re: Random & Round - by adsy - 06.01.2010, 12:56

Forum Jump:


Users browsing this thread: 1 Guest(s)