YCMD:work(playerid, params[], help)
{
if(IsWorking[playerid] == 1) return SendClientMessage(playerid, COLOR_WHITE, "Already working.");
for(new j = 1; j < MAX_JOBS; j++)
{
if(PlayerToPoint(3.0, playerid, JobInfo[j][jPosX], JobInfo[j][jPosY], JobInfo[j][jPosZ]) && j != 7)
{
switch(j)
{
case 1:
{
}
case 2:
{
PWarehouseCP[playerid] = 2;
PWarehouseCurrent[playerid] = 0;
IsWorking[playerid] = 1;
new randn = random(sizeof(WarehouseExteriorCP));
SetPlayerCheckpoint(playerid, WarehouseExteriorCP[randn][0], WarehouseExteriorCP[randn][1], WarehouseExteriorCP[randn][2], 1.0);
SetDestination(playerid, WarehouseExteriorCP[randn][0], WarehouseExteriorCP[randn][1], WarehouseExteriorCP[randn][2]);
}
case 3:
{
}
case 4:
{
}
case 5:
{
ShowPlayerDialog(playerid, DIALOG_TRUCKER, DIALOG_STYLE_TABLIST_HEADERS, "Choose the transport type", "Type\tLegal/Illegal\tAvailable routes\tReward\nFood\tLegal\t25\t{4AE87D}${FFFFFF}\nElectronics\tLegal\t25\t{4AE87D}${FFFFFF}\nGas/Petrol\tLegal\t15\t{4AE87D}${FFFFFF}\nCar Theft\tIllegal\t2\t{4AE87D}${FFFFFF} + {F37138}special rewards{FFFFFF}", "Choose", "Cancel");
new randn = random(sizeof(TruckStart));
VJob[playerid] = CreateVehicle(515, TruckStart[randn][0], TruckStart[randn][1], TruckStart[randn][2], TruckStart[randn][3], -1, -1, -1);
PutPlayerInVehicle(playerid, VJob[playerid], 0);
IsWorking[playerid] = 1;
SetDestination(playerid, 2502.9927,2778.0164,10.8203);
ShowJobBox(playerid);
UpdateJobBox(playerid);
}
}
}
}
return 1;
}
if(!PlayerToPoint(3.0, .... return SCM( you are not near a job )
forward GetJobID(playerid); public GetJobID(playerid) { for(new j = 1; j < MAX_JOBS; j++) { if(IsPlayerInRangeOfPoint(playerid, 3, JobInfo[j][jPosX], JobInfo[j][jPosY], JobInfo[j][jPosZ])) return j; } return 0; } YCMD:work(playerid, params[], help) { if(IsWorking[playerid] == 1) return SendClientMessage(playerid, COLOR_WHITE, "Already working."); if(GetJobID(playerid) == 0) return SendClientMessage(playerid, COLOR_WHITE, "You need to be near a job pickup"); else { new j = GetJobID(playerid); switch(j) { case 1: { } case 2: { PWarehouseCP[playerid] = 2; PWarehouseCurrent[playerid] = 0; IsWorking[playerid] = 1; new randn = random(sizeof(WarehouseExteriorCP)); SetPlayerCheckpoint(playerid, WarehouseExteriorCP[randn][0], WarehouseExteriorCP[randn][1], WarehouseExteriorCP[randn][2], 1.0); SetDestination(playerid, WarehouseExteriorCP[randn][0], WarehouseExteriorCP[randn][1], WarehouseExteriorCP[randn][2]); } case 3: { } case 4: { } case 5: { ShowPlayerDialog(playerid, DIALOG_TRUCKER, DIALOG_STYLE_TABLIST_HEADERS, "Choose the transport type", "Type\tLegal/Illegal\tAvailable routes\tReward\nFood\tLegal\t25\t{4AE87D}${FFFFFF}\nElectronics\tLegal\t25\t{4AE87D}${FFFFFF}\nGas/Petrol\tLegal\t15\t{4AE87D}${FFFFFF}\nCar Theft\tIllegal\t2\t{4AE87D}${FFFFFF} + {F37138}special rewards{FFFFFF}", "Choose", "Cancel"); new randn = random(sizeof(TruckStart)); VJob[playerid] = CreateVehicle(515, TruckStart[randn][0], TruckStart[randn][1], TruckStart[randn][2], TruckStart[randn][3], -1, -1, -1); PutPlayerInVehicle(playerid, VJob[playerid], 0); IsWorking[playerid] = 1; SetDestination(playerid, 2502.9927,2778.0164,10.8203); ShowJobBox(playerid); UpdateJobBox(playerid); } } } return 1; }
CMD:gotojob(playerid, params[]) { new id; if(sscanf(params, "d", id)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /gotojob [JobID]"); if(id <= 0) return 0; SetPlayerPos(playerid, JobInfo[id][jPosX], JobInfo[id][jPosY], JobInfo[id][jPosZ]); return 1; }
The gotojob cmd works,also getjob works..still this doesn t work
|
switch(j) { case 2: { PWarehouseCP[playerid] = 2; PWarehouseCurrent[playerid] = 0; IsWorking[playerid] = 1; new randn = random(sizeof(WarehouseExteriorCP)); SetPlayerCheckpoint(playerid, WarehouseExteriorCP[randn][0], WarehouseExteriorCP[randn][1], WarehouseExteriorCP[randn][2], 1.0); SetDestination(playerid, WarehouseExteriorCP[randn][0], WarehouseExteriorCP[randn][1], WarehouseExteriorCP[randn][2]); } case 5: { ShowPlayerDialog(playerid, DIALOG_TRUCKER, DIALOG_STYLE_TABLIST_HEADERS, "Choose the transport type", "Type\tLegal/Illegal\tAvailable routes\tReward\nFood\tLegal\t25\t{4AE87D}${FFFFFF}\nElectronics\tLegal\t25\t{4AE87D}${FFFFFF}\nGas/Petrol\tLegal\t15\t{4AE87D}${FFFFFF}\nCar Theft\tIllegal\t2\t{4AE87D}${FFFFFF} + {F37138}special rewards{FFFFFF}", "Choose", "Cancel"); new randn = random(sizeof(TruckStart)); VJob[playerid] = CreateVehicle(515, TruckStart[randn][0], TruckStart[randn][1], TruckStart[randn][2], TruckStart[randn][3], -1, -1, -1); PutPlayerInVehicle(playerid, VJob[playerid], 0); IsWorking[playerid] = 1; SetDestination(playerid, 2502.9927,2778.0164,10.8203); ShowJobBox(playerid); UpdateJobBox(playerid); } default: return SendClientMessage(playerid, -1, "This job it's not finish yet."); }