AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved/Old Plugins (https://forums.alliedmods.net/forumdisplay.php?f=27)
-   -   My Trainer [Quick Training] (https://forums.alliedmods.net/showthread.php?t=199096)

radtwo 10-24-2012 04:42

My Trainer [Quick Training]
 
1 Attachment(s)
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! :3 rukia

BLacking98 12-08-2012 20:14

Re: My Trainer [Quick Training]
 
Quote:

Originally Posted by radtwo (Post 1824651)
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 12-08-2012 20:14

Re: My Trainer [Quick Training]
 
Yeah... and if you want those BOTS dead just type on the console bot_kill... WTF

BLacking98 12-08-2012 20:15

Re: My Trainer [Quick Training]
 
Congratz on being your 1º plugin though

quilhos 12-08-2012 20:17

Re: My Trainer [Quick Training]
 
Use the edit button..

Napoleon_be 04-07-2020 12:47

Re: My Trainer [Quick Training]
 
@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



HamletEagle 09-01-2021 07:56

Re: My Trainer [Quick Training]
 
This plugin has several issues that prevent it from being approved. If you want more information, please PM me.


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

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