08.09.2017, 11:19
Why're you using SetPlayerRaceCheckpoint if you aren't gonna make use of nextx, nexty, and nextz parameters?
Just use SetPlayerCheckpoint. And the problem most likely is GetPVarType.
GetPVarType returns the type of the PVar. What you're looking for is GetPVarInt.
https://sampwiki.blast.hk/wiki/GetPVarType
https://sampwiki.blast.hk/wiki/GetPVarInt
Also a suggestion, your code is very messy and could be simpler. I recommend making an array, for example:
Results.
Just use SetPlayerCheckpoint. And the problem most likely is GetPVarType.
GetPVarType returns the type of the PVar. What you're looking for is GetPVarInt.
https://sampwiki.blast.hk/wiki/GetPVarType
https://sampwiki.blast.hk/wiki/GetPVarInt
Also a suggestion, your code is very messy and could be simpler. I recommend making an array, for example:
PHP код:
enum E_CHECKPOINT_DATA
{
Float:P_CHECKPOINT_X,
Float:P_CHECKPOINT_Y,
Float:P_CHECKPOINT_Z,
Float:P_CHECKPOINT_NEW_X,
Float:P_CHECKPOINT_NEW_Y,
Float:P_CHECKPOINT_NEW_Z
}
new g_aCheckpointData[][E_CHECKPOINT_DATA] =
{
{1701.7723, -1505.4003, 13.3828, 1699.6165, -1538.9922, 13.3828}
};
CMD:deliver(playerid, params[])
{
new
str[128],
index = -1
;
for(new i = 0; i < sizeof g_aCheckpointData; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, g_aCheckpointData[i][P_CHECKPOINT_X], g_aCheckpointData[i][P_CHECKPOINT_Y], g_aCheckpointData[i][P_CHECKPOINT_Z]))
{
index = i;
break;
}
}
if(index != -1)
{
format(str, sizeof(str), "You're near coordinates %f, %f, %f in checkpoint data %i.", g_aCheckpointData[index][P_CHECKPOINT_X], g_aCheckpointData[index][P_CHECKPOINT_Y], g_aCheckpointData[index][P_CHECKPOINT_Z], index);
SendClientMessage(playerid, -1, str);
SetPlayerCheckpoint(playerid, g_aCheckpointData[index][P_CHECKPOINT_NEW_X], g_aCheckpointData[index][P_CHECKPOINT_NEW_Y], g_aCheckpointData[index][P_CHECKPOINT_NEW_Z], 5.0);
}
return 1;
}