23.07.2009, 17:50
hello,i got one cmd,and i want to make it like i can use it only if im at some coordinates,
338.4752,-2416.0164,14.2604
thanks
338.4752,-2416.0164,14.2604
thanks
dcmd_shpos(playerid, params[]) { new string[128]; new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid,a); format(string, sizeof(string), "X=%f Y=%f Z=%f A=%f",x,y,z,a); SendClientMessage(playerid, COLOR_RED, string); #pragma unused params return 1; }
if(PlayerToPoint(1.0, playerid, 338.4752,-2416.0164,14.2604))
stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}