05.06.2016, 23:14
So I got bored and starting messing around with samp again and decided to make a script. Basically you start a job, go out and run into one checkpoint then drive to the next checkpoint and rinse and repeat. When you go into the initial checkpoint it destroys it and shows you the next checkpoint to go to. When you get to that checkpoint it destroys it and creates it again. The script is some how confusing the two checkpoints and making one checkpoint react to two different lines of code.
Images: http://imgur.com/a/13ktW Shown in order from the first checkpoint to what happens when you run into the second checkpoint.
This should be just about everything needed to find a solution. The script mixes WHCP[playerid] (The checkpoint inside the warehouse) with WHCP2[playerid] (checkpoint on the truck) as you can tell from the message sent when you go into the checkpoints.
Images: http://imgur.com/a/13ktW Shown in order from the first checkpoint to what happens when you run into the second checkpoint.
This should be just about everything needed to find a solution. The script mixes WHCP[playerid] (The checkpoint inside the warehouse) with WHCP2[playerid] (checkpoint on the truck) as you can tell from the message sent when you go into the checkpoints.
pawn Код:
CMD:delivery(playerid,params[])
{
if(InDelivery[playerid] > 0) return SendClientMessage(playerid,-1,"You are already doing a delivery.");
if(IsPlayerInDynamicCP(playerid,DeskCP1))
{
if(IsVehicleInRangeOfPoint(DFT1[0],6,DFTLocation1[0][0],DFTLocation1[0][1],DFTLocation1[0][2]))
{
ShowPlayerDialog(playerid, DESKCP, DIALOG_STYLE_LIST, "Please Choose Your Vehicle Type.","Semi Trailer\nBox Truck\nFlatbed","Select","Cancel");
DFTLOC[playerid] = 11;
}
else if(IsVehicleInRangeOfPoint(DFT1[1],6,DFTLocation1[1][0],DFTLocation1[1][1],DFTLocation1[1][2]))
{
ShowPlayerDialog(playerid, DESKCP, DIALOG_STYLE_LIST, "Please Choose Your Vehicle Type.","Semi Trailer\nBox Truck\nFlatbed","Select","Cancel");
DFTLOC[playerid] = 12;
}
else if(IsVehicleInRangeOfPoint(DFT1[2],6,DFTLocation1[2][0],DFTLocation1[2][1],DFTLocation1[2][2]))
{
ShowPlayerDialog(playerid, DESKCP, DIALOG_STYLE_LIST, "Please Choose Your Vehicle Type.","Semi Trailer\nBox Truck\nFlatbed","Select","Cancel");
DFTLOC[playerid] = 13;
} else return SendClientMessage(playerid,-1,"Unavailable");
}
//else return SendClientMessage(playerid,-1,"Unavailable");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DESKCP)
{
if(!response) return SendClientMessage(playerid,-1,"Come back later then");
switch(listitem)
{
case 0: //Semi Trailer
{
SendClientMessage(playerid,-1,"Nothing 1");
}
case 1: //Box Truck
{
SendClientMessage(playerid,-1,"Nothing 2");
}
case 2: //Flatbed
{
new Random = random(sizeof(WHRandomCP1));
InDelivery[playerid] = 3;
WHCP[playerid] = CreateDynamicCP(WHRandomCP1[Random][0], WHRandomCP1[Random][1], WHRandomCP1[Random][2], 2.5, -1, -1, playerid);
SendClientMessage(playerid,-1,"Alright, head on out and grab a fork. Kinda short handed so you will load it yourself.");
ForkOBJ[playerid] = floatround(WHRandomCP1[Random][3]);
}
}
return 1;
}
return 0;
}
public OnPlayerEnterDynamicCP(playerid, STREAMER_TAG_CP checkpointid)
{
if(checkpointid == DropCP[playerid])
{
DestroyDynamicCP(DropCP[playerid]);
SendClientMessage(playerid,-1,"Thank you. Return The DFT When You Are Done.");
GivePlayerMoney(playerid,500);
ForkOBJ[playerid] = 0;
InDelivery[playerid] = 0;
DestroyDynamicObject(WHOBJ[playerid][0]);
DestroyDynamicObject(WHOBJ[playerid][1]);
DestroyDynamicObject(WHOBJ[playerid][2]);
}
else if(checkpointid == WHCP[playerid])
{
new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
if(pveh == 530)
{
SetTimerEx("PlaceOBJ",2000,false,"i",playerid); //att to fork
SendClientMessage(playerid,-1,"Take The Pallet and Load It Onto The Designated Truck.");
DestroyDynamicCP(WHCP[playerid]);
switch(DFTLOC[playerid])
{
case 11: //1-1
{
DestroyDynamicCP(WHCP[playerid]);
WHCP2[playerid] = CreateDynamicCP(2189.3896,-2297.3752,14.7008,2.5,-1,-1,playerid); // truck spot 1-1
}
case 12: //2-1
{
DestroyDynamicCP(WHCP[playerid]);
WHCP2[playerid] = CreateDynamicCP(2193.3193,-2293.7217,14.6991,2.5,-1,-1,playerid); // truck spot 2-1
}
case 13: //3-1
{
DestroyDynamicCP(WHCP[playerid]);
WHCP2[playerid] = CreateDynamicCP(2197.6240,-2289.9409,14.6635,2.5,-1,-1,playerid); // truck spot 3-1
}
case 14: //1-2
{
DestroyDynamicCP(WHCP[playerid]);
WHCP2[playerid] = CreateDynamicCP(2191.5327,-2299.5862,14.6958,2.5,-1,-1,playerid); // truck spot 1-2
}
case 15: //2-2
{
DestroyDynamicCP(WHCP[playerid]);
WHCP2[playerid] = CreateDynamicCP(2195.5876,-2295.9519,14.7005,2.5,-1,-1,playerid); // truck spot 2-2
}
case 16: //3-2
{
DestroyDynamicCP(WHCP[playerid]);
WHCP2[playerid] = CreateDynamicCP(2199.1726,-2291.5771,14.6669,2.5,-1,-1,playerid); // truck spot 3-2
}
case 17: //1-3
{
DestroyDynamicCP(WHCP[playerid]);
WHCP2[playerid] = CreateDynamicCP(2193.8723,-2301.9988,14.5281,2.5,-1,-1,playerid); // truck spot 1-3
}
case 18: //2-3
{
DestroyDynamicCP(WHCP[playerid]);
WHCP2[playerid] = CreateDynamicCP(2197.6196,-2297.9495,14.5308,2.5,-1,-1,playerid); // truck spot 2-3
}
case 19: //3-3
{
DestroyDynamicCP(WHCP[playerid]);
WHCP2[playerid] = CreateDynamicCP(2201.6462,-2294.1716,14.5260,2.5,-1,-1,playerid); // truck spot 3-3
}
}
}
}
else if(checkpointid == WHCP2[playerid])
{
new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
if(pveh == 530)
{
DestroyDynamicCP(WHCP2[playerid]);
switch(DFTLOC[playerid])
{
case 11: //loc 1-2
{
SetTimerEx("PlaceOBJ2",2000,false,"i",playerid); //att to dft
DFTLOC[playerid] = 14;
new Random = random(sizeof(WHRandomCP1));
WHCP[playerid] = CreateDynamicCP(WHRandomCP1[Random][0], WHRandomCP1[Random][1], WHRandomCP1[Random][2], 2.5, -1, -1, playerid);
ForkOBJ[playerid] = floatround(WHRandomCP1[Random][3]);
}
case 12://loc 2-2
{
SetTimerEx("PlaceOBJ2",2000,false,"i",playerid); //att to dft
DFTLOC[playerid] = 15;
new Random = random(sizeof(WHRandomCP1));
WHCP[playerid] = CreateDynamicCP(WHRandomCP1[Random][0], WHRandomCP1[Random][1], WHRandomCP1[Random][2], 2.5, -1, -1, playerid);
ForkOBJ[playerid] = floatround(WHRandomCP1[Random][3]);
}
case 13: //loc 3-2
{
SetTimerEx("PlaceOBJ2",2000,false,"i",playerid); //att to dft
DFTLOC[playerid] = 16;
new Random = random(sizeof(WHRandomCP1));
WHCP[playerid] = CreateDynamicCP(WHRandomCP1[Random][0], WHRandomCP1[Random][1], WHRandomCP1[Random][2], 2.5, -1, -1, playerid);
ForkOBJ[playerid] = floatround(WHRandomCP1[Random][3]);
}
case 14: //loc 1-3 Last Pallet
{
SetTimerEx("PlaceOBJ2",2000,false,"i",playerid); //att to dft
DFTLOC[playerid] = 17;
new Random = random(sizeof(WHRandomCP1));
WHCP[playerid] = CreateDynamicCP(WHRandomCP1[Random][0], WHRandomCP1[Random][1], WHRandomCP1[Random][2], 2.5, -1, -1, playerid);
ForkOBJ[playerid] = floatround(WHRandomCP1[Random][3]);
}
case 15: //loc 2-3
{
SetTimerEx("PlaceOBJ2",2000,false,"i",playerid); //att to dft
DFTLOC[playerid] = 18;
new Random = random(sizeof(WHRandomCP1));
WHCP[playerid] = CreateDynamicCP(WHRandomCP1[Random][0], WHRandomCP1[Random][1], WHRandomCP1[Random][2], 2.5, -1, -1, playerid);
ForkOBJ[playerid] = floatround(WHRandomCP1[Random][3]);
}
case 16: //loc 3-3
{
SetTimerEx("PlaceOBJ2",2000,false,"i",playerid); //att to dft
DFTLOC[playerid] = 19;
new Random = random(sizeof(WHRandomCP1));
WHCP[playerid] = CreateDynamicCP(WHRandomCP1[Random][0], WHRandomCP1[Random][1], WHRandomCP1[Random][2], 2.5, -1, -1, playerid);
ForkOBJ[playerid] = floatround(WHRandomCP1[Random][3]);
}
case 17:
{
SetTimerEx("PlaceOBJ2",2000,false,"i",playerid); //att to dft
SendClientMessage(playerid,-1,"Hop into the DFT and delivery the contents to it's location.");
DropCP[playerid] = CreateDynamicCP(2378.8801,-2010.9473,14.1771,-1,-1,playerid,1000);
}
case 18:
{
SetTimerEx("PlaceOBJ2",2000,false,"i",playerid); //att to dft
SendClientMessage(playerid,-1,"Hop into the DFT and delivery the contents to it's location.");
DropCP[playerid] = CreateDynamicCP(2378.8801,-2010.9473,14.1771,-1,-1,playerid,1000);
}
case 19:
{
SetTimerEx("PlaceOBJ2",2000,false,"i",playerid); //att to dft
SendClientMessage(playerid,-1,"Hop into the DFT and delivery the contents to it's location.");
DropCP[playerid] = CreateDynamicCP(2378.8801,-2010.9473,14.1771,-1,-1,playerid,1000);
}
}
}
}
//attobj
return 1;
}
forward PlaceOBJ(playerid);
public PlaceOBJ(playerid)//Fork
{
if(ForkOBJ[playerid] == 2991)
{
//
WHOBJ[playerid][0] = CreateDynamicObject(1685,0,0,0,0,0,0);
AttachDynamicObjectToVehicle(WHOBJ[playerid][0],GetPlayerVehicleID(playerid),0,2,0.5,0,0,0);
}
if(ForkOBJ[playerid] == 2973)
{
//2973 0 1.5 0 0 0 0
WHOBJ[playerid][0] = CreateDynamicObject(2973,0,1.5,0,0,0,0);
AttachDynamicObjectToVehicle(WHOBJ[playerid][0],GetPlayerVehicleID(playerid),0,1.5,0,0,0,0);
}
if(ForkOBJ[playerid]== 1685)
{
//1685 0 1.2 .5 0 0 0
WHOBJ[playerid][0] = CreateDynamicObject(1685,0,0,0,0,0,0);
AttachDynamicObjectToVehicle(WHOBJ[playerid][0],GetPlayerVehicleID(playerid),0,1.2,0.5,0,0,0);
}
return 1;
}
forward PlaceOBJ2(playerid);
public PlaceOBJ2(playerid)//DFT
{
if(DFT1[0])
{
switch(DFTLOC[playerid])
{
case 11, 14, 17:
{
if(ForkOBJ[playerid] == 2991)
{
DestroyDynamicObject(WHOBJ[playerid][0]);
WHOBJ[playerid][2] = CreateDynamicObject(1685,0,0,0,0,0,0);
AttachDynamicObjectToVehicle(WHOBJ[playerid][2],DFT1[0],0,2,0.5,0,0,0);
}
}
case 12, 15, 18:
{
if(ForkOBJ[playerid] == 2973)
{
//2973 0 1 -.25 0 0 0
DestroyDynamicObject(WHOBJ[playerid][0]);
WHOBJ[playerid][1] = CreateDynamicObject(2973,0,1.5,0,0,0,0);
AttachDynamicObjectToVehicle(WHOBJ[playerid][1],DFT1[0],0,1,-0.25,0,0,0);
}
}
case 13, 16, 19:
{
if(ForkOBJ[playerid] == 1685)
{
//1685 0 1.2 .5 0 0 0
DestroyDynamicObject(WHOBJ[playerid][0]);
WHOBJ[playerid][0] = CreateDynamicObject(1685,0,0,0,0,0,0);
AttachDynamicObjectToVehicle(WHOBJ[playerid][0],DFT1[0],0,1.2,0.5,0,0,0);
}
}
}
}
if(DFT1[1])
{
switch(DFTLOC[playerid])
{
case 11, 14, 17:
{
if(ForkOBJ[playerid] == 2991)
{
DestroyDynamicObject(WHOBJ[playerid][0]);
WHOBJ[playerid][2] = CreateDynamicObject(1685,0,0,0,0,0,0);
AttachDynamicObjectToVehicle(WHOBJ[playerid][2],DFT1[1],0,2,0.5,0,0,0);
}
}
case 12, 15, 18:
{
if(ForkOBJ[playerid] == 2973)
{
DestroyDynamicObject(WHOBJ[playerid][0]);
WHOBJ[playerid][1] = CreateDynamicObject(2973,0,1.5,0,0,0,0);
AttachDynamicObjectToVehicle(WHOBJ[playerid][1],DFT1[1],0,1,-0.25,0,0,0);
}
}
case 13, 16, 19:
{
if(ForkOBJ[playerid] == 1685)
{
DestroyDynamicObject(WHOBJ[playerid][0]);
WHOBJ[playerid][0] = CreateDynamicObject(1685,0,0,0,0,0,0);
AttachDynamicObjectToVehicle(WHOBJ[playerid][0],DFT1[1],0,1.2,0.5,0,0,0);
}
}
}
}
if(DFT1[2])
{
switch(DFTLOC[playerid])
{
case 11, 14, 17:
{
if(ForkOBJ[playerid] == 2991)
{
DestroyDynamicObject(WHOBJ[playerid][0]);
WHOBJ[playerid][2] = CreateDynamicObject(1685,0,0,0,0,0,0);
AttachDynamicObjectToVehicle(WHOBJ[playerid][2],DFT1[2],0,2,0.5,0,0,0);
}
}
case 12, 15, 18:
{
if(ForkOBJ[playerid] == 2973)
{
DestroyDynamicObject(WHOBJ[playerid][0]);
WHOBJ[playerid][1] = CreateDynamicObject(2973,0,1.5,0,0,0,0);
AttachDynamicObjectToVehicle(WHOBJ[playerid][1],DFT1[2],0,1,-0.25,0,0,0);
}
}
case 13, 16, 19:
{
if(ForkOBJ[playerid] == 1685)
{
DestroyDynamicObject(WHOBJ[playerid][0]);
WHOBJ[playerid][0] = CreateDynamicObject(1685,0,0,0,0,0,0);
AttachDynamicObjectToVehicle(WHOBJ[playerid][0],DFT1[2],0,1.2,0.5,0,0,0);
}
}
}
}
return 1;
}