AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Getting Bot you just spawned. (https://forums.alliedmods.net/showthread.php?t=216940)

Kia 05-27-2013 16:25

Getting Bot you just spawned.
 
Hello everybody,

I'd like to spawn a Pod-Bot and setting it's origin to somewhere else.
I'm using
PHP Code:

server_cmd("pb add %d %d %d %d"skillpersonalityteammodel

to spawn it, but how do I get the bot Id to use set_user_origin?
This would only work for the first bot :
PHP Code:

static id_bot
    
for( new 1<= g_MaxPlayersi++) 
    {
        if(
is_user_bot(i) && is_user_alive(i))
        {
            
id_bot i
        
}
    } 


jimaway 05-27-2013 17:05

Re: Getting Bot you just spawned.
 
save the bot id-s to a global variable and after spawning a bot loop trough players and find a bot thats not in the variable?

Kia 05-27-2013 17:20

Re: Getting Bot you just spawned.
 
Got this now
PHP Code:

public ham_playerspawn(id)
{
    if(
is_user_bot(id) && !g_bIsSpawnedBot[id])
    {
        
set_user_origin(idg_iNextSpawnPos)
        
g_bIsSpawnedBot[id] = true
    
}




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

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