Raised This Month: $51 Target: $400
 12% 

iOrigin units


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 03-12-2020 , 18:35   iOrigin units
Reply With Quote #1

I did a vulnerable test from my distance to the opponent's distance but it shows me units 393 and I'm a meter from my opponent, should it be that way or did something wrong?
Code:
new g_iPlayer;
new g_iLastHiter;
Code:
		if(g_iLastHiter)
		{
			new szAttacker[MAX_NAME_LENGTH];
			get_user_name(g_iLastHiter, szAttacker, charsmax(szAttacker));
			cs_reset_player_model(g_iLastHiter);

			new iOrigin[2][3];
                        new Float:g_vecHookOrigin[3];
			get_user_origin(g_iPlayer, iOrigin[0]);
			get_user_origin(g_iLastHiter, iOrigin[1]);
			for(new i = 0; i <= 2; i++)
				g_vecHookOrigin[i] = float(iOrigin[1][i]);
			client_print_color(0, print_team_red, "%s ^3%s ^1hit ^3%s ^1from units [ ^4%d ^1] in ^1[ ^4%.1f Seconds ^1].", PREFIX, szAttacker, g_szName, get_distance(iOrigin[0], iOrigin[1]), g_fTimeLeft);
			CREATE_BEAMENTPOINT(pId, g_vecHookOrigin, g_pSpriteLgtning, 0, 1, 1, 50, 50, random(255), random(255), random(255), 180, _);
		}
the units

Last edited by Fuck For Fun; 03-13-2020 at 09:09.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-12-2020 , 19:13   Re: iOrigin units
Reply With Quote #2

Need to see more code, specifically where you are setting g_iPlayer and g_iLastHitter. There's a possibility that these variables do not hold the player id's that you expect, resulting in a longer than expected distance.

Do the correct names print?
__________________

Last edited by Bugsy; 03-12-2020 at 19:14.
Bugsy is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 03-13-2020 , 09:10   Re: iOrigin units
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
Need to see more code, specifically where you are setting g_iPlayer and g_iLastHitter. There's a possibility that these variables do not hold the player id's that you expect, resulting in a longer than expected distance.

Do the correct names print?
Edit my Post.

Basically what I need help with is location/units I don't know if it should be calculated as UNITS OR METERS
and not
Code:
new g_iPlayer;
new g_iLastHiter;
Because it is a net definition of variables

Last edited by Fuck For Fun; 03-13-2020 at 09:13.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-13-2020 , 18:52   Re: iOrigin units
Reply With Quote #4

https://forums.alliedmods.net/showth...=62984?t=62984
__________________
Bugsy is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 03-13-2020 , 20:30   Re: iOrigin units
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
Code:
		if(g_iLastHiter)
		{
			new szAttacker[MAX_NAME_LENGTH];
			get_user_name(g_iLastHiter, szAttacker, charsmax(szAttacker));
			cs_reset_player_model(g_iLastHiter);

			new iOrigin[2][3];
			get_user_origin(g_iPlayer, iOrigin[0]);
			get_user_origin(g_iLastHiter, iOrigin[1]);
			new iFeet = get_real_distance( iOrigin[ 0 ] , iOrigin[ 1 ] , Measure_Feet );

			client_print_color(0, print_team_red, "%s ^3%s ^1hit ^3%s ^1from units [ ^4%d ^1] in ^1[ ^4%.1f Seconds ^1].", PREFIX, szAttacker, g_szName, iFeet, g_fTimeLeft);
			//CREATE_BEAMENTPOINT(pId, g_vecHookOrigin, g_pSpriteLgtning, 0, 1, 1, 50, 50, random(255), random(255), random(255), 180, _);
		}
ok i think is worked
but those
PHP Code:
WarningSymbol is assigned a value that is never used"g_pSpriteLgtning" on line 227
Error
Undefined symbol "g_vecHookOrigin" on line 2198 

Last edited by Fuck For Fun; 03-13-2020 at 21:57.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-13-2020 , 21:29   Re: iOrigin units
Reply With Quote #6

