15.08.2010, 22:11
I created a labyrinth with random exit. Then i created a textdraw, that shows you a distance from that randomly generated exit using this code:
But that returning number is f**king long like 1118883351...
Код:
publicEx Float:LabyrintFinishDistance(playerid) { new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2; GetPlayerPos(playerid,x1,y1,z1); if(labyrintPickupNumber == 0) x2 = 2806.0546,y2 = 2497.5456,z2 = 17.8839; else if(labyrintPickupNumber == 1) x2 = 2832.5747,y2 = 2424.4216,z2 = 17.8839; else if(labyrintPickupNumber == 2) x2 = 2785.5512,y2 = 2472.7583,z2 = 17.8839; else if(labyrintPickupNumber == 3) x2 = 2892.0693,y2 = 2477.0683,z2 = 17.8839; else if(labyrintPickupNumber == 4) x2 = 2854.5910,y2 = 2477.0021,z2 = 17.8839; else if(labyrintPickupNumber == 5) x2 = 2859.8830,y2 = 2515.4990,z2 = 17.8839; else if(labyrintPickupNumber == 6) x2 = 2800.6992,y2 = 2455.8444,z2 = 17.8839; else if(labyrintPickupNumber == 7) x2 = 2780.5739,y2 = 2481.6289,z2 = 17.8839; return floatsqroot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)+(z2-z1)*(z2-z1)); }