AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_distance_f cant compile (https://forums.alliedmods.net/showthread.php?t=236990)

elantra86 03-15-2014 15:04

get_distance_f cant compile
 
Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
 
#define PLUGIN "[http://amxxmodx.ru] get_distance_f"
#define VERSION "1.0"
#define AUTHOR "Admin"
 
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say dis","dis")
}

public dis(id){
new Float:forigin[3]
new Float:sorigin[3]
get_user_origin(id, forigin)
get_user_origin(id, sorigin, 3) 
new Float:distance = get_distance_f(forigin,sorigin)
client_print(0,print_chat,"Dist:%f",distance)
// client_print(0, print_chat, "Your current origin is %ix, %iy, %iz", sorigin[0], sorigin[1], sorigin[2])
}

if i print one of sorigin or forigin it works.
but cant get distance.
where i do mistake plz help.
thx in advance

YamiKaitou 03-15-2014 15:14

Re: get_distance_f cant compile
 
It compiles just fine, though get_user_origin isn't expecting a Float.

elantra86 03-15-2014 15:44

Re: get_distance_f cant compile
 
compiled norm(with warning 213: tag mismatch)
but when i say dis in game
result is :
Dist:0.000000

Need distance from my point to aiming point.

Black Rose 03-15-2014 18:51

Re: get_distance_f cant compile
 
You're mixing functions that are based on floats and functions that are based on integers.
You need to choose one and stick with it.
The way to do it with floats is not for beginners.

Code:
public dis(id){     new forigin[3]     new sorigin[3]     get_user_origin(id, forigin)     get_user_origin(id, sorigin, 3)     new distance = get_distance(forigin, sorigin)     client_print(0, print_chat,"Dist: %d",distance) }

elantra86 03-16-2014 03:29

Re: get_distance_f cant compile
 
Thx it's works for me!!!
& 1 question .
how can i replace hud armor value with this value.
(that it would be updated automatically without command)
sorry for my english &thx in advance.


All times are GMT -4. The time now is 05:59.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.