AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   respawn for bots (https://forums.alliedmods.net/showthread.php?t=190001)

striker07 07-13-2012 14:04

respawn for bots
 
I made this, it works perfect on real players but bots don't respawn,
why? how can i add bots to respawn to?

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#define PLUGIN "T-AutoSpawn"
#define VERSION "1.0"
#define AUTHOR "Sky-High"
new Pcvar_RespawnTime;
public 
plugin_init() {
 
register_plugin(PLUGINVERSIONAUTHOR)
 
 
RegisterHam(Ham_Killed"player""Fwd_PlayerKilled");
 
 
Pcvar_RespawnTime register_cvar"osg_respawn_time""5.0" );
}
 
public 
Fwd_PlayerKilled(victimattackershouldgib)
{
 new 
FloatTime;
 static 
CsTeams:team;
 
team cs_get_user_team(victim);
 
Time get_pcvar_floatPcvar_RespawnTime );
 
 if (
team == CS_TEAM_T)
 {
  
set_taskTime"Task_Respawn"victim);
 }
}
 
public 
Task_Respawn(id)
{
 
ExecuteHamB(Ham_CS_RoundRespawnid);



ConnorMcLeod 07-13-2012 14:44

Re: respawn for bots
 
If you are using cz bots, install this : http://forums.alliedmods.net/showthr...83#post1715483

And add in your plugin :

PHP Code:

public cz_bot_ham_registerableid )
{
  
RegisterHamFromEntity(Ham_Killedid"Fwd_PlayerKilled")



striker07 07-13-2012 18:38

Re: respawn for bots
 
Quote:

Originally Posted by ConnorMcLeod (Post 1749674)
If you are using cz bots, install this : http://forums.alliedmods.net/showthr...83#post1715483
[/php]

Install on my server you mean or make an include of it?

striker07 07-14-2012 16:02

Re: respawn for bots
 
Ok, I compiled that plugin and installed it on my server, then i added the public to my plugin an compiled but bots still don't respawn.

should i merge the 2 plugins into 1? (my t autospawn and your plugin?

Edit: I did that too and still the bots don't get respawned its werid there are maps where they do respawn and on other maps they don't

ConnorMcLeod 07-15-2012 07:26

Re: respawn for bots
 
Gonna try, may be IsBot doesn't return what it should.

You don't need to merge anything, the other plugin is made so you can use the forward in any plugin.


Edit :

Following code is working on windows, tell me if it works on linux.

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define VERSION "2.1.2"

new g_iFwdSetClientKeyValue

public plugin_init()
{
    
register_plugin("Ham Register Cz Bots"VERSION"ConnorMcLeod")
}

public 
client_putinserverid )
{
    if( 
is_user_bot(id) )
    {
        if( !
g_iFwdSetClientKeyValue )
        {
            
g_iFwdSetClientKeyValue register_forward(FM_SetClientKeyValue"SetClientKeyValue")
        }
    }
}

public 
SetClientKeyValue(idinfobuffer[], key[], value[])
{
    if( 
value[0] == '1' && equal(key"*bot") )
    {
        
unregister_forward(FM_SetClientKeyValueg_iFwdSetClientKeyValue)
        if( 
IsCzBotid ) )
        {
            new 
iForward CreateMultiForward("cz_bot_ham_registerable"ET_IGNOREFP_CELL)
            new 
iRet
            ExecuteForward
(iForwardiRetid)
            
DestroyForward(iForward)
            
pause("ac")
        }
    }
}

IsCzBotid )
{
#if defined Ham_CS_Player_IsBot
    
static valid = -1
    
if( valid == -)
    {
        
valid IsHamValidHam_CS_Player_IsBot )
    }
    if( 
valid )
    {
        return 
ExecuteHam(Ham_CS_Player_IsBotid)
    }
    return 
ExecuteHam(Ham_Weapon_ExtractClipAmmoid0)
#else
    
return ExecuteHam(Ham_Weapon_ExtractClipAmmoid0)
#endif



striker07 07-15-2012 12:19

Re: respawn for bots
 
aaah nice,
thank you very much connor this one works for me :)

so what exactly does this plugin do?
does it make sure that any type of bots are registered too in all events like a real player?

striker07 07-16-2012 17:51

Re: respawn for bots
 
