Raised This Month: $ Target: $400
 0% 

show CT player as a spectator in scoreboard


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kielor
Senior Member
Join Date: Jan 2009
Location: Russia, Novosibirsk
Old 01-30-2009 , 09:21   Re: show CT player as a spectator in scoreboard
Reply With Quote #1

Here's a code

Code:
#include <amxmodx>
#include <amxmisc>
#include <kz>

#define _TEAM_T 1
#define _TEAM_CT 2

new g_Msg_TeamInfo;

new bot;

new bot_name[32] = "kreedz bot";

new kz_enabled;

public plugin_init()
{
    register_plugin("kzbot", "1.0", "kielor");
    kz_enabled = get_cvar_pointer("kz_enabled");
    g_Msg_TeamInfo = get_user_msgid("TeamInfo");
}

public kz_Init(_state)
{
    if(!_state)
    {
        _kick_bot();
        pause("a");
        return;
    }

    if(!get_pcvar_num(kz_enabled))
    {
        _kick_bot();
        return;
    }
}

_kick_bot()
{
    if(bot)
        server_cmd("kick #%d", get_user_userid(bot));

    server_exec();
}

public RoundStart()
{
    if(!get_pcvar_num(kz_enabled))
        return;

    new players[32], nums;
    get_players(players, nums, "d");

    if(!bot && !nums)
        _make_player(_TEAM_CT);

    set_task(0.5, "delay_bot_settings");
}

public delay_bot_settings()
{
    if(get_pcvar_num(kz_enabled))
    {
        if(!is_user_alive(bot))
            dllfunc(DLLFunc_Spawn, bot);

        if(bot)
            _bot_settings(bot);
    }
}

_bot_settings(botid)
{
    set_pev(botid, pev_effects, (pev(bot, pev_effects) | 128));
    set_pev(botid, pev_solid, SOLID_NOT);
    set_pev(botid, pev_takedamage, 0.0);
    cs_set_user_deaths(botid, -1000);
    set_pev(botid, pev_frags, 1337.0);
    setScoreTeam(botid);

    if(cs_get_user_team(botid) != CS_TEAM_CT)
        cs_set_user_team(botid, CS_TEAM_CT, CS_CT_URBAN);
}

_make_player(_team)
{
    if(get_pcvar_num(kz_enabled))
    {
        if(!bot)
        {
            new reject[128];
            new botid = bot = engfunc(EngFunc_CreateFakeClient, bot_name);

            if(botid)
            {
                set_user_info(botid, "*bot", "1");
                dllfunc(DLLFunc_ClientConnect, botid, bot_name, "127.0.0.1", reject);
                dllfunc(DLLFunc_ClientPutInServer, botid);

                cs_set_user_team(botid, _team, (_team == 2) ? CS_CT_URBAN : CS_T_TERROR);
                set_user_flags(botid, ADMIN_IMMUNITY);
            }
            else
                log_amx("Failed to create %s bot", bot_name);
        }
    }
}

setScoreTeam(index)
{
    message_begin(MSG_BROADCAST, g_Msg_TeamInfo);
    write_byte(index);
    write_string("SPECTATOR");
    message_end();
}
kielor is offline
Send a message via ICQ to kielor Send a message via Skype™ to kielor
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-30-2009 , 10:16   Re: show CT player as a spectator in scoreboard
Reply With Quote #2

First set his team to CT, then change score board.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
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 01:51.


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