11.01.2015, 09:10
PHP код:
if(strcmp(cmd, "/work", true) == 0)
{
new
Float: fX,
Float: fY,
Float: fZ,
Float:Distance
;
GetPlayerPos(playerid, fX, fY, fZ);
Distance = GetPointDistanceToPoint3D(fX, fY, fZ, 925.8821,-1757.5184,13.5469);
format(string, sizeof(string), " Kilomters %f to the point", Distance);
SendClientMessage(playerid, -1, string);
return 1;
}
PHP код:
forward Float:GetPointDistanceToPoint3D(Float: fX1, Float: fY1, Float: fZ1, Float: fX2, Float: fY2, Float: fZ2);
public Float:GetPointDistanceToPoint3D(Float: fX1, Float: fY1, Float: fZ1, Float: fX2, Float: fY2, Float: fZ2)
{
return floatsqroot(((fX1 -= fX2) * fX1) + ((fY1 -= fY2) * fY1) + ((fZ1 -= fZ2) * fZ1));
}