(Solucionado) Error Bot Spectating
#1
Saludos a todos, actualmente estoy usando el Bot Spectating de OsweRRR;.

https://amxmodx-es.com/showthread.php?tid=21057

El error que tengo es que me tumba el servidor, al ponerlo funciona perfecto pero al cambiar de mapa se cae y me tira error tengo que desactivar el plugin para que el servidor pueda arrancar bien. aquí dejo el error que tira para ver si alguien podría ayudarme se lo agradecería de antemano.

(map "de_dust2") GetClient_t: invalid id provided: -256156849 no solo pasa con dust2, pasa con los demas mapas.

Aqui les dejo el codigo.

Código PHP:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta>
#include <engine>

new const BOT_CLASSNAME[] = "BOT_ENT"
new ent_think

new pCvar_MaxPlayers

new Count_Players
new Count_Bots

new const Bot_Names[][] = 
{
    "bot 1",
    "bot 2",
    "bot 3",
    "bot 4",
    "bot 5"
}

public 
plugin_init()
{
    register_plugin("Bots Spectators""1.0""OsweRRR;")
    
    pCvar_MaxPlayers 
register_cvar("bot_maxplayers""20")
    
    register_forward
(FM_ClientDisconnect"pfn_Client_Disconnect")
    
    ent_think 
create_entity("info_target")
    if(ent_think)
    {
        entity_set_string(ent_thinkEV_SZ_classnameBOT_CLASSNAME)
        register_think(BOT_CLASSNAME"pfn_Bot_Task")
    }
}

public 
plugin_cfg()
{
    new i
    
while(sizeof Bot_Names)
    
        CS_Create_Bot(i++)
    }
}

public 
client_putinserver(id)
{
    if(is_user_bot(id))
    {
        Count_Bots++
        return
    }
    
    Count_Players
++
    entity_set_float(ent_thinkEV_FL_nextthinkget_gametime() + 1.0)
}

public 
pfn_Client_Disconnect(id)
{
    if(is_user_bot(id))
    {
        Count_Bots--
        return
    }
    
    Count_Players
--
    entity_set_float(ent_thinkEV_FL_nextthinkget_gametime() + 1.0)
}

public 
pfn_Bot_Task(ent)
{
    if(!is_valid_ent(ent))
    {
        return
    }
    
    
if(Count_Players >= get_pcvar_num(pCvar_MaxPlayers))
    {
        static MaxPlayersi
        
if(!MaxPlayers)
        {
            MaxPlayers get_maxplayers()
        }
        for(1<= MaxPlayersi++)
        {
            if(is_user_connected(i) && is_user_bot(i))
            {
                server_cmd("kick #%d ^"Server full.^""get_user_userid(i))
            }
        }
    }
    else
    {
        if(Count_Bots != sizeof Bot_Names)
        {
            plugin_cfg()
        }
    }
}

CS_Create_Bot(const name_id)
{
    new id engfunc(EngFunc_CreateFakeClientBot_Names[name_id])
    if(pev_valid(id))
    {
        engfunc(EngFunc_FreeEntPrivateDataid)
        dllfunc(MetaFunc_CallGameEntity"player"id)
        
        set_pev
(idpev_flagspev(idpev_flags) | FL_FAKECLIENT)
        
        dllfunc
(DLLFunc_ClientConnectidBot_Names[name_id], "127.0.0.1")
        dllfunc(DLLFunc_ClientPutInServerid)
        
        engclient_cmd
(id"jointeam""6")
    }
    return id

Responder
#2
Mira te dejo un plugin que cumple la misma funcion.

https://forums.alliedmods.net/showthread.php?t=293059
_____________________________________________________________________________
(05/08/2020, 06:47 PM)acetatomil escribió: Vos también sos trolazo por responder, y también me incluyo y el que lo lea también. Bue.

_____________________________________________________________________________
Responder
#3
(20/09/2021, 12:14 AM)El Abuelo escribió: Mira te dejo un plugin que cumple la misma funcion.

https://forums.alliedmods.net/showthread.php?t=293059

Muchas gracias, funciona perfecto. Mario
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)