Raised This Month: $32 Target: $400
 8% 

How to detect team mate


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 10-07-2021 , 15:39   How to detect team mate
Reply With Quote #1

PHP Code:
register_forward(FM_EmitSound,"fw_emitsound"
PHP Code:
public fw_emitsound(entity,channel,const sample[],Float:volume,Float:attenuation,fFlags,pitch)
{
    if(!
equali(sample,"weapons/debris",14))
        return 
FMRES_IGNORED;
    
    static 
classname[8];
    
pev(entity,pev_classname,classname,7)

    if(
equal(classname,"grenade"))
        {
                
JumpBombExplode(entity)
        }

    return 
FMRES_IGNORED;

PHP Code:
public JumpBombExplode(Entity
In ''public JumpBombExplode'' how to prevent bomb to damage teammate?
__________________
Check my original plugins for cs 1.6 and subscribe on channel
Look at the video below to see blind grenade for zombies

https://www.youtube.com/watch?v=ORC7ZmoaipQ

Look at the video below to see Zombie Hide And Seek mode

https://www.youtube.com/watch?v=xpyYb65EgGs
Krtola is offline
Send a message via Skype™ to Krtola
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 10-07-2021 , 15:43   Re: How to detect team mate
Reply With Quote #2

Maybe show more code? Like JumpBombExlpode func.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 10-07-2021 , 15:50   Re: How to detect team mate
Reply With Quote #3

PHP Code:
public JumpBombExplode(Entity)
{
    static 
Float:Origin[3]
    
pev(Entitypev_originOrigin)
           
    for(new 
victim 1victim <= get_maxplayers(); victim++)
    {
        if(!
is_user_alive(victim) || g_effected[victim])
            continue               
                  
                new 
vOrigin[3],coord[3]
                
get_user_origin(victim,vOrigin)
            
vOrigin[2] -= 26
            coord
[0] = vOrigin[0] + 150
            coord
[1] = vOrigin[1] + 150
            coord
[2] = vOrigin[2] + 800
        
}

__________________
Check my original plugins for cs 1.6 and subscribe on channel
Look at the video below to see blind grenade for zombies

https://www.youtube.com/watch?v=ORC7ZmoaipQ

Look at the video below to see Zombie Hide And Seek mode

https://www.youtube.com/watch?v=xpyYb65EgGs
Krtola is offline
Send a message via Skype™ to Krtola
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 10-07-2021 , 21:20   Re: How to detect team mate
Reply With Quote #4

Filter out teammates with get_players, get_players_ex, get_user_team, cs_get_user_team.

1 post, 2 scripts. Examples with both get_players and get_user_team for cstrike use.
__________________
DJEarthQuake is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-08-2021 , 10:27   Re: How to detect team mate
Reply With Quote #5

Check if player is on the player's team that dealing the damage and prevent the damage.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 10-08-2021 at 10:27.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-08-2021 , 10:41   Re: How to detect team mate
Reply With Quote #6

Yea, this seems kind of obvious. If you are able to get this far with your plugin, how can you not figure this simple piece out?
PHP Code:
public JumpBombExplode(Entity)
{
    new 
iThrower Float:Origin[3] , vOrigin[3] , coord[3]
    new 
iNum iPlayers32 ] , iPlayer;
    
    
iThrower pevEntity pev_owner );
    
pevEntity pev_origin Origin )
    
get_playersiPlayers iNum "ae" cs_get_user_teamiThrower ) == CS_TEAM_T "CT" "TERRORIST" );
    
    
//iPlayers[] now only holds alive players on enemy team
    
for ( new <= iNum i++ )
    {
        
iPlayer iPlayers];
        
        if( !
g_effectediPlayer ] )
        {
            
//issue damage to iPlayer
            
            
get_user_origin(iPlayer,vOrigin)
            
vOrigin[2] -= 26
            coord
[0] = vOrigin[0] + 150
            coord
[1] = vOrigin[1] + 150
            coord
[2] = vOrigin[2] + 800
        
}
    }

__________________

Last edited by Bugsy; 10-08-2021 at 10:47.
Bugsy is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 10-08-2021 , 14:42   Re: How to detect team mate
Reply With Quote #7

I was not active for a couple of years in cs 1.6 stuff,and I forgot many things.
__________________
Check my original plugins for cs 1.6 and subscribe on channel
Look at the video below to see blind grenade for zombies

https://www.youtube.com/watch?v=ORC7ZmoaipQ

Look at the video below to see Zombie Hide And Seek mode

https://www.youtube.com/watch?v=xpyYb65EgGs
Krtola is offline
Send a message via Skype™ to Krtola
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-09-2021 , 12:50   Re: How to detect team mate
Reply With Quote #8

you should not copy and paste things you should understand how things works in order to remember them for ever.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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:37.


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