Raised This Month: $319 Target: $400
 79%   Almost there!

ham_spawn not works for yapb bot


Post New Thread Reply   
 
Thread Tools Display Modes
WATCH_DOGS UNITED
Member
Join Date: Nov 2020
Location: [ MATRIX ]
Old 09-23-2021 , 21:45   Re: ham_spawn not works for yapb bot
Reply With Quote #11

Quote:
Originally Posted by HamletEagle View Post
Here
PHP Code:
#include <amxmodx>
#include <hamsandwich>

new bool:registeredHamForBots

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


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.

THANKS.
__________________
Copyright 2020-2021, WATCH_DOGS UNITED All Rights Reversed
WATCH_DOGS UNITED is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-24-2021 , 02:39   Re: ham_spawn not works for yapb bot
Reply With Quote #12

Just noticed I forgot to hook as post. You should add ",1" to RegisterHam. I also fixed the code so you can just copy/paste.
__________________

Last edited by HamletEagle; 09-24-2021 at 02:40.
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 05:33.


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