15.06.2009, 10:17
My PlayerToPoint isent working, It lets me type the command anywhere,
But its only supposed to let me type the command in certain place,
But its only supposed to let me type the command in certain place,
pawn Код:
forward PlayerToPoint (Float:radi, playerid, Float:x, Float:y, Float:z);
if (strcmp("/buyc4", cmdtext, true) == 0)
{
if(PlayerToPoint(1.0,playerid,-2044.0804,149.9467,28.8359))
{
if (C4BUY[playerid] == 1) return SendClientMessage(playerid, 0xFF0000AA, "You already have C4");
else
{
SendClientMessage(playerid, 0xFF0000AA, "You have purchased C4");
C4BUY[playerid] = 1;
}
}
return 1;
}
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
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);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}