16.01.2010, 05:50
Try using PlayerToPoint by adding this function to your script
then adding the actual function
Use it like so:
Код:
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
Код:
public 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); //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; }
Код:
if(PlayerToPoint(20, i,1133.0699,-9.5731,1000.6797)) {//Restaurant Entrance GameTextForPlayer(i, "~Y~Restaurant, 5000, 1); SetPlayerInterior(i, 4); SetPlayerPos(i,1022.599975,-1123.699951,23.799999); }