This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Z-bot Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lantz69
AMX Mod X Beta Tester
Join Date: Mar 2004
Location: Sweden, Skåne
Old 08-19-2005 , 14:09   Z-bot Plugin
Reply With Quote #1

I did this small plugin for a server that has bots but when 6 real player has joined the bots will be gone.

Just wanna know if I have done something wrong with the code.
The reason I ask is that somtimes the roundtimer dissappears and sometimes when T has planted CT winns anyway.
I think this started after i installed this plugin.

Here is the code:
Code:
#include <amxmodx> //#define BOT_CHECK_FREQ 10 new const ZBOT_LIMITER_VERSION[] = "0.1" public plugin_init(){     register_plugin("Zbot Limiter",ZBOT_LIMITER_VERSION,"lantz69")     register_cvar("Zbot Limiter",ZBOT_LIMITER_VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)     register_cvar("bot_min_players", "6") // Amount of players before zbots should be kicked                           // So if the server gets 7 players 1 bot will be kicked or borquota will be 5                           // That makes the server to always have atleast 6 players in the server     //set_task(float(BOT_CHECK_FREQ),"checkBots",_,_,_,"b")     return PLUGIN_CONTINUE } public client_putinserver() {     //checkBots()     set_task(3.0,"checkBots")     return PLUGIN_CONTINUE } public client_disconnect() {     set_task(3.0,"checkBots")     return PLUGIN_CONTINUE } public checkBots() {     new playernum, bot_quota, new_quota, min_players     playernum = get_playersnum()     min_players = get_cvar_num("bot_min_players")     bot_quota = get_cvar_num("bot_quota")     new_quota = bot_quota - playernum + min_players     if( new_quota != bot_quota && new_quota > -1) {         if( new_quota < 0 ){             set_cvar_num("bot_quota",0)             //log_amx("[DEBUG]: bot_quota is now %i",new_quota)         }else{             set_cvar_num("bot_quota",new_quota)             //log_amx("[DEBUG]: bot_quota is now %i",new_quota)         }     }     return PLUGIN_CONTINUE }

Thankful for answers.
__________________
Using: Amxmodx 1.8.1.xxxx, cstrike
http://www.vanilla.se/
lantz69 is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 08-19-2005 , 14:54  
Reply With Quote #2

I know when T's planted the bomb the round timer goes away. ie if you plant the bomb almost at end of round the timer disappear. So it allows the c4 timer still be able to go off if they can protect it.

Does it not come back after it disappears at new round?
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 08-19-2005 , 15:01   Re: Z-bot Plugin
Reply With Quote #3

Code:
public checkBots() {     new playernum, bot_quota, new_quota, min_players     playernum = get_playersnum()     min_players = get_cvar_num("bot_min_players")     bot_quota = get_cvar_num("bot_quota")     new_quota = bot_quota - playernum + min_players     if( new_quota != bot_quota && new_quota > -1) {         if( new_quota < 0 ){   //The following line would never get executed.    //Quote: && new_quota > -1 ) {      //Quote: if( new_quota < 0 ){     //So basically your saying new_quota has to me 0 or greater, then you see if its -1 or less. Impossible to execute.   //Tryin useing new_quota <= 0             set_cvar_num("bot_quota",0)             //log_amx("[DEBUG]: bot_quota is now %i",new_quota)         }else{             set_cvar_num("bot_quota",new_quota)             //log_amx("[DEBUG]: bot_quota is now %i",new_quota)         }     }     return PLUGIN_CONTINUE }
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
lantz69
AMX Mod X Beta Tester
Join Date: Mar 2004
Location: Sweden, Skåne
Old 08-19-2005 , 15:32  
Reply With Quote #4

Quote:
Originally Posted by teame06
I know when T's planted the bomb the round timer goes away. ie if you plant the bomb almost at end of round the timer disappear. So it allows the c4 timer still be able to go off if they can protect it.

Does it not come back after it disappears at new round?
It seems like the timer just dissapears whenever it feels like.
I know that the timer should go away if the T plants before the round time has ended.
__________________
Using: Amxmodx 1.8.1.xxxx, cstrike
http://www.vanilla.se/
lantz69 is offline
lantz69
AMX Mod X Beta Tester
Join Date: Mar 2004
Location: Sweden, Skåne
Old 08-19-2005 , 15:43  
Reply With Quote #5

@Suicide
Yeah you are absolutely right

I change it to
Code:
if( new_quota < 1 ){
instead

I recently put the extra
&& new_quota > -1
So the set_cvar_num wouldn't get set to often if the value was negative.

Thx for the help about that.

Another question
Is there anything wrong with where I have placed
return PLUGIN_CONTINUE

I know sometimes it can make a plugin do strange things
And maybe I dont need return PLUGIN_CONTINUE in plugin_init() either.
__________________
Using: Amxmodx 1.8.1.xxxx, cstrike
http://www.vanilla.se/
lantz69 is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 08-19-2005 , 17:14  
Reply With Quote #6

return PLUGIN_CONTINUE does not do strange things.
It tells the plugin to keep going.

return PLUGIN_HANDLED does strange things.
It tells the plugin to stop.

It doesn't matter if you have PLUGIN_CONTINUE in plugin_init, plugin_init will ignore it.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Reply



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 12:44.


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