AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED]Printing values from get_user_origin (https://forums.alliedmods.net/showthread.php?t=171153)

Erox902 11-02-2011 14:45

[SOLVED]Printing values from get_user_origin
 
Okay so I've been trying to make this work for about an hour now.
But I've been searching the forum and the funcwiki and can't figure out what's wrong here :?

What I'm trying to do is get users origin and log each value, here's my code.

PHP Code:

public cmdOrigin(id)
{
    static 
Name[34]
    
get_user_nameidNamecharsmax(Name) )
    
    static 
float:Origin[3]
    
get_user_origin(idOrigin)
    
    static 
Output[128]
    
formatexOutputcharsmax(Output), "Origin[0](x) = %f, Origin[1](y) = %f, Origin[2](z) = %f, commander: %s"Origin[0], Origin[1], Origin[2], Name )
    
    
log_amx(Output)


Can anyone explain why it isn't working?

Sylwester 11-02-2011 15:10

Re: Printing values from get_user_origin
 
get_user_origin works with integers, so you can fix it in 2 ways:

1) remove float: and use %d isntead of %f
2) use native that works with floats like pev(id, pev_origin, Origin) from fakemeta

Erox902 11-02-2011 15:17

Re: Printing values from get_user_origin
 
Quote:

Originally Posted by Sylwester (Post 1588559)
get_user_origin works with integers, so you can fix it in 2 ways:

1) remove float: and use %d isntead of %f
2) use native that works with floats like pev(id, pev_origin, Origin) from fakemeta

Oh sh*t thanks!
I was so sure that get_user_origin returned floats :?

sake 11-02-2011 15:25

Re: [SOLVED]Printing values from get_user_origin
 
FM returns Floats afaik.

Erox902 11-02-2011 15:47

Re: [SOLVED]Printing values from get_user_origin
 
Quote:

Originally Posted by sake (Post 1588574)
FM returns Floats afaik.

Well it's fine I don't need to be that precisely :)


All times are GMT -4. The time now is 14:15.

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