AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   colored name | fire in the hole event (https://forums.alliedmods.net/showthread.php?t=127531)

Amonel 05-22-2010 06:38

colored name | fire in the hole event
 
How can i make the name of the player throwing a nade be colored depending of his team (red/blue)

%s (RADIO): Fire in the hole!

issen1 05-22-2010 07:03

Re: colored name | fire in the hole event
 
PHP Code:

public ColorChat(idColor:type, const msg[], {Float,Sql,Result,_}:...) 

Have a look in colorchat.inc:

PHP Code:

if(cs_get_user_team(plr) == CS_TEAM_T)
    
ColorChat(0RED"^3%s ^1(RADIO): Fire in the hole!"sPlrName)
else if (
cs_get_user_team(plr) == CS_TEAM_CT)
    
ColorChat(0BLUE"^3%s ^1(RADIO): Fire in the hole!"sPlrName

or something like that.

Amonel 05-22-2010 17:48

Re: colored name | fire in the hole event
 
ok... so what do i have to do exactly ? :/

hleV 05-22-2010 19:57

Re: colored name | fire in the hole event
 
Quote:

Originally Posted by issen1 (Post 1187741)
PHP Code:

public ColorChat(idColor:type, const msg[], {Float,Sql,Result,_}:...) 


public? o_O

Amonel 05-23-2010 06:48

Re: colored name | fire in the hole event
 
any ideea ? :/

ConnorMcLeod 05-23-2010 07:02

Re: colored name | fire in the hole event
 
http://forums.alliedmods.net/showthread.php?p=401813

Amonel 05-23-2010 07:12

Re: colored name | fire in the hole event
 
yeah,... but i want the COLOR of his name too :)

if i add ^x03 and throws a smoke... it will print the entire message grey =(

ConnorMcLeod 05-23-2010 07:20

Re: colored name | fire in the hole event
 
PHP Code:

/*    Formatright © 2010, ConnorMcLeod

    Descriptive Fire In The Hole Reloaded is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Descriptive Fire In The Hole Reloaded; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>

#define VERSION "0.2.0"

new g_iLocation
new g_iRmTextMsg

public plugin_init()
{
    
register_plugin("Descriptive Fire In The Hole Reloaded"VERSION"ConnorMcLeod")

    
register_event("SendAudio""Event_SendAudio_MRAD_FIREINHOLE""b""2=%!MRAD_FIREINHOLE")

    new 
szModName[7]
    
get_modname(szModNamecharsmax(szModName))
    if(
equal(szModName"czero"))
    {
        
register_event("Location""Event_Location""b")
    }
}

public 
Event_Location()
{
    
g_iLocation 1
}

public 
Event_SendAudio_MRAD_FIREINHOLE()
{
    
g_iRmTextMsg register_messageget_user_msgid("TextMsg") , "Message_TextMsg" )
}

public 
Message_TextMsg(iMsgId)
{
    new 
szType[64], szId[3]
    
get_msg_arg_string(2szIdcharsmax(szId))
    new 
iId get_user_weaponstr_to_num(szId) )
    if( 
g_iLocation )
    {
        
formatex(szTypecharsmax(szType), "^3%%s1^1 @ ^4%%s2^1 ( %s ): %%s3"get_grenade_typeiId ))
    }
    else
    {
        
formatex(szTypecharsmax(szType), "^3%%s1 ^1( %s ): %%s2"get_grenade_typeiId ))
    }
    
set_msg_arg_string(3szType)
    
unregister_message(iMsgIdg_iRmTextMsg)
}

get_grenade_typeiId )
{
    new 
szGrenade[20]
    switch( 
iId )
    {
        case 
CSW_HEGRENADE :
        {
            
szGrenade "^3He Grenade^1"
        
}
        case 
CSW_SMOKEGRENADE :
        {
            
szGrenade "Smoke Grenade"
        
}
        case 
CSW_FLASHBANG :
        {
            
szGrenade "^4FlashBang^1"
        
}
    }
    return 
szGrenade



Amonel 05-23-2010 07:44

Re: colored name | fire in the hole event
 
your code doesn't work.... it makes my sv run at 4 fps when throwing a nade :/

ConnorMcLeod 05-23-2010 09:24

Re: colored name | fire in the hole event
 
Works like a charm on different servers i own.


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

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