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

[Dyn Native] ColorChat v0.3.2 (04 jul 2013)


Post New Thread Reply   
 
Thread Tools Display Modes
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-26-2009 , 09:36   Re: [Native] ColorChat v0.1.0
Reply With Quote #61

ColorChat( ) uses get_user_team( ).

Do something like this:
Code:
new g_iMsgId_TeamInfo = get_user_msgid( "TeamInfo" ); new iBlock = get_msg_block( g_iMsgId_TeamInfo ); set_msg_block( g_iMsgId_TeamInfo, BLOCK_ONCE ); cs_set_user_team( id, CS_TEAM_SPECTATOR ); set_msg_block( g_iMsgId_TeamInfo, iBlock ); emessage_begin( MSG_BROADCAST, g_iMsgId_TeamInfo ); ewrite_byte( id ); ewrite_string( "SPECTATOR" ); emessage_end( ); ColorChat( ... );
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-26-2009 , 14:06   Re: [Native] ColorChat v0.1.0
Reply With Quote #62

I can't believe TeamInfo from cs_set_user_team can't be caught by amxx
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-26-2009 , 15:24   Re: [Native] ColorChat v0.1.0
Reply With Quote #63

cs_set_user_team( ) uses the standard MESSAGE_BEGIN( ) like message_begin( ), rather than the lookup table workaround like emessage_begin( ).
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-26-2009 , 15:34   Re: [Native] ColorChat v0.1.0
Reply With Quote #64

Do you think that's also why get_players is fucked up sometimes with flag "e" ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-26-2009 , 15:43   Re: [Native] ColorChat v0.1.0
Reply With Quote #65

Could be.

get_user_team( ) uses the same resource that is used for team comparison in get_players( ).

Code:
static cell AMX_NATIVE_CALL get_user_team(AMX *amx, cell *params) /* 3 param */ {     int index = params[1];         if (index < 1 || index > gpGlobals->maxClients)         return -1;         CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);         if (pPlayer->ingame)     {         // SidLuke, DoD fix         if (g_bmod_dod)         {             int iTeam = pPlayer->pEdict->v.team;                         if (params[3])             {                 char *szTeam = "";                                 switch (iTeam)                 {                     case 1:                         szTeam = "Allies";                         break;                     case 2:                         szTeam = "Axis";                         break;                 }                                 set_amxstring(amx, params[2], szTeam, params[3]);             }             return iTeam;         }         //         if (params[3])         {             set_amxstring(amx, params[2], pPlayer->team.c_str(), params[3]);         }
        return pPlayer->teamId;
    }         return -1; } static cell AMX_NATIVE_CALL get_players(AMX *amx, cell *params) /* 4 param */ {     int iNum = 0;     int ilen;     char* sptemp = get_amxstring(amx, params[3], 0, ilen);     int flags = UTIL_ReadFlags(sptemp);     cell *aPlayers = get_amxaddr(amx, params[1]);     cell *iMax = get_amxaddr(amx, params[2]);     int team = 0;     if (flags & 48)     {         sptemp = get_amxstring(amx, params[4], 0, ilen);         if (flags & 16)         {             if (flags & 64)                 team = g_teamsIds.findTeamId(sptemp);             else                 team = g_teamsIds.findTeamIdCase(sptemp);         }     }     for (int i = 1; i <= gpGlobals->maxClients; ++i)     {         CPlayer* pPlayer = GET_PLAYER_POINTER_I(i);         if (pPlayer->ingame)         {             if (pPlayer->IsAlive() ? (flags & 2) : (flags & 1))                 continue;             if (pPlayer->IsBot() ? (flags & 4) : (flags & 8))                 continue;
            if ((flags & 16) && (pPlayer->teamId != team))
                continue;             if ((flags & 128) && (pPlayer->pEdict->v.flags & FL_PROXY))                 continue;             if (flags & 32)             {                 if (flags & 64)                 {                     if (stristr(pPlayer->name.c_str(), sptemp) == NULL)                         continue;                 }                 else if (strstr(pPlayer->name.c_str(), sptemp) == NULL)                     continue;             }             aPlayers[iNum++] = i;         }     }     *iMax = iNum;         return 1; }

