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

Define Team to show HUD Message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 08-29-2020 , 12:46   Define Team to show HUD Message
Reply With Quote #1

I have this code made by bugsy.

I tried to show the HUD to only terrorists and i don't seem to get it to work.
CT still can see the HUD message with this code:

I'm probably placing the if(cs_get_user_team(id) == CS_TEAM_T) on the wrong part.

Anyone care to show me how to do it correctly?


Code:
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <dhudmessage>

new const Version[] = "0.1";

#define IsPlayer(%1)    (1<=%1<=32)

public plugin_init() 
{
    register_plugin( "Bomb Spawn HUD" , Version , "bugsy" );
    
    register_logevent( "SpawnedWithBomb" , 3 , "2=Spawned_With_The_Bomb" );
}

public SpawnedWithBomb()
{  
	
    set_task( 0.1 , "DelayC4" );
}

public DelayC4()
{
	

    new szName[ 32 ] , iBomb , id;
    
    iBomb = find_ent_by_class( -1 , "weapon_c4" );
    id = entity_get_edict( iBomb , EV_ENT_owner );
	
	if(cs_get_user_team(id) == CS_TEAM_T)
	{
	
        get_user_name( id , szName , charsmax( szName ) );
        set_dhudmessage( 255 , 50 , 0 , 0 , 0.73 , 0 , 0.0 , 10.0 );
        show_dhudmessage( 0 , "[ %s has the bomb ]" , szName );   
   
  }
      
      
}
Ark_Procession is offline
ZaX
Senior Member
Join Date: Jan 2015
Old 08-29-2020 , 15:29   Re: Define Team to show HUD Message
Reply With Quote #2

inside the if() condition, use get_players function and get the terrorist team then loop.

BTW.
show_dhudmessage(0, ....)
0 Means everyone will get the message.
Use the proper player index(or the indexes when you loop).
ZaX is offline
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 08-29-2020 , 23:16   Re: Define Team to show HUD Message
Reply With Quote #3

I'm sorry, i'm am VERY new to pawn, and is really hard to start.

Could you maybe, write the line with the solution? and i will take it as reference to understand how it works.

Since i don't really understood how to apply the get_players function, player index, or how to loop.
Ark_Procession is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 08-30-2020 , 06:01   Re: Define Team to show HUD Message
Reply With Quote #4

Code:
public DelayC4() {     new szName[ 32 ] , iBomb , id;         iBomb = find_ent_by_class( -1 , "weapon_c4" );     id = entity_get_edict( iBomb , EV_ENT_owner );         if(cs_get_user_team(id) == CS_TEAM_T)     {             get_user_name( id , szName , charsmax( szName ) );         new players[32];         new pnum;         new tempid;         get_players(players, pnum, "ceh", "TERRORIST"); /* Getting players list which are respecting filtering flags ( See this: <a href="https://www.amxmodx.org/api/amxmodx/get_players" target="_blank" rel="nofollow noopener">https://www.amxmodx.org/api/amxmodx/get_players</a> ) */         for (new i; i < pnum; i++) /* Looping through the players num */         {           tempid = players[i]; /* Assigning a temporay index for the certain players */           set_dhudmessage( 255 , 50 , 0 , 0 , 0.73 , 0 , 0.0 , 10.0 );             show_dhudmessage( tempid, "[ %s has the bomb ]" , szName ); /* Displaying the dhud message for all players from the array */         }     }      }
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]

Last edited by Shadows Adi; 08-30-2020 at 06:02.
Shadows Adi is offline
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 08-30-2020 , 11:23   Re: Define Team to show HUD Message
Reply With Quote #5

Thank you, the code works and i'm trying to comprehend it so i can apply it to other plugins as well.
Ark_Procession 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 17:33.


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