View Single Post
NEUCOUNTRA
Junior Member
Join Date: Jul 2021
Location: Ukraine, CITY8
Old 04-09-2022 , 04:08   Re: is_user_bot check problem
Reply With Quote #5

Quote:
Originally Posted by Moody92 View Post
Your bot function is not being called anywhere. You need to trigger it somehow, just like the commands you have for the non-bot users.

PHP Code:
public bot_check(id)
{
    if(
is_user_bot(id))
    {
        
console_print(id"bot")
    }
    
    if(
is_user_bot(id) && get_user_health(id) < maxhealth)
    {
        
give_health(id);
        
client_print(idprint_chat"Bot healed")
    }
    
    if(
is_user_bot(id) && get_user_armor(id) == 0)
    {
        
give_armor(id);
        
client_print(idprint_chat"Bot armored")
    } 
EDIT: You probably also need to modify the function, usually bots are unable to call a function by themselves so you probably need to loop through the bots / or find the id of the bot somehow if a player is healing them.

How it might look, yesterday I tried to create a check, if player is bot and then I called function, but it didn't work. How I can realise a trigger?

Also I tried to use set_task on client_putinserver(), it didn't work too.
NEUCOUNTRA is offline