Hey connor I have another issue that i cant seem to fix, wich i am sure of u can :)

ok so all my terrorist players are bots, (+-14 bots) and when the round ends all ters die due to the plugin force_round_end (its a plugin i can't miss so i can't just delete it). so when all terrorists die a task is set in my plugin to respawn them and there is the problem when the round ended the bots will automaticly spawn and therefore don't need to respawn again so i tryed to remove the task but without succes.

Now my server crashes everytime all terrorists die.

this is what I have done but it doesnt work, could you take a look at it pls?
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta> 
#include <hamsandwich>
#include <cstrike>
#define PLUGIN "T-AutoSpawn"
#define VERSION "1.0"
#define AUTHOR "Sky-High"
#define TASK_REVIVE 1000
new Pcvar_RespawnTime;
public 
plugin_init() {
 
register_plugin(PLUGINVERSIONAUTHOR)
 
 
//RegisterHam(Ham_Killed, "player", "Fwd_PlayerKilled");
 
 
Pcvar_RespawnTime register_cvar"osg_respawn_time""5.0" );
 
 
register_logevent("EventRoundEnd"2"1&Restart_Round");
 
register_logevent("EventRoundEnd"2"1=Game_Commencing");
 
register_logevent("EventRoundEnd"2"1=Round_End");
}
public 
cz_bot_ham_registerableid 

 
RegisterHamFromEntity(Ham_Killedid"Fwd_PlayerKilled"

public 
EventRoundEnd()
{
 static 
iPlayers[32], iNumidiPlayer;
 
get_playersiPlayersiNum"e""T" ); 
 for ( 
id=0id<iNumid++ )
 {
  
iPlayer iPlayers[id];
  
remove_task(TASK_REVIVE+iPlayer)
 }
}
public 
client_authorized (id)
{
 
set_task(4.5"Ad"id);
 
set_task400.0"Ad"id__"b" );
}
public 
Fwd_PlayerKilled(victimattackershouldgib)
{
 new 
FloatTime;
 static 
CsTeams:team;
 
team cs_get_user_team(victim);
 
Time get_pcvar_floatPcvar_RespawnTime );
 
 if (
team == CS_TEAM_T)
 {
  
set_taskTime"Task_Respawn"TASK_REVIVE+victim);
 }
}
 
public 
Task_Respawn(id)
{
 
ExecuteHamB(Ham_CS_RoundRespawnid);


Code:

L 07/17/2012 - 00:27:33: [HAMSANDWICH] Entity has null private data (1005)
L 07/17/2012 - 00:27:33: [AMXX] Run time error 10 (plugin "t_autospawn.amxx") (native "ExecuteHamB") - debug not enabled!
L 07/17/2012 - 00:27:33: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 07/17/2012 - 00:31:05: FATAL ERROR (shutting down): SZ_GetSpace: overflow without FSB_ALLOWOVERFLOW set on Server Datagram
FATAL ERROR (shutting down): SZ_GetSpace: overflow without FSB_ALLOWOVERFLOW set on Server Datagram
Add "-debug" to the ./hlds_run command line to generate a debug.log to help with solving this problem

CS-A-Roland 07-17-2012 09:38

Re: respawn for bots
 
Hey striker, ive an idea for you!
The Bots spawn on the CSDM perfect so visit there the csdm_spawn_preset.sma and the spawn_editor.sma
If you catch the funktions i think you can make it like CSDM and write coordinates for every map to spawn the players/bots...

But if it needed dont forget to add the module of csdm...
You know ive not the knowledge, but there i think you can find some parts wich could help you out...

striker07 07-17-2012 10:44

Re: respawn for bots
 
yes that maybe true but i already have everything i need (spawns, waypoints etc) I don't want to add a new csdm plugin replacing mine, you have a point on openeing the .sma's but my respawn plugin was working perfectly before, so when i updated it with the remove task then the problems came, the bots didnt even respawn so it's got to be with the id of the task and i don't know what i did wrong, i've been searching through many plugins but i can't find any problem i coded the tasks like they should and still they fail to work :s:(

ConnorMcLeod 07-24-2012 06:15

Re: respawn for bots
 
I have edited the code a bit but i don't think it was bad.


All times are GMT -4. The time now is 15:19.

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