24.05.2015, 16:02
i'm having a little problem with a command i've created
my problem is that even though the player is in range when using the command, it still says they're not in range.
(the command works as intended but it's just that it still sends the error message even though they're in range)
pic:
my problem is that even though the player is in range when using the command, it still says they're not in range.
(the command works as intended but it's just that it still sends the error message even though they're in range)
pic:
PHP код:
COMMAND:cargo(playerid,params[])
{
if(pInfo[playerid][pCargo] == 1) return SendClientMessage(playerid, RED, "Already Delivering Cargo!");
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 519)
{
new Float:X;
new Float:Y;
new Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(IsPlayerInRangeOfPoint(playerid, 500.0, 1761.4497,-2494.3818,13.5547)) // LS LOC
{
pInfo[playerid][pCargo] = 1;
pInfo[playerid][pCargoM] = 0;
pInfo[playerid][pCargoD] = 3;
TextDrawShowForPlayer(playerid, CargoTD);
TextDrawShowForPlayer(playerid, CargoLoc[playerid]);
SendClientMessage(playerid, YELLOW, "Cargo Delivery: Load and Deliver Cargo to and from Airports all around San Andreas!");
Streamer_AppendArrayData(STREAMER_TYPE_CP, Checkpoint[193], E_STREAMER_PLAYER_ID, playerid);
new str[48];
format(str,sizeof(str),"~b~~h~Location: ~g~Los Santos Airport");
TextDrawSetString(CargoLoc[playerid], str);
SendClientMessage(playerid, YELLOW, "Load Cargo from Los Santos Airport for Delivery!");
}
if(IsPlayerInRangeOfPoint(playerid, 500.0, -1397.5881,-284.6473,26.2160)) // SF LOC
{
pInfo[playerid][pCargo] = 1;
pInfo[playerid][pCargoM] = 0;
pInfo[playerid][pCargoD] = 3;
TextDrawShowForPlayer(playerid, CargoTD);
TextDrawShowForPlayer(playerid, CargoLoc[playerid]);
SendClientMessage(playerid, YELLOW, "Cargo Delivery: Load and Deliver Cargo to and from Airports all around San Andreas!");
Streamer_AppendArrayData(STREAMER_TYPE_CP, Checkpoint[194], E_STREAMER_PLAYER_ID, playerid);
new str[48];
format(str,sizeof(str),"~b~~h~Location: ~g~San Fierro Airport");
TextDrawSetString(CargoLoc[playerid], str);
SendClientMessage(playerid, YELLOW, "Load Cargo from San Fierro Airport for Delivery!");
}
if(IsPlayerInRangeOfPoint(playerid, 500.0, 1473.1907,1507.4999,10.8203)) // LV LOC
{
pInfo[playerid][pCargo] = 1;
pInfo[playerid][pCargoM] = 0;
pInfo[playerid][pCargoD] = 3;
TextDrawShowForPlayer(playerid, CargoTD);
TextDrawShowForPlayer(playerid, CargoLoc[playerid]);
SendClientMessage(playerid, YELLOW, "Cargo Delivery: Load and Deliver Cargo to and from Airports all around San Andreas!");
Streamer_AppendArrayData(STREAMER_TYPE_CP, Checkpoint[195], E_STREAMER_PLAYER_ID, playerid);
new str[48];
format(str,sizeof(str),"~b~~h~Location: ~g~Las Venturas Airport");
TextDrawSetString(CargoLoc[playerid], str);
SendClientMessage(playerid, YELLOW, "Load Cargo from Las Venturas Airport for Delivery!");
}
if(IsPlayerInRangeOfPoint(playerid, 500.0, 164.0293,2494.4155,16.4844)) // ABAND LOC
{
pInfo[playerid][pCargo] = 1;
pInfo[playerid][pCargoM] = 0;
pInfo[playerid][pCargoD] = 3;
TextDrawShowForPlayer(playerid, CargoTD);
TextDrawShowForPlayer(playerid, CargoLoc[playerid]);
SendClientMessage(playerid, YELLOW, "Cargo Delivery: Load and Deliver Cargo to and from Airports all around San Andreas!");
Streamer_AppendArrayData(STREAMER_TYPE_CP, Checkpoint[196], E_STREAMER_PLAYER_ID, playerid);
new str[48];
format(str,sizeof(str),"~b~~h~Location: ~g~Abandoned Airport");
TextDrawSetString(CargoLoc[playerid], str);
SendClientMessage(playerid, YELLOW, "Load Cargo from Abandoned Airport for Delivery!");
}
else return SendClientMessage(playerid, RED, "You can only start a Cargo Mission at an Airport!");
}
else return SendClientMessage(playerid, RED,"You Must be in a Shamal to Start this Job!");
return 1;
}