BikeDriver, that is indeed how its gonna work :p The idea of adding Transport By foot is nice too. I would use a term like this:
Drugs = 5 dollar per kilogram per meter wich means if 5kg drugs has to be transported over 1000 meters u will get 5 * 1000 * 5 = 25 000 dollar
Food = 1 dollar per kilogram per meter ==> 1 * 1000 * 5 =500 dollar.
Disctance is calculated between 2 non equal delivery locations.
//CODE I MADE
public OnFilterScriptInit()
{
PackageWeightCategory[0]= 1;
PackageWeightCategory[1]= 5;
PackageWeightCategory[2]= 10;
PackageWeightCategory[3]= 25;
PackageWeightCategory[4]= 50;
PackageWeightCategory[5]= 100;
PackageWeightCategory[6]= 250;
PackageWeightCategory[7]= 500;
PackageWeightCategory[8]= 1000;
PackageWeightCategory[9]= 2500;
PackageWeightCategory[10]= 5000;
PackageWeightCategory[11]= 10000;
PackageWeightCategory[12]= 25000;
PackageWeightCategory[13]= 50000;
format(PackageNames[0],sizeof(PackageNames),"Mail");
PackageValues[0]=1;
format(PackageNames[1],sizeof(PackageNames),"Food");
PackageValues[1]=1;
format(PackageNames[2],sizeof(PackageNames),"Drugs");
PackageValues[2]=7;
format(PackageNames[3],sizeof(PackageNames),"Dildos");
PackageValues[3]=2;
format(PackageNames[4],sizeof(PackageNames),"Goods");
PackageValues[4]=3;
format(PackageNames[5],sizeof(PackageNames),"Guns");
PackageValues[5]=4;
format(PackageLocationNames[0],sizeof(PackageLocationNames),"Post office");
PackageLocationX[0] = 2168.52;
PackageLocationY[0] = 1679.87;
PackageLocationZ[0] = 10.39;
format(PackageLocationNames[1],sizeof(PackageLocationNames),"Caligulas");
PackageLocationX[1] = 2168.52;
PackageLocationY[1] = 1679.87;
PackageLocationZ[1] = 10.39;
format(PackageLocationNames[2],sizeof(PackageLocationNames),"South Ammunation");
PackageLocationX[2] = 2200.073486;
PackageLocationY[2] = 934.338195;
PackageLocationZ[2] = 10.37;
format(PackageLocationNames[3],sizeof(PackageLocationNames),"Depot");
PackageLocationX[3] = 1701.284667;
PackageLocationY[3] = 1039.501831;
PackageLocationZ[3] = 10.376438;
format(PackageLocationNames[4],sizeof(PackageLocationNames),"Sex Shop");
PackageLocationX[4] = 2090.695556;
PackageLocationY[4] = 2074.238281;
PackageLocationZ[4] = 10.384755;
format(PackageLocationNames[5],sizeof(PackageLocationNames),"City Planning Department");
PackageLocationX[5] = 2420.118896;
PackageLocationY[5] = 1123.618164;
PackageLocationZ[5] = 10.359607;
public CreatePackage()
{
//CREATES NEW PACKAGEID
if(PackageExists==0) //CHECKS IF PACKAGEID IS ALRTEADY OCCUPIED
{
PackageExists=0;
//GENERATE NUMBER FOR LOCATION
new RandomLocation1;
new RandomLocation2;
new RandomGood;
RandomLocation1 = random(MAX_LOCATIONS);
format(String,sizeof(String),"Location1: %i",RandomLocation1);
SendClientMessageToAll(YELLOW,String);
//CREATE PICKUP AND DEFINE LOCATION NAME
DestroyPickup(PackagePickup);
PackagePickup = CreatePickup(1271, 14, PackageLocationX[RandomLocation1],PackageLocationY[RandomLocation1],PackageLocationZ[RandomLocation1], 0);
format(PackageFromName,sizeof(PackageFromName),"%s", PackageLocationNames[RandomLocation1]);
PackageFromX=PackageLocationX[RandomLocation1];
PackageFromY=PackageLocationY[RandomLocation1];
PackageFromZ=PackageLocationZ[RandomLocation1];
//GENERATE DELIVERYLOCATION WICH IS NOT EQUAL TO ORIGINAL LOCATION
do
{
RandomLocation2= random(MAX_LOCATIONS);
format(String,sizeof(String),"Location2: %i",RandomLocation2);
SendClientMessageToAll(YELLOW,String);
}
while(RandomLocation2 == RandomLocation1);
format(PackageToName,sizeof(PackageToName),"%s", PackageLocationNames[RandomLocation2]);
PackageToX=PackageLocationX[RandomLocation2];
PackageToY=PackageLocationY[RandomLocation2];
PackageToZ=PackageLocationZ[RandomLocation2];
//CALCULATE DISTANCE
new Float:XDistance;
new Float:YDistance;
new Float:ZDistance;
new Float:term1;
new Float:term2;
new Float:term3;
new Float:term4;
new Float:FullDistance;
XDistance = PackageFromX - PackageToX;
YDistance = PackageFromY - PackageToY;
ZDistance = PackageFromZ - PackageToZ;
term1 = floatpower(XDistance,2) + floatpower(YDistance,2); //CALCULATE FLAT DISTANCE
term2 = floatsqroot(term1); //CALCULATE FLAT DISTANCE
term3 = floatpower(term2,2) + floatpower(ZDistance,2); //CALCULATE FLAT + HEIGHT DISTANCE
term4 = floatsqroot(term3);
FullDistance = term4;
PackageTransportDistance = floatround(FullDistance);
//CALCULATE TIME LIMIT
//PackageTimeLimit = 300; //STANDARD 5 MINUTES FOR TESTING
//STILL HAVE TO FIND A FORMULA TO CALCULATE TIME IN FUNCTION OF DISTANCE AND WEIGHT AND AVERAGE SPEED OF VEHICLE USABLE
//PROPERTIES OF PACKAGE
RandomGood = random(MAX_GOODS);
format(PackageName,sizeof(PackageName),"%s", PackageNames[RandomGood]); //CREATE RANDOM GOOD
PackageWeight = PackageWeightCategory[random(MAX_WEIGHTS)]; //CREATE RANDOM WEIGHT
PackageValue = floatround(PackageWeight * PackageValues[RandomGood] * PackageTransportDistance); //PACKAGE VALUE IS WEIGHT * DISTANCE * VALUE PER KILO PER METER
PackagePenalty = floatround((PackageValue / 100) * 10); //PENALTY IS 10 PERECENT OF TOTAL VALUE
format(String,sizeof(String),"New Package at %s: %i kg of %s to %s (%i meters). Reward: %i (Penalty: %i)",PackageFromName,PackageWeight,PackageName,PackageToName,PackageTransportDistance,PackageValue,PackagePenalty); //MESSAGE
SendClientMessageToAll(YELLOW,String);
}
else
{
}
}
This works, with this script a random package is created.
Now im making list with modelids and if they are allowed and their weight capacity, also a control function to see if the player can handle the package.
note: i like scripting for fun, so even if its not implementd, i just do it for the fun of it :p