Logic help :P
#1

Hello there, I just ran out of Logic :P

So Im trying to think a way to connect 3 vehicles info.

One Vehicle is a truck that is carrying drugs, one is a Plane that will transport those drugs, and the other one is the last truck that will pick them up when the dodo lands. All different vehicles. And they are ANY Walton truck / ANY Dodo plane and Any Yosemite truck. so I cant create a /drug truck/.

How would u do it Need the logic rather than the code itself :P tho some things can only be explained with a line or 2 of code :P

thanks,

aNdReSk



Reply
#2

Create a variable that determines how much drugs is on each vehicle
pawn Код:
new vDrugStash[MAX_VEHICLES];
Then a command or checkpoint that can only be used/shown when the vehicle is at it's dropoff point.
So let's say you buy drugs with the Walton truck from a druglab in LS, that would be a command/checkpoint in LS that determines that they're using the correct vehicle type
pawn Код:
new vehmodel=GetVehicleModel(GetPlayerVehicleID(playerid));
if(vehmodel==478)//478=walton
{
  //buy drugs code
  GivePlayerMoney(playerid,-500);
  vDrugStash[GetPlayerVehicleID(playerid)]+=10;
}
Then that person would drive their truck to the airport where a plane has to be in reach of the player's truck or vice-versa
pawn Код:
new vehmodel=GetVehicleModel(GetPlayerVehicleID(playerid));
if(vehmodel==478)
{
  for(new vehm;vehm<MAX_VEHICLES;vehm++)
  {
    if(GetVehicleModel(vehm)==593)//593=dodo
    {
      new Float:x,Float:y,Float:z;
      GetVehiclePos(vehm,x,y,z);
      if(IsPlayerInRangeOfPoint(playerid,x,y,z))
      {
        //transfer drugs
        vDrugStash[vehm]+=vDrugStash[GetPlayerVehicleID(playerid)];
        vDrugStash[GetPlayerVehicleID(playerid)]=0;
        return 1; //Loop has to end here
      }
    }
  }
  //If the code gets here the player wasn't near a DODO plane
}else{  
  //If the code gets here the player isn't in the Walton anymore, so give error message
}
You would then do the same thing but different vehicle models for the dodo to yosemite truck

Reply
#3

Nice, didnt think of closest vehicle
and since the drugs go from a vehicle to another and dont touch players, that makes the code better since The idea is that other players might steal the drug vehicles

Thanks a lot dude!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)