Raised This Month: $12 Target: $400
 3% 

Help with fakefull_original


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
beasTez2
Member
Join Date: Sep 2013
Old 09-14-2014 , 03:50   Help with fakefull_original
Reply With Quote #1

Hello everyone ! I need help with bots plugin. Can someone edit this plugin, for example, if on the server are 29 players, 1 bot will be kicked, 30 players - second bot, 31 players - third bot. And if players leave the server (from 32 players to 31 players), server will add first bot, 30 players - second bot and 29 players third...Thanks for any helping.
Attached Files
File Type: sma Get Plugin or Get Source (fakefull_original.sma - 511 views - 7.5 KB)
beasTez2 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-14-2014 , 06:21   Re: Help with fakefull_original
Reply With Quote #2

Post in the plugin theard.
__________________
HamletEagle is offline
DeVe
Member
Join Date: Jul 2014
Old 09-14-2014 , 06:47   Re: Help with fakefull_original
Reply With Quote #3

Try this :

PHP Code:
#include amxmodx
#include fakemeta

#define AUTHOR "x"
#define VERSION "1.0.0"
#define PLUGIN_NAME "x"

#define NUMAR_DE_BOTI 2

new g_Query[256];
new 
botz;

public 
plugin_init()
{
    
register_plugin(PLUGIN_NAMEVERSIONAUTHOR);
    
set_task5.0"TaskManageBots", .flags="b" );
    
botz 0;
}

new 
g_Bot[33], g_BotsCount;

public 
TaskManageBots(){
    static 
PlayersNumPlayersNum  get_playersnum);
    if( 
PlayersNum get_maxplayers() - && g_BotsCount )
    {
        
CreateBot();
    }
    else if(
PlayersNum get_maxplayers() - && g_BotsCount )
    {
        
RemoveBot();
    }
}
new const 
g_Names[][]=
{
    
"MSG 1",
    
"MSG 2"
};

public 
client_disconnect(i)
{
   if( 
g_Bot] ) {
      
g_Bot] = 0g_BotsCount -- ; botz -= 1;
   }
}

RemoveBot(){
   static 
i;
   for( 
1<= get_maxplayers(); i++ ) {
      if(
g_Bot]) 
      {
        
server_cmd"kick #%d"get_user_userid) );
        
botz -= 1;
        break;
      }}}

CreateBot(){
   static 
Bot;
   
formatexg_Query255"%s"g_Names[botz] );
   
botz += 1;
   
Bot engfuncEngFunc_CreateFakeClientg_Query );
   if( 
Bot &&pev_valid(Bot)) {
      
dllfunc(MetaFunc_CallGameEntity,"player",Bot);
      
set_pev(Bot,pev_flags,FL_FAKECLIENT);
      
set_pev(Botpev_model"");
      
set_pev(Botpev_viewmodel2"");
      
set_pev(Botpev_modelindex0);
      
set_pev(Botpev_renderfxkRenderFxNone);
      
set_pev(Botpev_rendermodekRenderTransAlpha);
      
set_pev(Botpev_renderamt0.0);
      
set_pdata_int(Bot,114,0);
      
message_begin(MSG_ALL,get_user_msgid("TeamInfo"));
      
write_byte(Bot);
      
write_string("UNASSIGNED");
      
message_end();
      
g_Bot[Bot]=1;
      
g_BotsCount++;
   }

DeVe is offline
beasTez2
Member
Join Date: Sep 2013
Old 09-14-2014 , 09:55   Re: Help with fakefull_original
Reply With Quote #4

Quote:
Originally Posted by DeVe View Post
Try this :

PHP Code:
#include amxmodx
#include fakemeta

#define AUTHOR "x"
#define VERSION "1.0.0"
#define PLUGIN_NAME "x"

#define NUMAR_DE_BOTI 2

new g_Query[256];
new 
botz;

public 
plugin_init()
{
    
register_plugin(PLUGIN_NAMEVERSIONAUTHOR);
    
set_task5.0"TaskManageBots", .flags="b" );
    
botz 0;
}

new 
g_Bot[33], g_BotsCount;

public 
TaskManageBots(){
    static 
PlayersNumPlayersNum  get_playersnum);
    if( 
PlayersNum get_maxplayers() - && g_BotsCount )
    {
        
CreateBot();
    }
    else if(
PlayersNum get_maxplayers() - && g_BotsCount )
    {
        
RemoveBot();
    }
}
new const 
g_Names[][]=
{
    
"MSG 1",
    
"MSG 2"
};

