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

Defuse Message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 12-23-2022 , 16:04   Defuse Message
Reply With Quote #1

can someone make it without colors and the chatcolor include?
or at least make it work with today amx.

HTML Code:
#include <amxmodx>
#include <csx>
#include <chatcolor>

#define ANTIFLOOD_DELAY        1.0

public plugin_init()
{
    register_plugin("Bomb Events", "0.0.1", "ConnorMcLeod")
    register_event("TextMsg", "Event_TextMsg_Game_bomb_drop", "bc", "2&#Game_bomb_drop")
    register_event("TextMsg", "Event_TextMsg_Got_bomb", "b", "2&#Got_bomb")
}

public Event_TextMsg_Got_bomb( id )
{
    if( bIsUserFlooding(id) )
    {
        return
    }
    new szName[32]
    get_user_name(id, szName, charsmax(szName))
    client_print_color(0, DontChange, "^4[Game Announce] ^1Player ^3%s^1 has picked up the bomb", szName)
}

public Event_TextMsg_Game_bomb_drop()
{
    new szName[32]
    read_data(3, szName, charsmax(szName))
    if( bIsUserFlooding( get_user_index( szName ) ) )
    {
        return
    }
    client_print_color(0, DontChange, "^4[Game Announce] ^1Player ^3%s^1 has dropped the bomb", szName)
}

public bomb_defusing( id )
{
    if( bIsUserFlooding(id) )
    {
        return
    }
    new szName[32]
    get_user_name(id, szName, charsmax(szName))
    client_print_color(0, DontChange, "^4[Game Announce] ^1Player ^3%s^1 is defusing the bomb", szName)
}

public bomb_defused( id )
{
    new szName[32]
    get_user_name(id, szName, charsmax(szName))
    client_print_color(0, DontChange, "^4[Game Announce] ^1Player ^3%s^1 has defused the bomb", szName)
}

public bomb_planting( id )
{
    if( bIsUserFlooding(id) )
    {
        return
    }
    new szName[32]
    get_user_name(id, szName, charsmax(szName))
    client_print_color(0, DontChange, "^4[Game Announce] ^1Player ^3%s^1 is planting the bomb", szName)
}

public bomb_planted( id )
{
    new szName[32]
    get_user_name(id, szName, charsmax(szName))
    client_print_color(0, DontChange, "^4[Game Announce] ^1Player ^3%s^1 has planted the bomb", szName)
}

bool:bIsUserFlooding(id, Float:flFloodDelay = ANTIFLOOD_DELAY, bool:bAddAtEachAttempt = false)
{
    static Float:flNextColoredText[33]
    static Float:flGameTime
    flGameTime = get_gametime()
    if( flNextColoredText[id] > flGameTime )
    {
        if( bAddAtEachAttempt )
        {
            flNextColoredText[id] += flFloodDelay
        }
        return true
    }
    flNextColoredText[id] = flGameTime + flFloodDelay
    return false
}
Ark_Procession is offline
sPed
Member
Join Date: May 2017
Location: Algeria
Old 12-23-2022 , 16:07   Re: Defuse Message
Reply With Quote #2

you want to remove colors from message chat?
sPed is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 12-24-2022 , 12:31   Re: Defuse Message
Reply With Quote #3

PHP Code:
#include <amxmodx>
#include <csx>

#define ANTIFLOOD_DELAY        1.0

public plugin_init()
{
    
register_plugin("Bomb Events""0.0.1""ConnorMcLeod")
    
register_event("TextMsg""Event_TextMsg_Game_bomb_drop""bc""2&#Game_bomb_drop")
    
register_event("TextMsg""Event_TextMsg_Got_bomb""b""2&#Got_bomb")
}

public 
Event_TextMsg_Got_bombid )
{
    if( 
bIsUserFlooding(id) )
    {
        return
    }
    new 
szName[32]
    
get_user_name(idszNamecharsmax(szName))
    
client_print_color(0print_team_default"^4[Game Announce] ^1Player ^3%s^1 has picked up the bomb"szName)
}

public 
Event_TextMsg_Game_bomb_drop()
{
    new 
szName[32]
    
read_data(3szNamecharsmax(szName))
    if( 
bIsUserFloodingget_user_indexszName ) ) )
    {
        return
    }
    
client_print_color(0print_team_default"^4[Game Announce] ^1Player ^3%s^1 has dropped the bomb"szName)
}

public 
bomb_defusingid )
{
    if( 
bIsUserFlooding(id) )
    {
        return
    }
    new 
szName[32]
    
get_user_name(idszNamecharsmax(szName))
    
client_print_color(0print_team_default"^4[Game Announce] ^1Player ^3%s^1 is defusing the bomb"szName)
}

public 
bomb_defusedid )
{
    new 
szName[32]
    
get_user_name(idszNamecharsmax(szName))
    
client_print_color(0print_team_default"^4[Game Announce] ^1Player ^3%s^1 has defused the bomb"szName)
}

public 
bomb_plantingid )
{
    if( 
bIsUserFlooding(id) )
    {
        return
    }
    new 
szName[32]
    
get_user_name(idszNamecharsmax(szName))
    
client_print_color(0print_team_default"^4[Game Announce] ^1Player ^3%s^1 is planting the bomb"szName)
}

public 
bomb_plantedid )
{
    new 
szName[32]
    
get_user_name(idszNamecharsmax(szName))
    
client_print_color(0print_team_default"^4[Game Announce] ^1Player ^3%s^1 has planted the bomb"szName)
}

bool:bIsUserFlooding(idFloat:flFloodDelay ANTIFLOOD_DELAYbool:bAddAtEachAttempt false)
{
    static 
Float:flNextColoredText[33]
    static 
Float:flGameTime
    flGameTime 
get_gametime()
    if( 
flNextColoredText[id] > flGameTime )
    {
        if( 
bAddAtEachAttempt )
        {
            
flNextColoredText[id] += flFloodDelay
        
}
        return 
true
    
}
    
flNextColoredText[id] = flGameTime flFloodDelay
    
return false

lexzor is offline
shayan123
BANNED
Join Date: Oct 2020
Location: GB
Old 01-13-2023 , 11:48   Re: Defuse Message
Reply With Quote #4

Here is the modified version of your code that removes the use of the ChatColor module and uses the built-in client_print function instead:

PHP Code:
#include <amxmodx>
#include <csx>

#define ANTIFLOOD_DELAY        1.0

public plugin_init()
{
    
register_plugin("Bomb Events""0.0.1""ConnorMcLeod")
    
register_event("TextMsg""Event_TextMsg_Game_bomb_drop""bc""2&#Game_bomb_drop")
    
register_event("TextMsg""Event_TextMsg_Got_bomb""b""2&#Got_bomb")
}

public 
Event_TextMsg_Got_bombid )
{
    if( 
bIsUserFlooding(id) )
    {
        return
    }
    new 
szName[32]
    
get_user_name(idszNamecharsmax(szName))
    
client_print(0"[Game Announce] Player %s has picked up the bomb"szName)
}

public 
Event_TextMsg_Game_bomb_drop()
{
    new 
szName[32]
    
read_data(3szNamecharsmax(szName))
    if( 
bIsUserFloodingget_user_indexszName ) ) )
    {
        return
    }
    
client_print(0"[Game Announce] Player %s has dropped the bomb"sz 
shayan123 is offline
Send a message via ICQ to shayan123 Send a message via AIM to shayan123 Send a message via Yahoo to shayan123 Send a message via Skype™ to shayan123
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 14:27.


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