View Single Post
Author Message
lantimilan
Senior Member
Join Date: May 2016
Old 01-26-2021 , 07:21   3 Bots make error in new amxmodx
Reply With Quote #1

Hello when i set last version amxx mod 1.10 i have this error can tell me somebody if fixed ?

L 01/26/2021 - 12:46:05: [CSTRIKE] Invalid player 2 (not in-game)
L 01/26/2021 - 12:46:05: [AMXX] Displaying debug trace (plugin "fakefull_original.amxx", version "1.7.6")
L 01/26/2021 - 12:46:05: [AMXX] Run time error 10: native error (native "cs_set_user_team")
L 01/26/2021 - 12:46:05: [AMXX] [0] fakefull_original.sma::set_team (line 288 )
L 01/26/2021 - 12:46:05: [AMXX] [1] fakefull_original.sma::createBot (line 197)
L 01/26/2021 - 12:46:06: [CSTRIKE] Invalid player 3 (not in-game)
L 01/26/2021 - 12:46:06: [AMXX] Displaying debug trace (plugin "fakefull_original.amxx", version "1.7.6")
L 01/26/2021 - 12:46:06: [AMXX] Run time error 10: native error (native "cs_set_user_team")
L 01/26/2021 - 12:46:06: [AMXX] [0] fakefull_original.sma::set_team (line 288 )
L 01/26/2021 - 12:46:06: [AMXX] [1] fakefull_original.sma::createBot (line 197)

http://prntscr.com/xnmhy3
http://prntscr.com/xnmmqt


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

new const Plugin[] = "FakeFull Original"
new const Version[] = "1.7.6"
new const Author[] = "JTP10181/Freecode/AssKicR"

#define MAX_NAMES 256

new bool:is_user_ffbot[33]
new 
bool:checkingStatus false
new bool:changingBots false
new botCount 0namesread 0
new namesToUse[MAX_NAMES][33]
new 
pDelaypAutopPlayers

public plugin_init()
{
    
register_plugin(Plugin,Version,Author)
    
pAuto register_cvar("ff_automode","0")
    
pPlayers register_cvar("ff_players","2")
    
pDelay register_cvar("ff_delay","1")
    
register_concmd("amx_addfake","botadd",ADMIN_BAN,"<# | @FILL> - add this many bots")
    
register_concmd("amx_removefake","botremove",ADMIN_BAN,"<# | @ALL> - remove this many bots")
    
set_task(10.0,"ServerStatus",0,_,_,"b")
    
ReadNames()

    
//Setup jtp10181 CVAR
    
new cvarString[256], shortName[16]
    
copy(shortName,15,"ff")

    
register_cvar("jtp10181","",FCVAR_SERVER|FCVAR_SPONLY)
    
get_cvar_string("jtp10181",cvarString,255)

    if (
strlen(cvarString) == 0) {
        
formatex(cvarString,255,shortName)
        
set_cvar_string("jtp10181",cvarString)
    }
    else if (
contain(cvarString,shortName) == -1) {
        
format(cvarString,255,"%s,%s",cvarStringshortName)
        
set_cvar_string("jtp10181",cvarString)
    }
}

public 
plugin_natives()
{
    
set_module_filter("module_filter")
    
set_native_filter("native_filter")
}

public 
module_filter(const module[])
{
    if (!
cstrike_running() && equali(module"cstrike")) {
        return 
PLUGIN_HANDLED
    
}

    return 
PLUGIN_CONTINUE
}

public 
native_filter(const name[], indextrap)
{
    if (!
trap) return PLUGIN_HANDLED

    
return PLUGIN_CONTINUE
}

