19.06.2010, 12:25
Quote:
new pdistance = 1; forward NameTimer(); Float:GetPointDistanceToPointExMorph(Float ![]() ![]() { new Float ![]() x = x1-x2; y = y1-y2; z = z1-z2; return floatsqroot(x*x+y*y+z*z); } stock SetPDistance(dista) { pdistance = dista; } stock GetPDistance() { return pdistance; } stock EnableDistancedNameTag(delay) { SetTimer("NameTimer",delay,1); } forward NameTimer(); public NameTimer() { for(new i = 0;i < MAX_PLAYERS;i++) { if(IsPlayerConnected(i)) { for(new q = 0;q < MAX_PLAYERS;q++) { if(IsPlayerConnected(q)) { new Float ![]() new Float ![]() new Float ![]() new Float ![]() new Float ![]() new Float ![]() if(IsPlayerConnected(i) && IsPlayerConnected(q)) { GetPlayerPos(i,p1x,p1y,p1z); GetPlayerPos(q,p2x,p2y,p2z); if(GetPointDistanceToPointExMorph(p1x,p1y,p1z,p2x, p2y,p2z) < pdistance) { ShowPlayerNameTagForPlayer(i,q,1); } else { ShowPlayerNameTagForPlayer(i,q,0); } }}}}} } |
Quote:
public PlayerToPoint(Float:radi, playerid, Float ![]() { if(IsPlayerConnected(playerid)) { new Float ![]() ![]() ![]() 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; } |