Raised This Month: $ Target: $400
 0% 

NAN orgin :S


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ogelami
Junior Member
Join Date: Apr 2008
Old 10-27-2009 , 22:24   NAN orgin :S
Reply With Quote #1

PHP Code:
    new ball[] = "models/head.mdl";
    new 
float:AimingFrom[3];

public 
plugin_precache(){
    
precache_model(ball);
}
public 
plup(id){
    
    
get_user_origin(id,AimingFrom,1);
    
    new 
entid create_entity("info_target")
    
entity_set_string(entidEV_SZ_classname"some_guy")
    
entity_set_model(entidball)
    
entity_set_origin(entidAimingFrom)
    
    
entity_set_int(entidEV_INT_solid1)
    
entity_set_int(entidEV_INT_movetype6)


This returns to nan orgin when get_user_origin returns a negative number.
And when i set the numbers all by my self the entity dosen't get spawned i have precached the model.
ogelami is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 10-28-2009 , 16:01   Re: NAN orgin :S
Reply With Quote #2

The get_user_origin() function does not return a floated value. And entity_set_origin() sets an origin(floated one).

So you'd have to do it like this(using IVecFVec()):

Code:
new iOrigin[ 3 ], Float:fOrigin[ 3 ]; get_user_origin( id, iOrigin, 3 ); // 3 is ending position from eyes(crosshair) IVecFVec( iOrigin, fOrigin ); // integer origin converted to float entity_set_origin( ent, fOrigin ); // entity at that origin

or you could just use float().

Code:
new iOrigin[ 3 ], Float:fOrigin[ 3 ]; get_user_origin( id, iOrigin, 3 ); // 3 is ending position from eyes(crosshair) fOrigin[ 0 ] = float( iOrigin[ 0 ] ); fOrigin[ 1 ] = float( iOrigin[ 1 ] ); fOrigin[ 2 ] = float( iOrigin[ 2 ] ); // im not sure but i think you could do this also // fOrigin = float( iOrigin ); entity_set_origin( ent, fOrigin ); // entity at that origin
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 10-28-2009 , 16:33   Re: NAN orgin :S
Reply With Quote #3

@Xellath: IVecFVec( ) is a stock using float( ).

PHP Code:
stock IVecFVec(const IVec[3], Float:FVec[3])
{
    
FVec[0] = float(IVec[0]);
    
FVec[1] = float(IVec[1]);
    
FVec[2] = float(IVec[2]);

    return 
1;

__________________
xPaw is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 10-28-2009 , 17:10   Re: NAN orgin :S
Reply With Quote #4

Yeah, saw that when I looked closer on the stock. Anyway, it's perfectly fine to write it both ways, no difference at all.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 10-28-2009 , 17:35   Re: NAN orgin :S
Reply With Quote #5

Yeah, just for info
__________________
xPaw is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-28-2009 , 17:57   Re: NAN orgin :S
Reply With Quote #6

But you can't do :

// im not sure but i think you could do this also
// fOrigin = float( iOrigin );
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:35.


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