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

CZ Bots Class name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 07-15-2011 , 22:22   CZ Bots Class name
Reply With Quote #1

I know they dont have the "player" class name is there a specific classname for them?

After some testing This is what i got back from the code below.

Code:
Bot Class Name player
Bot Class Name player
Bot Class Name player
Bot Class Name player
Bot Class Name player
PHP Code:
public client_authorizedid )
{    
    if( !
gBotsRegistered && is_user_botid ) )
    {
        
set_task0.1"register_bots"id );
    }
}

public 
register_botsid )
{
    if( !
gBotsRegistered && is_user_connectedid ) )
    {
        
RegisterHamFromEntityHam_Spawnid"BotSpawn");
        
gBotsRegistered true;
    }
}

public 
BotSpawn(id)
{
    new 
classname[33]
    
pevidpev_classnameclassname32 )
    
    
client_print(0print_chat"Bot Class Name %s"classname);

If thats the case why do i have to register ham from ent ??

Last edited by Doc-Holiday; 07-16-2011 at 00:45.
Doc-Holiday is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-16-2011 , 06:05   Re: CZ Bots Class name
Reply With Quote #2

Works fine with orpheu but not with ham.

If you are interested, i'm using a multiforward to register bots so you don't have to exec multiple tasks through all plugins that need them.

Plugin then looks like this :

PHP Code:
#include <amxmodx>
#include <hamsandwich>

public plugin_init()
{
    
register_plugin("bla","bla","bla")
}

public 
cz_bot_ham_registerableid )
{
    
RegisterHamFromEntityHam_Spawnid"BotSpawn")
}

public 
BotSpawnid )
{
    
// your code here

Attached Files
File Type: sma Get Plugin or Get Source (ham_register_cz_bots.sma - 877 views - 1.8 KB)
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 07-19-2011 at 01:18.
ConnorMcLeod is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 07-18-2011 , 20:18   Re: CZ Bots Class name
Reply With Quote #3

btw just so ppl dont try this and it doesnt work...

get_pcvar_num(g_pCvarBotQuota).... doesnt exist
Attached Files
File Type: sma Get Plugin or Get Source (ham_register_cz_bots.sma - 705 views - 1.8 KB)

Last edited by Doc-Holiday; 07-18-2011 at 21:54.
Doc-Holiday is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-19-2011 , 01:17   Re: CZ Bots Class name
Reply With Quote #4

Ops, fixed.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 07-19-2011 , 02:06   Re: CZ Bots Class name
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
Ops, fixed.
Question you dont have to "include" anything for your plugin it just executes all forwards in any plugin we use using that name?
Doc-Holiday is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-19-2011 , 02:10   Re: CZ Bots Class name
Reply With Quote #6

I don't remember if i had to put (or not) :

forward cz_bot_ham_registerable(index);

at top of .sma, that would be equivalent to include something.


I don't think it is needed for forwards though.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 04-17-2012 , 05:19   Re: CZ Bots Class name
Reply With Quote #7

Hi, sorry revive this old thread, Connor i've bug on your API posted on no 2, Server crash when got another plugin using the same register_message
PHP Code:
register_message(get_user_msgid("TextMsg"), "Message_TextMsg"
I have a plugin that using same function too. To solve this i need to comment on your API:
PHP Code:
//unregister_message(iMsgId, g_iMhTextMsg) 
Just want to know. Is that necessary to unregister back that message?
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019

Last edited by yokomo; 04-17-2012 at 05:21.
yokomo is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-18-2012 , 00:13   Re: CZ Bots Class name
Reply With Quote #8

No, you can even replace register_message with register_event.

PHP Code:
#include <amxmodx>

#define VERSION "0.0.5"
#define PLUGIN "Ham Register Cz Bots"

new g_pCvarBotJoinAfterPlayerg_pCvarBotQuota

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")

    
g_pCvarBotQuota get_cvar_pointer("bot_quota")
    if( !
g_pCvarBotQuota )
    {
        
set_fail_state("Mode is not Condition Zero")
    }
    
g_pCvarBotJoinAfterPlayer get_cvar_pointer("bot_join_after_player")

    
state deactivated
}

public 
client_putinserverid ) <send_forward> {}
public 
client_putinserverid ) <deactivated>
{
    if( 
is_user_bot(id) && get_pcvar_num(g_pCvarBotQuota) )
    {
        if( 
get_pcvar_num(g_pCvarBotJoinAfterPlayer) )
        {
            new 
iPlayers[32], iNum
            get_players
(iPlayersiNum"ch")
            if( !
iNum )
            {
                return
            }
        }

        
register_event("TextMsg""Event_TextMsg""a")
        
state send_forward
    
}
}

public 
Event_TextMsg() <deactivated> {}
public 
Event_TextMsg() <send_forward>
{
    new 
szName[32]
    
read_data(3szNamecharsmax(szName))
    new 
iForward CreateMultiForward("cz_bot_ham_registerable"ET_IGNOREFP_CELL)
    new 
iRet
    ExecuteForward
(iForwardiRetget_user_index(szName))
    
DestroyForward(iForward)
    
    
pause("a")

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 04-18-2012 at 00:19.
ConnorMcLeod is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 04-18-2012 , 01:35   Re: CZ Bots Class name
Reply With Quote #9

Quote:
Originally Posted by ConnorMcLeod View Post
No, you can even replace register_message with register_event.

PHP Code:
#include <amxmodx>

#define VERSION "0.0.5"
#define PLUGIN "Ham Register Cz Bots"

new g_pCvarBotJoinAfterPlayerg_pCvarBotQuota

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")

    
g_pCvarBotQuota get_cvar_pointer("bot_quota")
    if( !
g_pCvarBotQuota )
    {
        
set_fail_state("Mode is not Condition Zero")
    }
    
g_pCvarBotJoinAfterPlayer get_cvar_pointer("bot_join_after_player")

    
state deactivated
}

public 
client_putinserverid ) <send_forward> {}
public 
client_putinserverid ) <deactivated>
{
    if( 
is_user_bot(id) && get_pcvar_num(g_pCvarBotQuota) )
    {
        if( 
get_pcvar_num(g_pCvarBotJoinAfterPlayer) )
        {
            new 
iPlayers[32], iNum
            get_players
(iPlayersiNum"ch")
            if( !
iNum )
            {
                return
            }
        }

        
register_event("TextMsg""Event_TextMsg""a")
        
state send_forward
    
}
}

public 
Event_TextMsg() <deactivated> {}
public 
Event_TextMsg() <send_forward>
{
    new 
szName[32]
    
read_data(3szNamecharsmax(szName))
    new 
iForward CreateMultiForward("cz_bot_ham_registerable"ET_IGNOREFP_CELL)
    new 
iRet
    ExecuteForward
(iForwardiRetget_user_index(szName))
    
DestroyForward(iForward)
    
    
pause("a")

Nice, this one works fine with no crash. Thanks.
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 04-18-2012 , 03:44   Re: CZ Bots Class name
Reply With Quote #10

Quote:
Originally Posted by yokomo View Post
Nice, this one works fine with no crash. Thanks.
Ive had issues with mass plugins using this forward... it would continue running and not register the bots... i have been using this method from rage without issue and same load of plugin


http://forums.alliedmods.net/showpos...7&postcount=41
Doc-Holiday 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 22:20.


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