public 
botadd(id,level,cid)
{
    if (!
cmd_access(id,level,cid,1)) return PLUGIN_HANDLED

    
new arg[10], botNum

    
if (read_argc() == 1botNum 1
    
else {
        
read_argv(1,arg,9)
        if (
equali(arg,"@FILL")) botNum get_maxplayers() - get_playersnum(1)
        else 
botNum str_to_num(arg)
    }

    if (
botNum <=|| botNum get_maxplayers() - get_playersnum(1)) {
        
console_print(id,"[Shkupi Info] Numri gabuar per shtimin e botave")
        return 
PLUGIN_HANDLED
    
}

    new 
Float:botDelay get_pcvar_float(pDelay)
    
console_print(id,"[Shkupi Info] U shtuan %d bota me %.1f sekonda diferenc",botNum,botDelay)
    
set_task(botDelay,"createBot",0,_,_,"a",botNum)
    
set_task(botDelay * (botNum 1),"doneChanging")
    
changingBots true

    
return PLUGIN_HANDLED
}

public 
botremove(id,level,cid)
{
    if (!
cmd_access(id,level,cid,1)) return PLUGIN_HANDLED

    
new arg[10], botNum

    
if (read_argc() == 1botNum 1

    
else {
        
read_argv(1,arg,9)
        if (
equali(arg,"@ALL")) botNum botCount
        
else botNum str_to_num(arg)
    }

    if (
botNum <=|| botNum botCount) {
        
console_print(id,"[Shkupi Info] Numri gabim per largimin e botave")
        return 
PLUGIN_HANDLED
    
}

    new 
Float:botDelay get_pcvar_float(pDelay)
    
console_print(id,"[Shkupi Info] U larguan %d bota me %.1f sekonda diferenc",botNum,botDelay)
    
set_task(botDelay,"removeBot",0,_,_,"a",botNum)
    
set_task(botDelay * (botNum 1),"doneChanging")
    
changingBots true

    
return PLUGIN_HANDLED
}

public 
client_putinserver(id)
{
    
//Don't want anyone going invisible on us
    
set_pev(idpev_rendermodekRenderNormal)

    
is_user_ffbot[id] = false
    ServerStatus
()
}

public 
client_disconnect(id)
{
    
is_user_ffbot[id] = false
    ServerStatus
()
}

public 
createBot()
{
    new 
bool:UseAnotherName
    
new BotName[33], UserNames[33][33]
    new 
name_rand random_num(0,namesread 1)
    new 
endLoop name_rand 1
    
if (endLoop 0endLoop namesread 1

    
//Save all the usernames so we dont have to keep getting them all
    
for (new 1<= 32x++) {
        if (!
is_user_connected(x)) continue
        
get_user_name(x,UserNames[x],32)
    }

    do {
        
UseAnotherName false
        copy
(BotName,32,namesToUse[name_rand])

        for (new 
id 1id <= 32id++) {

            if (!
is_user_connected(id)) continue

            if (
equali(BotName,UserNames[id])) {
                
UseAnotherName true

                
if (name_rand == endLoop) {
                    
UseAnotherName false
                    log_amx
("ERROR: Ran out of names to use, please add more to botnames.ini")
                }

                
name_rand++
                if (
name_rand namesread 1) {
                    
name_rand 0
                
}
                break
            }
        }
    } while(
UseAnotherName)

    new 
Bot engfunc(EngFunc_CreateFakeClientBotName)

    if (
Bot 0) {
        
//Supposed to prevent crashes?
        
dllfunc(MetaFunc_CallGameEntity"player"Bot)
        
set_pev(Botpev_flagsFL_FAKECLIENT)

        
//Make Sure they have no model
        
set_pev(Botpev_model"")
        
set_pev(Botpev_viewmodel2"")
        
set_pev(Botpev_modelindex0)

        
//Make them invisible for good measure
        
set_pev(Botpev_renderfxkRenderFxNone)
        
set_pev(Botpev_rendermodekRenderTransAlpha)
        
set_pev(Botpev_renderamt0.0)

        
//Set the team if we need to for this mod
        
set_team(Bot)

        
is_user_ffbot[Bot] = true
        botCount
++
    }
}

public 
removeBot()
{
    for(new 
id 1id <= 32id++) {
        if (
is_user_ffbot[id]) {
            
server_cmd("kick #%d",get_user_userid(id))
            
is_user_ffbot[id] = false
            botCount
--
            return
        }
    }
}

public 
doneChanging()
{
    
changingBots false
}

public 
ServerStatus()
{
    if ( !
get_pcvar_num(pAuto) ) return
    if ( 
checkingStatus || changingBots ) return

    
checkingStatus true
    
new rnd

    
if (botCount 0) {
        for (new 
id 1id <= 32id++) {

            if (!
is_user_connected(id)) continue
            if (!
is_user_ffbot[id]) continue
            
rnd random_num(1,100)
            if (
rnd <= 10) {
                
set_user_frags(id,get_user_frags(id) + 1)
            }

            
//Set the team if we need to for this mod
            
set_team(id)

            if (
get_user_team(id) > 0) {
                
server_cmd("kick #%d",get_user_userid(id))
                
is_user_ffbot[id] = false
                botCount
--
            }
        }
    }

    new 
pnum get_playersnum(1)
    new 
maxplayers get_maxplayers()
    new 
ff_players get_pcvar_num(pPlayers)
    new 
Float:botDelay get_pcvar_float(pDelay)

    if (
ff_players maxplayers 2) {
        
ff_players maxplayers 2
        set_pcvar_num
(pPlayersff_players)
    }

    if (
botDelay <= 0.0 ) {
        
log_amx("ERROR: Please set ff_delay to a number higher than 0")
    }

    else if (
ff_players pnum) {
        new 
addnum ff_players pnum
        set_task
(botDelay,"createBot",0,_,_,"a",addnum)
        
set_task(botDelay * (addnum 1),"doneChanging")
        
changingBots true
    
}

    else if (
ff_players pnum) {
        new 
removenum pnum ff_players
        removenum 
min(removenumbotCount)

        if (
removenum 0) {
            
set_task(botDelay,"removeBot",0,_,_,"a",removenum)
            
set_task(botDelay * (removenum 1),"doneChanging")
            
changingBots true
        
}
    }

    
checkingStatus false
}

public 
set_team(BotID)
{
    if (
cstrike_running()) {
        
cs_set_user_team(BotIDCS_TEAM_UNASSIGNED)
    }
}

public 
ReadNames() {

    new 
botnames_file[128]
    
get_configsdir(botnames_file63)
    
format(botnames_file,127,"%s/shkupibots.txt",botnames_file)

    new 
botnames fopen(botnames_file,"r")

    if (
botnames) {
        new 
data[35]

        while(!
feof(botnames)) {

            if (
namesread >= MAX_NAMES) {
                
log_amx("MAX_NAMES exceeded, not all fake client names were able to load")
                break
            }

            
fgets(botnamesdata34)
            
trim(data)

            new 
len strlen(data)
            if (
len <= 0) return
            if (
data[len]-== '^n'data[--len] = 0

            
if (equal(data,"") || equal(data,"#",1)) continue

            
copy(namesToUse[namesread],32,data)
            
namesread++
        }

        
fclose(botnames)
    }
    else {
        new 
failmsg[128]
        
formatex(failmsg,128,"Unable to read file ^"%s^", it is required to load bot names from"botnames_file)
        
log_amx(failmsg)
        
set_fail_state(failmsg)
    }


Last edited by lantimilan; 02-04-2021 at 03:13.
lantimilan is offline
Send a message via MSN to lantimilan