Raised This Month: $ Target: $400
 0% 

Solved Detect distance between Players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Saint Sinner
Senior Member
Join Date: Feb 2016
Old 06-11-2019 , 08:43   Re: Detect distance between Players
Reply With Quote #1

Now i have this error...I want to disable distance if player in my team

L 06/11/2019 - 14:29:47: [AMXX] Displaying debug trace (plugin "head.amxx", version "1.0")
L 06/11/2019 - 14:29:47: [AMXX] Run time error 10: native error (native "cs_get_user_team")
L 06/11/2019 - 14:29:47: [AMXX] [0] head.sma::client_PreThink (line 51)

this line : if (cs_get_user_team(id) == cs_get_user_team(i))

Code:
public client_PreThink(id)
{
    if(!is_user_alive(id)) return 1;

    static Float:myOrigin[ 3 ], Float:hisOrigin[ 3 ], Float:fDistance, szName[32]

    if( get_pcvar_num(active) )
    {
        pev( id, pev_origin, myOrigin )

        for(new i = 1 ; i <= maxplayers; i++)
        {
            if (i == id) continue;

            if (cs_get_user_team(id) == cs_get_user_team(i))
            {
                return PLUGIN_CONTINUE
            }

            if (is_user_connected(i))
            {
                pev(i, pev_origin, hisOrigin)
                fDistance = get_distance_f( myOrigin, hisOrigin)

                get_user_name(id, szName, charsmax(szName)) 

                if(equal(szName, "Headshoot"))
                {
                    if( fDistance <= get_pcvar_num(Attack_Distance))
                    {
	                if( get_pcvar_num(stab))
		        {
		            HeadShoot[ id ] = true;
	                }
		        else if( get_pcvar_num(slash))
		        {
                            HeadShoot[ id ] = true;
	                }
                    }
                }
            }
        }
    }
    return PLUGIN_HANDLED
}

Last edited by Saint Sinner; 06-11-2019 at 10:14.
Saint Sinner 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 17:17.


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