PHP Code:
    if(g_iLastHiter
    {
        new 
szAttacker[MAX_NAME_LENGTH];
        
get_user_name(g_iLastHiterszAttackercharsmax(szAttacker));
        
cs_reset_player_model(g_iLastHiter);
        
        new 
iOrigin[2][3];
        
get_user_origin(g_iPlayeriOrigin[0]);
        
get_user_origin(g_iLastHiteriOrigin[1]);
        new 
iFeet get_real_distanceiOrigin] , iOrigin] , Measure_Feet )
        
        
client_print_color(0print_team_red"%s ^3%s ^1hit ^3%s ^1from units [ ^4%d ^1] in ^1[ ^4%.1f Seconds ^1]."PREFIXszAttackerg_szNameiFeetg_fTimeLeft);
        
CREATE_BEAMENTPOINT(pIdg_vecHookOriging_pSpriteLgtning0115050random(255), random(255), random(255), 180_);
    } 
__________________
Bugsy is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 03-14-2020 , 08:40   Re: iOrigin units
Reply With Quote #7

Quote:
Originally Posted by Bugsy View Post
PHP Code:
    if(g_iLastHiter
    {
        new 
szAttacker[MAX_NAME_LENGTH];
        
get_user_name(g_iLastHiterszAttackercharsmax(szAttacker));
        
cs_reset_player_model(g_iLastHiter);
        
        new 
iOrigin[2][3];
        
get_user_origin(g_iPlayeriOrigin[0]);
        
get_user_origin(g_iLastHiteriOrigin[1]);
        new 
iFeet get_real_distanceiOrigin] , iOrigin] , Measure_Feet )
        
        
client_print_color(0print_team_red"%s ^3%s ^1hit ^3%s ^1from units [ ^4%d ^1] in ^1[ ^4%.1f Seconds ^1]."PREFIXszAttackerg_szNameiFeetg_fTimeLeft);
        
CREATE_BEAMENTPOINT(pIdg_vecHookOriging_pSpriteLgtning0115050random(255), random(255), random(255), 180_);
    } 
PHP Code:
stock CREATE_BEAMENTPOINT(pEntityFloat:vecOrigin[3], pSpriteiStartFrame 0iFrameRate 0iLifeiWidthiAmplitude 0iRediGreeniBlueiBrightnessiScrollSpeed 0)
{
    if(!
is_user_alive(pEntity)) 
        return 
0;
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_BEAMENTPOINT);
    
write_short(pEntity);
    
engfunc(EngFunc_WriteCoordvecOrigin[0]);
    
engfunc(EngFunc_WriteCoordvecOrigin[1]);
    
engfunc(EngFunc_WriteCoordvecOrigin[2]);
    
write_short(pSprite);
    
write_byte(iStartFrame);
    
write_byte(iFrameRate); // 0.1's
    
write_byte(iLife); // 0.1's
    
write_byte(iWidth);
    
write_byte(iAmplitude); // 0.01's
    
write_byte(iRed);
    
write_byte(iGreen);
    
write_byte(iBlue);
    
write_byte(iBrightness);
    
write_byte(iScrollSpeed); // 0.1's
    
message_end();
    return 
PLUGIN_HANDLED;

Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-14-2020 , 16:52   Re: iOrigin units
Reply With Quote #8

PHP Code:
    if(g_iLastHiter
    {
        new 
szAttacker[MAX_NAME_LENGTH];
        
get_user_name(g_iLastHiterszAttackercharsmax(szAttacker));
        
cs_reset_player_model(g_iLastHiter);
        
        new 
iOrigin[2][3];
        
get_user_origin(g_iPlayeriOrigin[0]);
        
get_user_origin(g_iLastHiteriOrigin[1]);
        new 
iFeet get_real_distanceiOrigin] , iOrigin] , Measure_Feet )
        
        new 
Float:fVec];
        
IVecFVeciOrigin] , fVec );
        
        
client_print_color(0print_team_red"%s ^3%s ^1hit ^3%s ^1from units [ ^4%d ^1] in ^1[ ^4%.1f Seconds ^1]."PREFIXszAttackerg_szNameiFeetg_fTimeLeft);
        
CREATE_BEAMENTPOINT(pIdfVecg_pSpriteLgtning0115050random(255), random(255), random(255), 180_);
    } 
__________________
Bugsy is offline
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 04:28.


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