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-21-2009 , 10:32   show CT player as a spectator in scoreboard
Reply With Quote #1

subject: howto?
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-21-2009 , 10:57   Re: show CT player as a spectator in scoreboard
Reply With Quote #2

The "yourFunction()" function is just an example:
PHP Code:
new const g_szTeams[4] =
{
    
"UNASSIGNED",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
}

new 
g_Msg_TeamInfo;

public 
plugin_init()
{
    
g_Msg_TeamInfo get_user_msgid("TeamInfo");
}

public 
yourFunction(id)
{
    if(
get_user_team(id) == 2)
    {
        
setScoreTeam(id3); // As you should know, 1 = T, 2 = CT and 3 = SPECTATOR(0 = UNASSIGNED).
    
}
}

setScoreTeam(indexteam)
{
    
message_begin(MSG_BROADCASTg_Msg_TeamInfo);
    
write_byte(index);
    
write_string(g_szTeams[team]);
    
message_end();

__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
kielor
Senior Member
Join Date: Jan 2009
Location: Russia, Novosibirsk
Old 01-29-2009 , 08:42   Re: show CT player as a spectator in scoreboard
Reply With Quote #3

hmm.. when i'm running this on dedicated server it doesn't work((
bot is created but he shows in score board as ct, but i need that he must be CT but in scoreboard shown as a SPECTATOR

could anyone help me?
kielor is offline
Send a message via ICQ to kielor Send a message via Skype™ to kielor
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 01-29-2009 , 08:49   Re: show CT player as a spectator in scoreboard
Reply With Quote #4

Quote:
Originally Posted by kielor View Post
hmm.. when i'm running this on dedicated server it doesn't work((
bot is created but he shows in score board as ct, but i need that he must be CT but in scoreboard shown as a SPECTATOR

could anyone help me?
Dores' code was only an example:
1. If you didn't edit the code, there's no way it could work.
2. if you edited it, the problem can be there. Why wouldn't you post your code, so someone could have even a little chance to fix it?
SnoW is offline
Send a message via MSN to SnoW
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-29-2009 , 10:58   Re: show CT player as a spectator in scoreboard
Reply With Quote #5

As SnoW said, post the full code you're using.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 01-29-2009 , 11:16   Re: show CT player as a spectator in scoreboard
Reply With Quote #6

PHP Code:
new const g_szTeams[4] =
{
    
"UNASSIGNED",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"

Eh...
PHP Code:
new const g_szTeams[4][] =
{
    
"UNASSIGNED",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"

__________________
Join US - custom Zombie Server - Custom Addons:



Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-29-2009 , 12:42   Re: show CT player as a spectator in scoreboard
Reply With Quote #7

Woops, missed that one. Thanks Sn!ff3r.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
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 #8

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 #9

First set his team to CT, then change score board.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
kielor
Senior Member
Join Date: Jan 2009
Location: Russia, Novosibirsk
Old 01-30-2009 , 11:30   Re: show CT player as a spectator in scoreboard
Reply With Quote #10

like this:

PHP Code:
_bot_settings(botid)
{
    
set_pev(botidpev_effects, (pev(botpev_effects) | 128));
    
set_pev(botidpev_solidSOLID_NOT);
    
set_pev(botidpev_takedamage0.0);
    
cs_set_user_deaths(botid, -1000);
    
set_pev(botidpev_frags1337.0);
    if(
cs_get_user_team(botid) != CS_TEAM_CT)
        
cs_set_user_team(botidCS_TEAM_CTCS_CT_URBAN);
    
setScoreTeam(botid);

if yes, nothing happened, but on listen server it works correctly
kielor is offline
Send a message via ICQ to kielor Send a message via Skype™ to kielor
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