17.04.2009, 22:19
• PlayerToPlayer •
From the PlayerToPoint Function
pawn Код:
stock PlayerToPlayer(playerid, destid, Float:radius)
{
if(!IsPlayerConnected(playerid)) return -1; // Checks if player is connected
{
new Float:X, Float:Y, Float:Z; // Base x, y, z values
new Float:px, Float:py, Float:pz; //px, py, pz used to express
GetPlayerPos(playerid, X, Y, Z); //
GetPlayerPos(destid, px, py, pz); //
X = floatsub(X, px);
Y = floatsub(Y, py);
Z = floatsub(Z, pz);
if( ( radius > X && X > -radius ) &&
( radius > Y && Y > -radius ) &&
( radius > Z && Z > -radius ) ) return 1;
}
return 0;
}