Raised This Month: $32 Target: $400
 8% 

ham_spawn not works for yapb bot


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
karaulov
Senior Member
Join Date: Jul 2018
Old 02-16-2019 , 06:46   ham_spawn not works for yapb bot
Reply With Quote #1

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

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

Last edited by karaulov; 02-16-2019 at 06:51.
karaulov is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-16-2019 , 07:19   Re: ham_spawn not works for yapb bot
Reply With Quote #2

https://forums.alliedmods.net/showpo...1&postcount=12



Search..always before you post a question
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 02-16-2019 , 08:02   Re: ham_spawn not works for yapb bot
Reply With Quote #3

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
__________________









Last edited by CrazY.; 02-16-2019 at 10:04. Reason: typo
CrazY. is offline
karaulov
Senior Member
Join Date: Jul 2018
Old 02-16-2019 , 09:58   Re: ham_spawn not works for yapb bot
Reply With Quote #4

Quote:
Originally Posted by CrazY. View Post
Besides, latest amxmodx version already reigister Ham hooks on bots.
https://www.amxmodx.org/api/hamsandwich/RegisterHam
Not works with yapb bot
karaulov is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 02-16-2019 , 10:03   Re: ham_spawn not works for yapb bot
Reply With Quote #5

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).
__________________









Last edited by CrazY.; 02-16-2019 at 10:05.
CrazY. is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-16-2019 , 10:23   Re: ham_spawn not works for yapb bot
Reply With Quote #6

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.
__________________
HamletEagle is offline
WATCH_DOGS UNITED
BANNED
Join Date: Nov 2020
Old 09-16-2021 , 21:33   Re: ham_spawn not works for yapb bot
Reply With Quote #7

Quote:
Originally Posted by HamletEagle View Post
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?
WATCH_DOGS UNITED is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-18-2021 , 11:01   Re: ham_spawn not works for yapb bot
Reply With Quote #8

Quote:
Originally Posted by WATCH_DOGS UNITED View Post
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.
__________________

Last edited by HamletEagle; 09-24-2021 at 02:40.
HamletEagle is offline
wilian159
Member
Join Date: Dec 2013
Old 09-19-2021 , 23:25   Re: ham_spawn not works for yapb bot
Reply With Quote #9

use:

PHP Code:
RegisterHam(Ham_Spawn"player""SpawnHook"truetrue
__________________
wilian159 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-20-2021 , 11:20   Re: ham_spawn not works for yapb bot
Reply With Quote #10

Quote:
Originally Posted by wilian159 View Post
use:

PHP Code:
RegisterHam(Ham_Spawn"player""SpawnHook"truetrue
Only for AMXX >= 1.9
__________________
HamletEagle is offline
Reply


Thread Tools
Display Modes

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 20:34.


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