AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help on plugin (https://forums.alliedmods.net/showthread.php?t=61451)

Reaper2331 09-30-2007 18:20

Help on plugin
 
im trying to make a plugin that on CS:CZ it adds bots when there are 0 players and takes them away when players enter

would this work

PHP Code:

/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Author"
new p_botnumber
public plugin_init() {
 
register_plugin(PLUGINVERSIONAUTHOR)
 
p_botnumber register_cvar"amx_botnubmer""6" );
 
}
public 
check_playernumber()
{
 if(!
get_playersnum 0)
  
server_cmd("bot_quota %s"p_botnumber)
{
 else
 {
  if(!
get_playersnum()==0)
   
server_cmd("bot_quota 0")
  } 


YamiKaitou 09-30-2007 18:22

Re: Help on plugin
 
No, that won't work. Mainly because where are you calling check_playernumber?

Reaper2331 09-30-2007 18:25

Re: Help on plugin
 
i dont know lol i was just messing with some code, i was just trying to make this, im still not all that good at scripting

Can you help me?

ConnorMcLeod 09-30-2007 20:49

Re: Help on plugin
 
Try this :
Code:
#include <amxmodx> #define PLUGIN "New Plugin" #define VERSION "1.0" #define AUTHOR "Author" new cvar_max_bots, cvar_bot_quota public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     cvar_max_bots = register_cvar("amx_botnubmer", "6")     cvar_bot_quota = get_cvar_pointer("bot_quota") } public client_connect(id)     if(!is_user_bot(id))         check_playernumber() public client_disconnect(id)     if(!is_user_bot(id))         check_playernumber() check_playernumber() {     new players[32], inum, maxbots = get_pcvar_num(cvar_max_bots)     get_players(players, inum, "c")     if( inum < maxbots )         set_pcvar_num(cvar_bot_quota, maxbots - inum)     else         set_pcvar_num(cvar_bot_quota, 0) }

Reaper2331 09-30-2007 21:02

Re: Help on plugin
 
thx but this only adds the bots it never removes them, i want something like when a player enters a bot leaves when 6 players enter 6 bots leave

potatis_invalido 10-01-2007 05:25

Re: Help on plugin
 
replace
set_pcvar_num(cvar_bot_quota, 0)
with
server_cmd("bot_kick")

Reaper2331 10-01-2007 20:00

Re: Help on plugin
 
not working still

i want it to Kick 1 bot when 1 player enters
2 bots when 2 players in server
3 bots when 3 players in server
and etc

ConnorMcLeod 10-01-2007 22:40

Re: Help on plugin
 
I've just edited the code, try it again :)

Reaper2331 10-01-2007 22:50

Re: Help on plugin
 
/home/groups/amxmodx/tmp3/phpiH86DV.sma(10) : error 037: invalid string (possibly non-terminated string)

1 Error.
Could not locate output file /home/groups/amxmodx/public_html/websc3/phpiH86DV.amx (compile failed).

ConnorMcLeod 10-01-2007 23:08

Re: Help on plugin
 
I've only renamed pointer 'max' to 'maxbots' so it should compiles fine, just don't know why you fail.


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

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