Raised This Month: $12 Target: $400
 3% 

My Trainer [Quick Training]


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Gameplay       
radtwo
New Member
Join Date: Oct 2012
Old 10-24-2012 , 04:42   My Trainer [Quick Training]
Reply With Quote #1

Well, this is my very own Training plugin.
Its for people who are impatient to wait for bots to finish the game while they're dead.

Description
The round is made to end when all of the human players in the game are dead.
The winner of the round becomes the team with the most number of players alive.
The bots won't be killed after the bomb has been planted though.
Still, the normal rules of the game apply. Here is the script, please get this reviewed.

Usage
Enabled by default.
mytrainer_enable -- to enable
mytrainer_disable -- to disable
Enabling this while the player is dead will kill the remaining bots on the team.

Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxconst>

#define PLUGIN "My Trainer"
#define VERSION "1.0"
#define AUTHOR "SmG R3c0N"

new hplayersList[32]; //Array of Human Players
new bplayersList[32]; //Array of Bots
new hnumPlayersT; //Number of Human Players on Terrorist
new hAnumPlayersT; //Number of Alive Human Players on Terrorist
new hnumPlayersCT; //Number of Human Players on Counter Terrorist
new hAnumPlayersCT; //Number of Alive Human Players on Counter Terrorist
new bAnumPlayersT; //Number of Alive Bots on Terrorist
new bAnumPlayersCT; //Number of Alive Bots on Counter Terrorist
new bnumPlayers; //Number of Bots
new i;
new stat = 1; //Plugin switch
new planted = 0;//Bomb plant flag

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR);
	register_event("DeathMsg", "event_death", "a"); //When a player dies call upon event_death
	register_event("BombDrop", "bomb_planted", "a");//Check for bomb drop
	register_logevent("bomb_planted", 0, "2=Planted_The_Bomb");	
	register_logevent("reset_plant", 3, "2=Spawned_With_The_Bomb")
	register_concmd("mytrainer_enable","trainer_on",ADMIN_SLAY,"Enable trainer."); //Turn on trainer with console command, calls trainer_on
	register_concmd("mytrainer_disable","trainer_off",ADMIN_SLAY,"Disable trainer."); //Turn on trainer with console command, calls trainer_off
}

public event_death() { //On player death
	if(stat == 1){
		kill_ownteam();
		return PLUGIN_CONTINUE;
	}
	if(stat == 0)
		return PLUGIN_CONTINUE;
}

public trainer_on()
{
	client_print(0,print_chat,"myTrainer enabled!");
	stat = 1;
	kill_ownteam(); //Kill if player dead
}

public trainer_off()
{
	client_print(0,print_chat,"myTrainer disabled!");
	stat = 0;
}

public kill_ownteam(){
		check_players(); //Get player numbers
		if(hnumPlayersT > 0 && hAnumPlayersT == 0 && hAnumPlayersCT == 0 && planted == 0)
		//If human T players exist and no alive CT and T human players
		{
			kill_bots("TERRORIST");
		}
		else {
				if(hnumPlayersCT > 0 && hAnumPlayersCT == 0 && hAnumPlayersT == 0)
				//If human CT players exist and no alive CT and T human players
				{
					kill_bots("CT");
				}
		}
	
}

public kill_bots(bTeam[]) //kill all bots of a given team
{	
	get_players(bplayersList,bnumPlayers,"ade",bTeam);
	for(i=0;i<bnumPlayers;i++) //bot kill loop
	{
		user_kill(bplayersList[i],1);
	}
}

public check_players()
{
	get_players(hplayersList,hnumPlayersCT,"ce","CT");  //Get total number of CT human players
	get_players(hplayersList,hAnumPlayersCT,"cae","CT"); //Get total number of alive CT human players
	get_players(hplayersList,hnumPlayersT,"ce","TERRORIST"); //Get total number of T human players
	get_players(hplayersList,hAnumPlayersT,"cae","TERRORIST"); //Get total number of alive T human players
	get_players(bplayersList,bAnumPlayersT,"dae","TERRORIST"); //Get total number of alive CT bots
	get_players(bplayersList,bAnumPlayersCT,"dae","CT"); //Get total number of alive T bots
}

public bomb_planted()
{
	planted = 1; //Set bomb planted
}

public reset_plant()
{
	planted = 0; //Unset bomb planted
}
Tested and works. It'd be cool if some of us would try it out.
Suggestions and corrections are always welcome!
Attached Files
File Type: sma Get Plugin or Get Source (trainer.sma - 963 views - 3.1 KB)

Last edited by radtwo; 10-24-2012 at 10:46.
radtwo is offline
BLacking98
Veteran Member
Join Date: Oct 2012
Location: California
Old 12-08-2012 , 20:14   Re: My Trainer [Quick Training]
Reply With Quote #2

Quote:
Originally Posted by radtwo View Post
Well, this is my very own Training plugin.
Its for people who are impatient to wait for bots to finish the game while they're dead.
http://forums.alliedmods.net/showthread.php?p=808253
__________________
BLacking98 is offline
BLacking98
Veteran Member
Join Date: Oct 2012
Location: California
Old 12-08-2012 , 20:14   Re: My Trainer [Quick Training]
Reply With Quote #3

Yeah... and if you want those BOTS dead just type on the console bot_kill... WTF
__________________
BLacking98 is offline
BLacking98
Veteran Member
Join Date: Oct 2012
Location: California
Old 12-08-2012 , 20:15   Re: My Trainer [Quick Training]
Reply With Quote #4

Congratz on being your 1º plugin though
__________________
BLacking98 is offline
quilhos
Veteran Member
Join Date: Jun 2010
Old 12-08-2012 , 20:17   Re: My Trainer [Quick Training]
Reply With Quote #5

Use the edit button..
__________________
ELO RATING SYSTEM - SQL [COMPLETE]
Quote:
Originally Posted by Liverwiz View Post
DDDRRRRAAAAMMMMAAAAA!!!???

Put this shit on pause while i go get some popcorn!!
quilhos is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-07-2020 , 12:47   Re: My Trainer [Quick Training]
Reply With Quote #6

@HamletEagle, this is kind of useless.

Also this
PHP Code:
public check_players()
{
    
get_players(hplayersList,hnumPlayersCT,"ce","CT");  //Get total number of CT human players
    
get_players(hplayersList,hAnumPlayersCT,"cae","CT"); //Get total number of alive CT human players
    
get_players(hplayersList,hnumPlayersT,"ce","TERRORIST"); //Get total number of T human players
    
get_players(hplayersList,hAnumPlayersT,"cae","TERRORIST"); //Get total number of alive T human players
    
get_players(bplayersList,bAnumPlayersT,"dae","TERRORIST"); //Get total number of alive CT bots
    
get_players(bplayersList,bAnumPlayersCT,"dae","CT"); //Get total number of alive T bots

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-01-2021 , 07:56   Re: My Trainer [Quick Training]
Reply With Quote #7

This plugin has several issues that prevent it from being approved. If you want more information, please PM me.
__________________
HamletEagle is offline
Reply


Thread Tools
Display Modes

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 11:02.


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