31.10.2012, 14:38
You mean this ?
pawn Код:
CMD:top(playerid,params[])
{
#pragma unused params
new Float:x, Float:y, Float:z; // Creating 3 Variables for coords
GetPlayerPos(playerid, x, y, z); // Getting Player Pos
new Float:nearest = 99999.0, object = -1;
for(new o = 0; i < MAX_OBJECTS; o++) // Checking the nearest build
{
if(IsValidObject(o) && GetPlayerDistanceFromPoint(playerid, x, y, z) < nearest)
{
object = o;
nearest = GetPlayerDistanceFromPoint(playerid, x, y, z);
}
}
if(object == -1)
{
SendClientMessage(playerid, -1, "No building nearby.");
}
else
{
new Float:ox, Float:oy, Float:oz;
GetObjectPos(object, ox, oy, oz);
SetPlayerPos(playerid, ox + 2, oy + 1, oz);
}
return 1;
}