25.02.2012, 06:04
Quote:
Hello,
I'm a little rusty, I haven't scripted for a while now. First, let me explain the job I'm trying to make. I'm trying to make it, so you have to be in a truck in order to even start the job, and if you exit the truck while delivering it cancels your delivery. So once you're in the truck, you need to drive to point A to point B, to a checkpoint where you will then unload and earn 2500. I'm having a problem with (!IsPlayerInRangeOfPoint). I want it so if you're "Not" near the spot where you start the job, then a message will pop up saying "You must be at the correct spot to start the job" And if you are at the correct spot, then you'll start and receive a message saying "Drive to the checkpoint" Here's my current code. I know, it's not much. pawn Code:
|
pawn Code:
new deliveryjob[MAX_PLAYERS] = 0;
CMD:delivery(playerid, params[])
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 498) return SendClientMessage(playerid, COLOR_RED, "You must be in a Delivery Truck.");
if(IsPlayerInRangeOfPoint(playerid,3.0, x y z of your main cp))
{
deliveryjob[playerid] = 1;
SetPlayerCheckpoint(playerid, 680.8652,-441.9654,16.3359, 4.0);
}
else
{
SendClientMessage(playerid, color, "you are not near the cp");
}
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(deliveryjob[playerid] == 1)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 498)
{
GivePlayerMoney(playerid, 2500);
SendClientMessage(playerid, COLOR_GREEN, "Congratulations, you've earned 2500");
}
else
{
SendClientMessage(playerid, COLOR_RED, "You must be in a Delivery Truck in order to deliver");
}
}
}
return 1;
Well i changed few lines from the command, check and also
If worked reply down so i know it worked
-FalconX