AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ham_spawn not works for yapb bot (https://forums.alliedmods.net/showthread.php?t=314373)

karaulov 02-16-2019 06:46

ham_spawn not works for yapb bot
 
I need bot (or fake players) for test plugins, please help how to do it ?

(Create 'real' fake player, with ham_spawn support)

Natsheh 02-16-2019 07:19

Re: ham_spawn not works for yapb bot
 
https://forums.alliedmods.net/showpo...1&postcount=12



Search..always before you post a question

CrazY. 02-16-2019 08:02

Re: ham_spawn not works for yapb bot
 
cs_ham_bots_api
https://forums.alliedmods.net/showthread.php?t=263261

Besides, latest amxmodx version already register Ham hooks on bots.
https://www.amxmodx.org/api/hamsandwich/RegisterHam

karaulov 02-16-2019 09:58

Re: ham_spawn not works for yapb bot
 
Quote:

Originally Posted by CrazY. (Post 2639859)
Besides, latest amxmodx version already reigister Ham hooks on bots.
https://www.amxmodx.org/api/hamsandwich/RegisterHam

Not works with yapb bot

CrazY. 02-16-2019 10:03

Re: ham_spawn not works for yapb bot
 
What's your amxx version?

Quote:

I need bot (or fake players) for test plugins, please help how to do it ?

(Create 'real' fake player, with ham_spawn support)
Podbots or cs/cz bots (not sure if it's allowed).

HamletEagle 02-16-2019 10:23

Re: ham_spawn not works for yapb bot
 
In client_putinserver check if the user is a bot, then set a 0.1 seconds task and in the task do RegisterHamFromEntity using the bot index.

WATCH_DOGS UNITED 09-16-2021 21:33

Re: ham_spawn not works for yapb bot
 
Quote:

Originally Posted by HamletEagle (Post 2639903)
In client_putinserver check if the user is a bot, then set a 0.1 seconds task and in the task do RegisterHamFromEntity using the bot index.

Hi! We were able to make our code work with bots. But this required to duplicate the code (1 for humans and 1 for bots). Could you show us the code registering with RegisterHamFromEntity?

HamletEagle 09-18-2021 11:01

Re: ham_spawn not works for yapb bot
 
Quote:

Originally Posted by WATCH_DOGS UNITED (Post 2757975)
Hi! We were able to make our code work with bots. But this required to duplicate the code (1 for humans and 1 for bots). Could you show us the code registering with RegisterHamFromEntity?

Here
PHP Code:

#include <amxmodx>
#include <hamsandwich>

new bool:registeredHamForBots

public plugin_init()
{
    
RegisterHam(Ham_Spawn"player""SpawnHook"1)
}


public 
client_putinserver(id)
{
    if(
is_user_bot(id) && !registeredHamForBots)
    {
        
registeredHamForBots true
        set_task
(0.1"registerHamForBots"id)
    }
}

public 
registerHamForBots(id)
{
    
RegisterHamFromEntity(Ham_Spawnid"SpawnHook"true)
}

public 
SpawnHook(id)
{
    if(
is_user_alive(id))
    {
        
//do stuff for both players and bots here
    
}


No need to duplicate any code.

wilian159 09-19-2021 23:25

Re: ham_spawn not works for yapb bot
 
use:

PHP Code:

RegisterHam(Ham_Spawn"player""SpawnHook"truetrue


HamletEagle 09-20-2021 11:20

Re: ham_spawn not works for yapb bot
 
Quote:

Originally Posted by wilian159 (Post 2758249)
use:

PHP Code:

RegisterHam(Ham_Spawn"player""SpawnHook"truetrue


Only for AMXX >= 1.9


All times are GMT -4. The time now is 21:48.

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