25.02.2012, 04:59
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.
I know I'm doing a lot wrong, most likely. Anyone want to help me out?
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:
new deliveryjob[MAX_PLAYERS] = 0;
CMD:delivery(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid,3.0, -62.0572,-1121.8473,1.3233)) return SendClientMessage(playerid, COLOR_RED, "You're not in range of the Delivery place");
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 498) return SendClientMessage(playerid, COLOR_RED, "You must be in a Delivery Truck.");
{
deliveryjob[playerid] = 1;
SetPlayerCheckpoint(playerid, 680.8652,-441.9654,16.3359, 4.0);
}
}
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(deliveryjob[playerid] == 1)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 498) return SendClientMessage(playerid, COLOR_RED, "You must be in a Delivery Truck in order to deliver");
{
GivePlayerMoney(playerid, 2500);
SendClientMessage(playerid, COLOR_GREEN, "Congratulations, you've earned 2500");
}
}
return 1;
}