public 
client_disconnect(i)
{
   if( 
g_Bot] ) {
      
g_Bot] = 0g_BotsCount -- ; botz -= 1;
   }
}

RemoveBot(){
   static 
i;
   for( 
1<= get_maxplayers(); i++ ) {
      if(
g_Bot]) 
      {
        
server_cmd"kick #%d"get_user_userid) );
        
botz -= 1;
        break;
      }}}

CreateBot(){
   static 
Bot;
   
formatexg_Query255"%s"g_Names[botz] );
   
botz += 1;
   
Bot engfuncEngFunc_CreateFakeClientg_Query );
   if( 
Bot &&pev_valid(Bot)) {
      
dllfunc(MetaFunc_CallGameEntity,"player",Bot);
      
set_pev(Bot,pev_flags,FL_FAKECLIENT);
      
set_pev(Botpev_model"");
      
set_pev(Botpev_viewmodel2"");
      
set_pev(Botpev_modelindex0);
      
set_pev(Botpev_renderfxkRenderFxNone);
      
set_pev(Botpev_rendermodekRenderTransAlpha);
      
set_pev(Botpev_renderamt0.0);
      
set_pdata_int(Bot,114,0);
      
message_begin(MSG_ALL,get_user_msgid("TeamInfo"));
      
write_byte(Bot);
      
write_string("UNASSIGNED");
      
message_end();
      
g_Bot[Bot]=1;
      
g_BotsCount++;
   }

It works, but...When players leave the server (maxplayers<30 , or 29) bots can't connect to server and plugin has errors:

Code:
L 09/14/2014 - 17:54:58: [AMXX] Displaying debug trace (plugin "new_bots.amxx")
L 09/14/2014 - 17:54:58: [AMXX] Run time error 4: index out of bounds 
L 09/14/2014 - 17:54:58: [AMXX]    [0] new_bots.sma::CreateBot (line 59)
L 09/14/2014 - 17:54:58: [AMXX]    [1] new_bots.sma::TaskManageBots (line 26)
beasTez2 is offline
DeVe
Member
Join Date: Jul 2014
Old 09-14-2014 , 10:14   Re: Help with fakefull_original
Reply With Quote #5

PHP Code:
if( PlayersNum get_maxplayers() - && g_BotsCount 




PHP Code:
if( PlayersNum get_maxplayers() - && g_BotsCount 2


If you use

#define NUMAR_DE_BOTI 2


Last edited by DeVe; 09-14-2014 at 10:19.
DeVe is offline
beasTez2
Member
Join Date: Sep 2013
Old 09-14-2014 , 12:08   Re: Help with fakefull_original
Reply With Quote #6

Quote:
Originally Posted by DeVe View Post
PHP Code:
if( PlayersNum get_maxplayers() - && g_BotsCount 




PHP Code:
if( PlayersNum get_maxplayers() - && g_BotsCount 2


If you use

#define NUMAR_DE_BOTI 2

Ops I've forgotten that, but still the same error : (
beasTez2 is offline
DeVe
Member
Join Date: Jul 2014
Old 09-14-2014 , 13:12   Re: Help with fakefull_original
Reply With Quote #7

It`s not possible I just test it.

It`s work fine for me !


I will run more test to see !

Last edited by DeVe; 09-14-2014 at 13:13.
DeVe is offline
beasTez2
Member
Join Date: Sep 2013
Old 09-14-2014 , 13:32   Re: Help with fakefull_original
Reply With Quote #8

I test this plugin with potti.amxx (new moving bots) and maybe this could be problem...Or I need to test this plugin on server with people?
beasTez2 is offline
DeVe
Member
Join Date: Jul 2014
Old 09-14-2014 , 14:09   Re: Help with fakefull_original
Reply With Quote #9

Its better to test on server whit people to see . I Will come back whit news when I will look on your issues!
DeVe is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 09-14-2014 , 22:59   Re: Help with fakefull_original
Reply With Quote #10

Quote:
Originally Posted by beasTez2 View Post
I test this plugin with potti.amxx (new moving bots) and maybe this could be problem...Or I need to test this plugin on server with people?
potti doesn't support more than one single bot AFAIK
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever 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 18:14.


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