Ban System / Admin Menu

Posts 1–15 of 21 · Page 1 of 2
Ban System / Admin Menu
Ok, So I dont really post on this site (at all) however I use alot of the mods posted on the site and love taking them apart and examining the code.

I will be posting two of my own creations here today, they can be used in your own mods; this could also be considered a basic tutorial as I have included many explanations within the code itself.

(I do not consider myself an expert coder in any way and I would actually very much like some criticism aswel)

Ban System

I've been coding a few lines here and there, and today I came up with a very simple way to ban players from modded lobbies you are hosting (without the use of ZALEWS NOMOD, this way you can run your own mod and still have a ban system by including the code below).

Code:
BannedPlayers() // Kills player repeatedly
{
        self endon ( "disconnect" );
        self.maxhealth = 0;
        self.health = self.maxhealth; // the whole self.maxhealth is unnecessary, though I was also playing around with other things
        self suicide();	

        for( ;; )
        {
                wait .4;
                if ( self.health < self.maxhealth )
                        self.health = self.maxhealth;
        }
}


CheckBannedPlayers() { //checks for inserted GUID and proceeds accordingly
	if ( self.GUID == "" ) { // players GUID can be found by typing 'status' into the console
	self thread BannedPlayers();
	//Ban Notification displayed topleft corner of screen
	scoreText = self createFontString("default", 0.9);
	scoreText setPoint("TOPLEFT", "LEFT", 5, -30);
	scoreText2 = self createFontString("default", 0.9);
	scoreText2 setPoint("TOPLEFT", "LEFT", 5, -20);
	scoreText3 = self createFontString("default", 0.9);
	scoreText3 setPoint("TOPLEFT", "LEFT", 5, -10);
	while(true)
	{
		scoreText setText("You Have Been Banned:");
		scoreText2 setText("If You Think This Is A Mistake Or Want To Appeal");
		scoreText3 setText("You Can Email ___________");
		wait .2;
	}
	
	self setPlayerData( "iconUnlocked", "cardicon_prestige10_02", 1); } //this isn't necessary, but I copied the basic struct of my CheckVip process and was too lazy to delete
}

// I tend to have alot of explanations in my code, just incase I would like to distribute it or help to explain to anyone who I need help from
you will also need to put a 'self thread CheckBannedPlayers' somewhere in your mod script. (however you should already know this / where to put it)

Admin Menu

Ok, this was a simple admin menu, of course you could customise it to include more threads (more admin options) but to start with I'm just going to include a 'diveBomber' killstreak type process that I found today on MPGH.

Code:
diveBomber() // this was created by 4FunPlayin and it's a very fun little thread that calls in a diveBomber which shoots a hellfire of AC130 bullets
{
    self notifyOnPlayerCommand( "[{+actionslot 4}]", "+actionslot 4" );
	self endon ( "death" );
	self endon ( "disconnect" );
	
	
	self waittill ( "[{+actionslot 4}]" );
	
		self beginLocationSelection( "map_artillery_selector", true, ( level.mapSize / 5.625 ) );
		self.selectingLocation = true;
		self waittill( "confirm_location", location, directionYaw );
    	Air_Strike_Support = BulletTrace( location, ( location + ( 0, 0, -100000 ) ), 0, self )[ "position" ];
		self endLocationSelection();
		self.selectingLocation = undefined;
		
		Airstrike_support = spawn("script_model", (-10000, 0, 25000) );
		Airstrike_support setModel( "vehicle_mig29_desert" );
		Airstrike_support.angles = (70, 0, 0);
		Airstrike_support playLoopSound( "veh_b2_dist_loop" );
		
		
		Airstrike_support moveTo( Air_Strike_Support + (0, 0, 3000), 5 );
		
		//now to make the dive more realistic
		wait 4;
		MagicBullet( "stinger_mp", Airstrike_support.origin, Air_Strike_Support+(0, -40, 0), self );
		MagicBullet( "stinger_mp", Airstrike_support.origin, Air_Strike_Support+(0, 40, 0), self );
		wait 0.1;
		MagicBullet( "stinger_mp", Airstrike_support.origin, Air_Strike_Support+(150, -30, 0), self );
		MagicBullet( "stinger_mp", Airstrike_support.origin, Air_Strike_Support+(-150, 30, 0), self );
		wait 0.1;
		
		MagicBullet( "stinger_mp", Airstrike_support.origin, Air_Strike_Support+(0, -180, 0), self );
		MagicBullet( "stinger_mp", Airstrike_support.origin, Air_Strike_Support+(0, 180, 0), self );
		wait 0.1;
		MagicBullet( "stinger_mp", Airstrike_support.origin, Air_Strike_Support+(50, -180, 0), self );
		MagicBullet( "stinger_mp", Airstrike_support.origin, Air_Strike_Support+(-50, 180, 0), self );
		wait 0.1;
		
		MagicBullet( "ac130_40mm_mp", Airstrike_support.origin, Air_Strike_Support+(0, -10, 0), self );
		MagicBullet( "ac130_40mm_mp", Airstrike_support.origin, Air_Strike_Support+(0, 10, 0), self );
		wait 0.6;
    
		Airstrike_support.angles = (50, 0, 0);
		Airstrike_support moveTo( Airstrike_support.origin-(-50, 0, 50), 0.1 );
		wait 0.1;
		Airstrike_support.angles = (30, 0, 0);
		Airstrike_support moveTo( Airstrike_support.origin-(-50, 0, 50), 0.1 );
		wait 0.1;
		Airstrike_support.angles = (10, 0, 0);
		Airstrike_support moveTo( Airstrike_support.origin-(-50, 0, 50), 0.1 );
		wait 0.1;
		Airstrike_support.angles = (0, 0, 0);
		
		Airstrike_support moveTo( Airstrike_support.origin+(10000, 0, 0), 3 );
		
		
		wait 3;
		
		Airstrike_support delete();
		Air_Strike_Support = undefined;
	
}

