Set price

Started by Cool, Dec 30, 2016, 08:31 AM

Previous topic - Next topic

Cool

hi i want to make a cmd which get vehicle model and find thats cars which model = i give and set price of all cars which i model id i give i am talking about those ids not the server db  ids
http://murdock.in/wiki/index.php/Vehicle_IDs
if possible Give me a example if you cant give full cmd a example will be help full to complete my command

KAKAN

I can't understand. But from what I understood, first you need to make a function/array. Here, I'll make an array to hold the price.
veh_price <- [
10, //Model ID: 130
11 //Model ID: 131
];
function GetVehModelPrice( veh_model ){
return veh_price[ veh_model - 130 ]; //It works like this: veh Model = 130. Price is in array index 0. So, 130-130 = 0, it will return the first element.
} //NOTE: This will throw error if the index doesn't exist in the array. Use if conditions or try catch to handle them.
Alternatively, you can do it using switch case.
function VehModelPrice( vehModel ){
switch( vehModel ){
case 130:
case 131:
case 132:
              return 10;
default: return 0;
}
} //In this case, if the model is not there, it will return 0.
oh no