AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   learn to talk boats (https://forums.alliedmods.net/showthread.php?t=117174)

F4RR3LL 01-29-2010 19:12

learn to talk boats
 
it is necessary to make so that time in X seconds boats for CT and T to a chat wrote the certain message

has tried to make through client_cmd - it has not turned out

code in which it is necessary to thrust function:
Code:

#include <amxmodx>
#include <fakemeta>
#include <cstrike>

new botIds[3]

new const botnames[sizeof botIds][] =
{
    "TE [CSDM]", // t
    "CT [CSDM]", // ct
    "Advert bot" // spec
}

new gmsgScoreInfo

public plugin_init()
{
    register_plugin("Fake TeamBot", "1.0", "OneEyed")
   
    gmsgScoreInfo = get_user_msgid("ScoreInfo")
   
    register_event("HLTV", "StartRound", "a", "1=0", "2=0")
}

public plugin_cfg()
{
    set_task(1.0, "createBots")
}

public StartRound()
{
    set_task(0.5, "PostStartRound")
}

public PostStartRound()
{
    new i, bot
   
    for(;i<sizeof botIds;i++)
    {
        bot = botIds[i]
       
        set_pev(bot, pev_origin, Float:{9999.0, 9999.0, 9999.0})
       
        fm_set_user_frags(bot, -1)
        fm_set_user_deaths(bot, -1)
       
        if(!(pev(bot, pev_effects) | EF_NODRAW))
            set_pev(bot, pev_effects, pev(bot, pev_effects) | EF_NODRAW )
       
        set_pev(bot, pev_solid, SOLID_NOT)
        set_pev(bot, pev_takedamage, DAMAGE_NO)
    }
}

public createBots()
{
    new bot, i, ptr[128]
   
    for(;i<sizeof botIds;i++)
    {
        if((bot = find_player("bli", botnames[i])))
        {
            botIds[i] = bot
           
            continue
        }
       
        botIds[i] = bot = engfunc(EngFunc_CreateFakeClient, botnames[i])
       
        dllfunc(DLLFunc_ClientConnect, bot, botnames[i], "127.0.0.1", ptr)
       
        dllfunc(DLLFunc_ClientPutInServer, bot)
       
        set_pev(bot, pev_flags, pev(bot, pev_flags) | FL_FAKECLIENT)
       
        set_pev(bot, pev_solid, SOLID_NOT)
       
        set_pev(bot, pev_takedamage, DAMAGE_NO)
       
        set_pev(bot, pev_effects, pev(bot, pev_effects) | EF_NODRAW)
       
        switch(i)
        {
            case 0: cs_set_user_team(bot, CS_TEAM_T, CS_T_TERROR)
            case 1: cs_set_user_team(bot, CS_TEAM_CT, CS_CT_URBAN)
            case 2: cs_set_user_team(bot, CS_TEAM_SPECTATOR)
        }
       
        set_pev(bot, pev_origin, Float:{9999.0, 9999.0, 9999.0})
       
        fm_set_user_frags(bot, -1)
        fm_set_user_deaths(bot, -1)
    }
}

#if cellbits == 32
    #define OFFSET_TEAM 114
#else
    #define OFFSET_TEAM 139
#endif

#define OFFSET_CSDEATHS 444

stock fm_set_user_frags(id, newfrags)
{
    new deaths = get_pdata_int(id, OFFSET_CSDEATHS)
   
    set_pev(id, pev_frags, float(newfrags))
   
    message_begin(MSG_ALL, gmsgScoreInfo)
    write_byte(id)
    write_short(newfrags)
    write_short(deaths)
    write_short(0)
    write_short(get_pdata_int(id, OFFSET_TEAM))
    message_end()
}

stock fm_set_user_deaths(id, newdeaths)
{
    new Float:frags
    pev(id, pev_frags, frags)

    set_pdata_int(id, OFFSET_CSDEATHS, newdeaths)

    message_begin(MSG_ALL, gmsgScoreInfo)
    write_byte(id)
    write_short(floatround(frags))
    write_short(newdeaths)
    write_short(0)
    write_short(get_pdata_int(id, OFFSET_TEAM))
    message_end()
}

thanks

F4RR3LL 01-30-2010 12:53

Re: learn to talk boats
 
Code:

message_begin(MSG_ALL, get_user_msgid("SayText"))
        write_byte(botIds[i])
        write_string("#Cstrike_Chat_All")
        write_string("")
        write_string("I am Bot2")
        message_end()

close :)


All times are GMT -4. The time now is 07:26.

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