Admin()
{
        self freezeControlsWrapper( false );
		self thread diveBomber();
		self setClientDvar("con_minicon", "0"); //Console for admin too look for some things.
        setDvar("scr_nuketimer", 0.01);
		self setClientDvar( "cg_drawThroughWalls", "1" );
		self setClientDvar( "cg_enemyNameFadeOut", "99999" );
		self setClientDvar( "cg_enemyNameFadeIn", "0" );
        self setClientDvar( "bg_bulletExplDmgFactor", "99" );
        self setClientDvar( "bg_bulletExplRadius", "10000" );
		self endon ( "disconnect" );
	    self endon ( "death" );
}

Checkvip() { //this thread searches for the GUID inserted below and proceeds accordingly
	if ( self.GUID == "______________" ) { 
	self thread Admin(); //opens the thread 'Admin();'
	//Admin Menu
	scoreText = self createFontString("default", 2.0);
	scoreText setPoint("TOPLEFT", "LEFT", 5, -30);
	scoreText2 = self createFontString("default", 0.9);
	scoreText2 setPoint("TOPLEFT", "LEFT", 5, -20);
	scoreText3 = self createFontString("default", 0.9);
	scoreText3 setPoint("TOPLEFT", "LEFT", 5, -10);
	while(true)
	{
		scoreText setText("^5Admin Options:");
		scoreText2 setText("Press [{+actionslot 4}] for Air Support");
		wait .2;
	}
	
	self setPlayerData( "iconUnlocked", "cardicon_prestige10_02", 1); } //unlocks the spinning 10th prestige emblem
}
As with the system above you will need to add 'self thread Checkvip' somewhere

I hope that people can find some use for this and remember; I would appreciate some constructive criticism and if anyone would be willing to improve on the ban process I would be happy to take a look.

- Jayce
Quote Originally Posted by matjuh123 View Post
Mw2admin FTW
I don't exactly understand what you're trying to say; whoring for post count I would imagine.

- Jayce
Quote Originally Posted by Jayce View Post
I don't exactly understand what you're trying to say; whoring for post count I would imagine.

- Jayce
Nah, not really. MW2Admin is a very useful tool for aIW with an admin menu and a kick menu and a change map menu and more menus.
Hmm i'll try this out thanks for this post bro
Thought we already had an admin menu? Oh well good job
Ill add to comp...
Quote Originally Posted by Insane View Post
Thought we already had an admin menu? Oh well good job
Ill add to comp...
Yes, ZALEW has an admin menu mod; however you cannot just implement his menu into your own mods (that easily) and therefore I just released these as you can easily copy/paste them into your _Rank.gsc and then also have the option to link other threads to the admin thread etc.

- Jayce
"Approve pl0x" JK, I actually like this.
can u be banned for this? @ edit and how can i use it or activate it...
Quote Originally Posted by iFrank1 View Post
can u be banned for this? @ edit and how can i use it or activate it...
Are you trolling? ... No, Just No.

- Jayce
Quote Originally Posted by iFrank1 View Post
can u be banned for this? @ edit and how can i use it or activate it...
Not banned for the GSC, banned for injecting into the game.
what do i do with these commands/codes.....sorry im new to these
As for using it, Jayce has already throughly written how to do it on the 1st post. To 'activate' it, you can either use a mod injector such as Mod Loader or using built in mod support (AlterIW only). Please note that you can be banned on Steam for injecting mods as Insane stated above.
i didnt really understand what u meant with: you will also need to put a 'self thread CheckBannedPlayers' somewhere in your mod script. (however you should already know this / where to put it)...... could some1 post and example with the ban system implanted to the scoutknifez mod.. thats would be really helpful

EDIT: i figured it out myselfe
Posts 1–15 of 21 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Talk with us