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

Help about detecting enemy players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SaraAki
New Member
Join Date: Nov 2022
Old 11-17-2022 , 08:19   Help about detecting enemy players
Reply With Quote #1

Stuff after
PHP Code:
if(Distance <= RADIUS)
        { 
affects all players including owner.How to set it to affect only opposing players,players in enemy team.

PHP Code:
public effect_start(Entity)
{       

    if(
Entity 0)
        return

        if(
g_roundend)
                return

    static 
Float:Origin[3]
    
pev(Entitypev_originOrigin)
                              
    for(new 
victim 1victim <= get_maxplayers(); victim++)
    {
        if(!
is_user_alive(victim) || g_effected[victim])
            continue                     
                  
        new 
Float:VictimOrigin[3]
        
pev(victimpev_originVictimOrigin)
                   
        new 
Float:Distance get_distance_f(OriginVictimOrigin)   
                   
        if(
Distance <= RADIUS)
        {
            static 
Float:NewSpeed

                        NewSpeed 
JUMP_EXP 5
                           
            
static Float:Velocity[3]
            
get_speed_vector(OriginVictimOriginNewSpeedVelocity)
                           
            
set_pev(victimpev_velocityVelocity)

                        
set_pev(victimpev_punchangleFloat:{125.0125.0125.0})
                        
set_task(3.0"Shake"victim)
                        
g_effected[victim] = 1
                        client_cmd
(victim"spk %s"grenadeeffect)
                        
start_sprites[victim] = true
        
}
     }


Last edited by SaraAki; 11-17-2022 at 08:23.
SaraAki is offline
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 11-17-2022 , 12:17   Re: Help about detecting enemy players
Reply With Quote #2

PHP Code:
public effect_start(Entity)
{       
     if(
Entity 0
     
|| g_roundend)
                return

     static 
Float:Origin[3]
     
entity_get_vectorEntity0Origin );
                              
     static 
__int_Players[32], __int_Count__int_Teamvictim;

     
__int_Team get_user_teamClient );
     
get_players__int_Players__int_Count"a" );
    
     for( new 
i__int_Counti++ )
     {
        
victim __int_Players[i];
  
        if(
victim == Entity 
        
|| get_user_team(victim) == __int_Team 
        
|| g_effected[victim]
        || 
entity_rangeEntityvictim ) > RADIUS )
        { continue; } 
                                            
         static 
Float:VictimOrigin[3]
         
entity_get_vectorvictim0VictimOrigin );
                    
         static 
Float:Velocity[3]
         
get_speed_vector(OriginVictimOriginJUMP_EXP 5Velocity);

         
entity_set_vectorvictimEV_VEC_velocityVelocity );
         
entity_set_vectorvictimEV_VEC_puchangleFloat:{125.0,125.0,125.0} );

         
set_task(3.0"Shake"victim)
         
g_effected[victim] = 1
         client_cmd
(victim"spk %s"grenadeeffect)
         
start_sprites[victim] = true
        
}
     }


Last edited by MrPickles; 11-17-2022 at 12:31.
MrPickles is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-17-2022 , 17:15   Re: Help about detecting enemy players
Reply With Quote #3

@MrPickles i still don't understand why are you still hardcoding ???

Quote:
static Float:VictimOrigin[3]
entity_get_vector( victim, 0, VictimOrigin );
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 11-17-2022 at 17:15.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 11-17-2022 , 17:52   Re: Help about detecting enemy players
Reply With Quote #4

Quote:
Originally Posted by Natsheh View Post
@MrPickles i still don't understand why are you still hardcoding ???
??????
What are you talking about? Did you know that this is replaced when compiled? Most of them don't know the name of the enumerations. To save time, instead of writing the name, I put the number because I already know the order of the enumeration, why are you chasing me and taking out things that have nothing to do with it:

engine_const.inc

PHP Code:
enum {
EV_VEC_origin 0,
         ...


neither the code nor the functionality change, in the end, even if you put EV_VEC_origin, it will be replaced by 0, it is only to save time, and the one who knows the order writes it

PHP Code:
static cell AMX_NATIVE_CALL entity_get_vector(AMX *amxcell *params)
{
    
int iEnt params[1];
    
int idx params[2];
    
cell *vRet MF_GetAmxAddr(amxparams[3]);
    
Vector vRetValue Vector(000);

    
CHECK_ENTITY_SIMPLE(iEnt);

    
edict_t *pEnt TypeConversion.id_to_edict(iEnt);

    switch (
idx// INTEGRAL
    
{
        case 
origin// START FROM 0
            
vRetValue pEnt->v.origin;
            break;

               ..... 
This shows how you speak without knowing, you become a hater for leaving yourself ignorant 4 times in a row, in really simple things
It makes me laugh how someone is surprised by that smallness, also treats it as if it were hardcoding XDD

Last edited by MrPickles; 11-17-2022 at 22:25.
MrPickles is offline
SaraAki
New Member
Join Date: Nov 2022
Old 11-18-2022 , 04:52   Re: Help about detecting enemy players
Reply With Quote #5

Thank you for helping me.
Cant compile and you can see on this photo why.
Attached Thumbnails
Click image for larger version

Name:	AliedModers.png
Views:	71
Size:	92.7 KB
ID:	197990  
SaraAki is offline
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 11-18-2022 , 12:25   Re: Help about detecting enemy players
Reply With Quote #6

Quote:
Originally Posted by SaraAki View Post
Thank you for helping me.
Cant compile and you can see on this photo why.
try with this

PHP Code:

public effect_start(Entity)
{       
     if(
Entity 0
     
|| g_roundend)
                return

     static 
Float:Origin[3];
     
entity_get_vectorEntity0Origin );
                              
     static 
__int_Players[32], __int_Count__int_Teamvictim;

     
__int_Team get_user_teamClient );
     
get_players__int_Players__int_Count"a" );
    
     for( new 
i__int_Counti++ )
     {
        
victim __int_Players[i];
  
        if(
victim == Entity 
        
|| get_user_team(victim) == __int_Team 
        
|| g_effected[victim]
        || 
entity_rangeEntityvictim ) > RADIUS )
        { continue } 
                                            
         static 
Float:VictimOrigin[3];
         
entity_get_vectorvictim0VictimOrigin );
                    
         static 
Float:Velocity[3];
         
get_speed_vector(OriginVictimOriginJUMP_EXP 5Velocity);

         
entity_set_vectorvictimEV_VEC_velocityVelocity );
         
entity_set_vectorvictimEV_VEC_puchangleFloat:{125.0,125.0,125.0} );

         
set_task(3.0"Shake"victim)
         
g_effected[victim] = 1
         client_cmd
(victim"spk %s"grenadeeffect)
         
start_sprites[victim] = true
        
}
     } 
1 - add the library #<engine>
2 - and post the full error

Last edited by MrPickles; 11-18-2022 at 12:29.
MrPickles is offline
SaraAki
New Member
Join Date: Nov 2022
Old 11-19-2022 , 16:00   Re: Help about detecting enemy players
Reply With Quote #7

Fail.
SaraAki is offline
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 11-19-2022 , 18:06   Re: Help about detecting enemy players
Reply With Quote #8

Quote:
Originally Posted by SaraAki View Post
Fail.
You don't tell me anything with this, I tried the code and it works perfectly, at least post the complete error as I told you above

Last edited by MrPickles; 11-19-2022 at 18:06.
MrPickles 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 10:44.


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