Note: e = 1 << 4 = 16
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
itaymitay
Member
Join Date: Sep 2009
Old 11-24-2009 , 05:38   Re: [Native] ColorChat v0.1.0
Reply With Quote #66

How can i make it in Random Respawn Chance??

Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>

new Float:LastSpawnAttempt[33]
new bool:RoundEnded = false

public plugin_init()
{ 
    register_plugin("Random Respawn Chance", "0.9", "Bo0m!")
    register_clcmd("say", "spawnchance")
    register_cvar("spawnchance_on","1")
    register_cvar("spawnchance_msg","1")
    register_cvar("spawnchance_msgtime","75")    
    register_cvar("spawnchance_odds","10")
    register_cvar("spawnchance_wait","150")
    register_cvar("spawnchance_adminbonus","0")
    register_logevent("event_RoundStarted", 2, "1=Round_Start")
    register_logevent("event_RoundEnded", 2, "1=Round_End")
}

public plugin_precache()
{
    precache_sound("debris/beamstart9.wav")
}

public client_putinserver(id)
{
    if(is_user_bot(id)) 
        return PLUGIN_HANDLED

    set_task(20.0, "spawnmessage", id)
    LastSpawnAttempt[id] = -5000.0
    return PLUGIN_CONTINUE
}

public client_disconnect(id)
{
    if(is_user_bot(id)) 
        return PLUGIN_HANDLED

    LastSpawnAttempt[id] = -5000.0
    return PLUGIN_CONTINUE
}

public event_RoundStarted()
{
    RoundEnded = false
}

public event_RoundEnded()
{
    RoundEnded = true
}

public spawnagain(id)
{
    spawn(id)
    give_item(id,"weapon_knife")
    return PLUGIN_CONTINUE
}

public spawnmessage(id)
{
    if (!get_cvar_num("spawnchance_on") || !get_cvar_num("spawnchance_msg"))
    return PLUGIN_HANDLED

    if(get_cvar_num("spawnchance_msgtime") < 10)
    {
        server_cmd ("spawnchance_msgtime 10")
        return PLUGIN_CONTINUE
    }

    if(is_user_connected(id)) client_print(id, print_chat, "[Respawn Chance] You have a 1 in %d chance to revive when dead! Say reviveme for your chance!",get_cvar_num("spawnchance_odds"))
    set_task(get_cvar_float("spawnchance_msgtime"), "spawnmessage", id)
    return PLUGIN_HANDLED
}

public spawnchance(id)
{
    new Speech[192]
    read_args(Speech,192)
    remove_quotes(Speech)

    if(get_cvar_num("spawnchance_odds") < 2)
    {
        server_cmd ("spawnchance_odds 2")
        return PLUGIN_CONTINUE
    }
    if(get_cvar_num("spawnchance_odds") > 1000)
    {
        server_cmd ("spawnchance_odds 1000")
        return PLUGIN_CONTINUE
    }
    if(get_cvar_num("spawnchance_wait") < 0)
    {
        server_cmd ("spawnchance_wait 0")
        return PLUGIN_CONTINUE
    }
    if(get_cvar_num("spawnchance_wait") > 5000)
    {
        server_cmd ("spawnchance_wait 5000")
        return PLUGIN_CONTINUE
    }

    if(spawnchance2(id,Speech))    
    return PLUGIN_HANDLED
    return PLUGIN_CONTINUE
}

