Raised This Month: $ Target: $400
 0% 

help with origin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SCHWEDEN
Member
Join Date: Dec 2007
Location: 127.0.0.1
Old 10-20-2009 , 17:12   help with origin
Reply With Quote #1

PHP Code:
public hook_ResetHUD(iClient)
{
    if(
task_exists(iClient))
        
remove_task(iClient);
    static 
newangle[3]
    
get_user_originiClientnewangle )
    
gSpawnPosition[iClient][0] = newangle[0];
    
gSpawnPosition[iClient][1] = newangle[1];
    
gSpawnPosition[iClient][2] = newangle[2];
}

public 
hook_DeathMsg()
{
    new 
iVictim read_data(2);
    
lol(iVictim);
   
}

public 
lol(iClient)
{
    static 
newangle[3];
    
get_user_originiClientnewangle );
    
gDeathPosition[iClient][0] = newangle[0];
    
gDeathPosition[iClient][1] = newangle[1];
    
gDeathPosition[iClient][2] = newangle[2];
    
    if(
abs(gDeathPosition[iClient][0] != gSpawnPosition[iClient][0]) && abs(gDeathPosition[iClient][1] != gSpawnPosition[iClient][1])){
something here

Can you find anything wrong here? Its not working for me. It's a private plugin so I would like to not share the whole code.
Thank you for your time!
__________________


Last edited by SCHWEDEN; 10-20-2009 at 17:14. Reason: Sorry, wrong thread, can you please move it?
SCHWEDEN is offline
Send a message via MSN to SCHWEDEN
vittu
SuperHero Moderator
Join Date: Oct 2004
Location: L.A. County, CA
Old 10-20-2009 , 21:29   Re: help with origin
Reply With Quote #2

I didn't really look at it, but just a note:

Code:
    if(task_exists(iClient))
        remove_task(iClient);
Don't check if the tasks exists just remove it.

-----

Also you don't really need to:
Code:
    static newangle[3]
    get_user_origin( iClient, newangle )
    gSpawnPosition[iClient][0] = newangle[0];
    gSpawnPosition[iClient][1] = newangle[1];
    gSpawnPosition[iClient][2] = newangle[2];
Just do:
Code:
get_user_origin( iClient,  gSpawnPosition[iClient])

Last edited by vittu; 10-20-2009 at 21:32.
vittu is offline
Send a message via AIM to vittu Send a message via MSN to vittu Send a message via Yahoo to vittu
stupok
Veteran Member
Join Date: Feb 2006
Old 10-20-2009 , 22:22   Re: help with origin
Reply With Quote #3

This doesn't make sense:

Code:
abs(gDeathPosition[iClient][0] != gSpawnPosition[iClient][0])
abs() takes the absolute value of the parameter.

For example,

abs(-3) = 3
abs(0) = 0
abs(3) = 3

The result of "x != y" is either 0 or 1, so it does not make sense to pass it into abs().
__________________
stupok is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-20-2009 , 22:33   Re: help with origin
Reply With Quote #4

You should either use xs_vec_equal() or do a Google search on "Epsilon float precision".
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
SCHWEDEN
Member
Join Date: Dec 2007
Location: 127.0.0.1
Old 10-21-2009 , 06:22   Re: help with origin
Reply With Quote #5

Thanks alot, will try your tips!
__________________

SCHWEDEN is offline
Send a message via MSN to SCHWEDEN
Reply



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:40.


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