AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   print_color only show for team? (https://forums.alliedmods.net/showthread.php?t=275226)

sb123 11-25-2015 08:43

print_color only show for team?
 
Hello,guys

PHP Code:

print_color(0iVictimBALLMSGszNameiDropMoney

this for everyone

If i want the print_color only show for the team
How can i do?

PHP Code:

stock print_color(indexcolor, const msg[], any:...)
{
    new 
szMessage[192]
    
szMessage[0] = 0x04
    vformat
(szMessage[1], charsmax(szMessage)-1msg4)
    
    new 
iSayText
    
if (iSayText || (iSayText get_user_msgid("SayText")))
    {
        
message_begin(index MSG_ONE_UNRELIABLE MSG_BROADCASTiSayText_index)
        {
            
write_byte(color)
            
write_string(szMessage)
        }
        
message_end()
    }



redivcram 11-25-2015 11:49

Re: print_color only show for team?
 
Example (Untested)

PHP Code:

#include <amxmodx>
#include <cstrike>

#define PRINT_TO CS_TEAM_CT

public plugin_init()
{
    
register_plugin("Color Print to specific team""Example""redivcram");
    
    
register_clcmd("/print""CmdPrint");
}

public 
CmdPrint()
{
    new 
players[32], numiid;
    
    
get_players(playersnum"a");
    
    for(
0numi++)
    {
        
id players[i];
        
        if(
cs_get_user_team(id) == PRINT_TO)
        {
            
print_color(idTEAM"^x04[TEST]^x03 Hello to %s"PRINT_TO);
        }
    }
    return 
PLUGIN_HANDLED;
}

stock print_color(indexcolor, const msg[], any:...) 

    new 
szMessage[192
    
szMessage[0] = 0x04 
    vformat
(szMessage[1], charsmax(szMessage)-1msg4
     
    new 
iSayText 
    
if (iSayText || (iSayText get_user_msgid("SayText"))) 
    { 
        
message_begin(index MSG_ONE_UNRELIABLE MSG_BROADCASTiSayText_index
        { 
            
write_byte(color
            
write_string(szMessage)
        } 
        
message_end()
    } 



sb123 11-25-2015 12:26

Re: print_color only show for team?
 
Like this code,where i need to edit?

PHP Code:

public TouchEnt(iEntiToucher)
{
    if (
is_valid_ent(iEnt))
    {
        new 
CsTeams:iPlayerTeamiEntTeam
        
new Float:fDropTimeszName[32], iEntMoneyiPlayerMoney
        
new Float:fVelo[3], Float:fUserVelo[3]
        
        
iEntTeam entity_get_int(iEntEV_INT_team)
        
fDropTime entity_get_float(iEntEV_FL_fuser1)
        
iEntMoney entity_get_int(iEntEV_INT_iuser2)
        
        if (
get_gametime() - fDropTime 0.5)
            return
        
        if ( 
iEntTeam && entity_get_int(iEntEV_INT_iuser3))    //ball
        
{
            
entity_get_vector(iToucherEV_VEC_velocityfUserVelo)
            
            if (
IsPlayer(iToucher))
            {
                
iPlayerTeam cs_get_user_team(iToucher)
                
iPlayerMoney cs_get_user_money(iToucher)
                
                if (
iEntTeam == _:iPlayerTeam)
                {
                    
#if defined IN_USE_BUTTON
                    
if (entity_get_int(iToucherEV_INT_button) & IN_USE)
                    {
                    
#endif
                        
velocity_by_aim(iToucher300fVelo)
                        
                        
fVelo[0] += fUserVelo[0]
                        
fVelo[1] += fUserVelo[1]
                        
fVelo[2] += fUserVelo[2] + 250.0
                        
                        entity_set_vector
(iEntEV_VEC_velocityfVelo)
                        
entity_set_float(iEntEV_FL_scale0.5)
                        
entity_set_int(iEntEV_INT_sequence2// set ball model movement 
                        
entity_set_float(iEntEV_FL_animtime1.0// set ball movement speed
                        
entity_set_float(iEntEV_FL_framerate1.0// set ball frame rate 
                        
beam(iEntg_TeamColors[iPlayerTeam])
                    
#if defined IN_USE_BUTTON
                    
}
                    
#endif
                
}
                else
                {
                    if (
g_bPickUp[iToucher])
                    {
                        
g_bPickUp[iToucher] = false
                        
                        get_user_name
(iToucherszNamecharsmax(szName))
                        
set_task(get_pcvar_float(g_pCvarPickUpDelay), "PickUpDelay"iToucher)//make a few delay 
                        
cs_set_user_money(iToucheriPlayerMoney iEntMoney)
                        
print_color(0iToucherPICKUPMSGszNameiEntMoney)
                        
client_cmd(iToucher,"spk buttons/button9")
                        
remove_entity(iEnt)
                        
                        
g_BallCount--
                    }
                }
            }
            else
            {
                new 
Float:fEntVelo[3]
                
                
entity_get_vector(iEntEV_VEC_velocityfEntVelo)
                
xs_vec_mul_scalar(fEntVelo0.85fEntVelo)
                
entity_set_vector(iEntEV_VEC_velocityfEntVelo)
                
entity_set_float(iEntEV_FL_scale0.5)
                
entity_set_int(iEntEV_INT_sequence, (get_speed(iEnt) <= 30) ? 3:2// set ball model movement 
                
entity_set_float(iEntEV_FL_animtime1.0// set ball movement speed
                
entity_set_float(iEntEV_FL_framerate1.0// set ball frame rate 
                
                
if (get_speed(iEnt) >= 30)
                    
emit_sound(iEntCHAN_ITEMBALLTOUCH1.0ATTN_NORM0PITCH_NORM)
            }
            
        }
        else {
            if (
IsPlayer(iToucher))
            {
                
iPlayerMoney cs_get_user_money(iToucher)
                
                if (
g_bPickUp[iToucher])
                {
                    
g_bPickUp[iToucher] = false
                    
                    get_user_name
(iToucherszNamecharsmax(szName))
                    
set_task(get_pcvar_float(g_pCvarPickUpDelay), "PickUpDelay"iToucher)//make a few delay 
                    
cs_set_user_money(iToucheriPlayerMoney iEntMoney)
                    
print_color(0iToucherPICKUPMSGszNameiEntMoney)
                    
client_cmd(iToucher,"spk buttons/button9")
                    
remove_entity(iEnt)
                    
g_BillCount--
                }
            }
        }
    }




All times are GMT -4. The time now is 18:03.

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