Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock GetDistanceInPos(playerid, Float:x2, Float:y2, Float:z2)
- {
- static Float:x1,Float:y1,Float:z1, Float:dis;
- GetPlayerPos(playerid,x1,y1,z1);
- dis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
- return floatround(dis);
- }
- // Pega a posição do player e calcula quanto falta para chegar a posição.
- uso:
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x,y,z);
- new Float: pos = GetDistanceInPos(playerid, x,y,z);
- printf("Falta %f para %d chegar ao seu destino!", pos, playerid);
- // Out:
- // Falta 100.0 para 50 chegar ao seu destino.
Advertisement
Add Comment
Please, Sign In to add comment