public spawnchance2(id,Speech[])
{
    if (get_cvar_num("spawnchance_adminbonus") == 1 && (get_user_flags(id) & ADMIN_IMMUNITY) )
    {
        LastSpawnAttempt[id] = -5000.0
    }
    if ( (equali(Speech, "respawnme")) || (equali(Speech, "reviveme")) || (equali(Speech, "revive me")) || (equali(Speech, "/revive")) || (equali(Speech, "/reviveme")) || (equali(Speech, "respawn me")) )
    {
        if (get_cvar_num("spawnchance_on") == 0)
        {
            client_print(id, print_chat, "Respawning is currently disabled.")
            return PLUGIN_HANDLED
        }
        if (cs_get_user_team(id) == CS_TEAM_SPECTATOR)
        {
            client_print(id, print_chat, "Spectators can't respawn silly!.")
            return PLUGIN_HANDLED
        }
        if (RoundEnded == true)
        {
            client_print(id, print_chat, "The round ended, you don't want to waste your chance!.")
            return PLUGIN_HANDLED
        }
        if (is_user_alive(id) == 1)
        {
            client_print(id,print_chat, "You have to be dead before you can attempt to respawn!")
            return PLUGIN_HANDLED
        }
        else if (get_gametime() < LastSpawnAttempt[id] + get_cvar_float("spawnchance_wait"))
        {
            client_print(id,print_chat, "Sorry you can't try to respawn now. Try again in %d seconds.",floatround(LastSpawnAttempt[id] + get_cvar_num("spawnchance_wait") - get_gametime() + 1))
            return PLUGIN_HANDLED
        }

        new ChanceAmount = random(get_cvar_num("spawnchance_odds"))
        new User[32]
        get_user_name(id,User,32)
    
        if (get_cvar_num("spawnchance_adminbonus") == 2 && (get_user_flags(id) & ADMIN_IMMUNITY) )
        {
            client_cmd(id,"spk debris/beamstart9")
            client_print(id,print_chat, "You win! Prepare to be respawned!")
            spawn(id)
            set_task(0.5,"spawnagain",id)
            set_hudmessage(200,0,0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
                show_hudmessage(0,"%s won and has been respawned!",User)
        }
        else
        {
            if (1 == ChanceAmount)
            {
                client_cmd(id,"spk debris/beamstart9")
                client_print(id,print_chat, "You win! Prepare to be respawned!")
                spawn(id)
                set_task(0.5,"spawnagain",id)
                set_hudmessage(200,0,0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
                    show_hudmessage(0,"%s won and has been respawned!",User)
            }
            else if (ChanceAmount > 1)
            {
                client_print(id,print_chat, "Sorry, you didn't respawn this time!")
            }

            LastSpawnAttempt[id] = get_gametime()
            return PLUGIN_CONTINUE
        }
        return PLUGIN_CONTINUE
    }
    return PLUGIN_CONTINUE
}
i just need to change the [Respawn Chance] that in the
Code:
"[Respawn Chance] You have a 1 in %d chance to revive when dead! Say reviveme for your chance!"
to green
sorry for my bad english
itaymitay is offline
DarkCo0oL
Junior Member
Join Date: Nov 2009
Old 11-29-2009 , 18:28   Re: [Native] ColorChat v0.1.0
Reply With Quote #67

how install this plugin?
DarkCo0oL is offline
vivek
BANNED
Join Date: Dec 2009
Old 12-18-2009 , 13:12   Re: [Native] ColorChat v0.1.0
Reply With Quote #68

For grey color whts the code how to do
vivek is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-18-2009 , 13:17   Re: [Native] ColorChat v0.1.0
Reply With Quote #69

Just read 1st post.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
amxxlover
Junior Member
Join Date: Mar 2010
Old 03-20-2010 , 16:56  
Reply With Quote #70

I tried to use the native colorchat in the UTsounds plugin but even when i only add #include <chatcolor.inc> or #include <chatcolor> the plugin don't compile anymore with as error message: error 001: expected token: ";", but found "new".

This native colotchat feature isn't compatible with all plugins or did i something wrong?

Last edited by amxxlover; 03-20-2010 at 17:00.
amxxlover 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 19:43.


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