[Resources] BO2 Trickshot Codes {Last Update: 24/05/2020}

Topic created ยท 12 Posts ยท 972 Views
  • In this post i'll realease all mine code
    Is possibile to finde al mine code on github
    Link: https://github.com/DoktorSAS/BO2-GSC

    Animated Welcome
    Developer: DoktorSAS
    Link: https://github.com/DoktorSAS/BO2-GSC/blob/master/AllKindOfWelcome.c
    Description: I made a few functions to make animated welcome messages, all information about the code are inside the code, for any problems write a post under this.

    
    onPlayerSpawned(){
    
    	self endon("disconnect");
    
    	level endon("game_ended");
    
    	self waittill("spawned_player");
    
    	self iprintln("Welcome To *ServerName*\nSecond Line\nThird Line");
    
    	self iprintlnbold("Welcome To *ServerName*\nSecond Line\nThird Line");
    
    	WelcomeMessage("Welcome To *ServerName*\n Second Line");
    
            self thread AnimatedTextCUSTOMPOS("Welcome To *ServerName*", <insertXpos>, <insertYpos>);
    
    	self thread AnimatedTextTOP("Welcome To *ServerName*");
    
    	self thread AnimatedTextCENTER("Welcome To *ServerName*");
    
    	self thread AnimatedTextBOTTOM("Welcome To *ServerName*");
    
            self thread AnimatedTextCUSTOMPOSScrolling("Welcome To *ServerName*", <insertYpos>);
    
    	self thread AnimatedTextTOPScrolling("Welcome To *ServerName*");
    
    	self thread AnimatedTextCENTERScrolling("Welcome To *ServerName*");
    
    	self thread AnimatedTextBOTTOMScrolling("Welcome To *ServerName*");
    
    	for(;;){
    
    		self waittill("spawned_player");
    
    		/*Put There if u need something there*/
    
    	}
    
    }
    
    WelcomeMessage(line1, line2, icon, glow){
    
    	hmb=spawnstruct();
    
    	hmb.titleText=line1;
    
    	hmb.notifyText=line2;
    
    	hmb.iconName=icon;
    
    	hmb.glowColor=glow;
    
    	hmb.hideWhenInMenu=true;
    
    	hmb.archived=false;
    
    	self thread maps\mp\gametypes\_hud_message::notifyMessage(hmb);
    
    }
    
    AnimatedTextCUSTOMPOS(text, x, y){ //Made by DoktorSAS
    
    	textSubStr = getSubStr(text,0,text.size);
    
    	result = "";
    
    	self.welcome = self createFontString("objective",2);
    
    	self.welcome setPoint("CENTER","CENTER",x, y);
    
    	self.welcome setText("");	
    
    	for(i=0;i<textSubStr.size;i++){
    
    		result = result + textSubStr[i];
    
    		self.welcome setText(result);
    
    		wait 0.5;
    
    	}
    
    	self.welcome setText("");
    
    }
    
    AnimatedTextTOP(text){ //Made by DoktorSAS
    
    	textSubStr = getSubStr(text,0,text.size);
    
    	result = "";
    
    	self.welcome = self createFontString("objective",2);
    
    	self.welcome setPoint("CENTER","CENTER",0,-200);
    
    	self.welcome setText("");	
    
    	for(i=0;i<textSubStr.size;i++){
    
    		result = result + textSubStr[i];
    
    		self.welcome setText(result);
    
    		wait 0.5;
    
    	}
    
    	self.welcome setText("");
    
    }
    
    AnimatedTextCENTER(text){ //Made by DoktorSAS
    
    	textSubStr = getSubStr(text,0,text.size);
    
    	result = "";
    
    	self.welcome = self createFontString("objective",2);
    
    	self.welcome setPoint("CENTER","CENTER",0,0);
    
    	self.welcome setText("");	
    
    	for(i=0;i<textSubStr.size;i++){
    
    		result = result + textSubStr[i];
    
    		self.welcome setText(result);
    
    		wait 0.5;
    
    	}
    
    	self.welcome setText("");
    
    }
    
    AnimatedTextBOTTOM(text){ //Made by DoktorSAS
    
    	textSubStr = getSubStr(text,0,text.size);
    
    	result = "";
    
    	self.welcome = self createFontString("objective",2);
    
    	self.welcome setPoint("CENTER","CENTER",0,200);
    
    	self.welcome setText("");	
    
    	for(i=0;i<textSubStr.size;i++){
    
    		result = result + textSubStr[i];
    
    		self.welcome setText(result);
    
    		wait 0.5;
    
    	}
    
    	self.welcome setText("");
    
    }
    
    AnimatedTextCUSTOMPOSScrolling(text, y){ //Made by DoktorSAS
    
    	self.welcome = self createFontString("objective",2);
    
    	self.welcome setPoint("CENTER","CENTER",-600,y);
    
    	self.welcome setText("");	
    
    	for(pos=-600;pos<=600;pos = pos + 3){
    
    		self.welcome setPoint("CENTER","CENTER",pos,y);
    
    		self.welcome setText(text);
    
    		wait 0.02;
    
    	}
    
    	self.welcome setText("");
    
    }
    
    AnimatedTextTOPScrolling(text){ //Made by DoktorSAS
    
    	self.welcome = self createFontString("objective",2);
    
    	self.welcome setPoint("CENTER","CENTER",-600,-200);
    
    	self.welcome setText("");	
    
    	for(pos=-600;pos<=600;pos = pos + 3){
    
    		self.welcome setPoint("CENTER","CENTER",pos,-200);
    
    		self.welcome setText(text);
    
    		wait 0.02;
    
    	}
    
    	self.welcome setText("");
    
    }
    
    AnimatedTextCENTERScrolling(text){ //Made by DoktorSAS
    
    	self.welcome = self createFontString("objective",2);
    
    	self.welcome setPoint("CENTER","CENTER",-600,0);
    
    	self.welcome setText("");	
    
    	for(pos=-600;pos<=600;pos = pos + 3){
    
    		self.welcome setPoint("CENTER","CENTER",pos,0);
    
    		self.welcome setText(text);
    
    		wait 0.02;
    
    	}
    
    	self.welcome setText("");
    
    }
    
    AnimatedTextBOTTOMScrolling(text){ //Made by DoktorSAS
    
    	self.welcome = self createFontString("objective",2);
    
    	self.welcome setPoint("CENTER","CENTER",-600,200);
    
    	self.welcome setText("");	
    
    	for(pos=-600;pos<=600;pos = pos + 3){
    
    		self.welcome setPoint("CENTER","CENTER",pos,0);
    
    		self.welcome setText(text);
    
    		wait 0.02;
    
    	}
    
    	self.welcome setText("");
    
    }
    
    

    Bots If Empty
    Developer: DoktorSAS
    Link: https://github.com/DoktorSAS/BO2-GSC/blob/master/Trickshot/botsifempty.c
    Description: This code spawn max 8 bots when there less then 4 players in, the bot respawn only when player connect, is a simple code ready to use for all.

    botsifempty(){ //Made by DoktorSAS
    
    	level endon("game_ended");
    
    	level waittill("connected", player);
    
    	wait 1;
    
    	cont = 0;
    
    	contB = 0;
    
    	foreach(p in level.players){
    
    		if(isDefined(p.pers["isBot"]) && p.pers["isBot"]){	
    
    			contB++;
    
    		}else{
    
    			cont++;
    
    		}
    
    	}
    
    
    	if(cont < 5 && contB < 8){
    
    		if(cont == 1 && contB == 0){
    
    			player addBots( 7 );
    
    		}else player addBots( (contB-cont) );
    
    	}
    
    	while(!level.gameended){
    		cont = 0;
    		contB = 0;
    		level waittill("connected", player);
    		foreach(p in level.players){
    			if(isDefined(p.pers["isBot"]) && p.pers["isBot"]){	
    				contB++;
    			}else
    				cont++;
    		}
    		 if(cont > 5 && contB > 0){
    				player kickBots( 1 );
    		}else if(cont <= 12 && contB < 8)
    			player addBots(7-contB);
    	}
    }
    
    kickBots( num ){ //Made by DoktorSAS
    
    	i = level.players.size;
    
    	while(i > -1 && num > 0){
    
    		if(level.players[i].pers["isBot"]){
    
    		    kickSelf(level.players[i]);
    
    			num--;
    
    		}
    
    		i++;
    
    	}
    
    }
    
    kickSelf( p ){ //Made by DoktorSAS
    
    	kick(p getentitynumber(), "EXE_PLAYERKICKED");
    
    }
    
    addBots( num ){ //Made by DoktorSAS
    
    	while(num > -1){
    
    		self thread maps\mp\bots\_bot::spawn_bot("autoassign");
    
    		wait 1;
    
    		num--;
    
    	}
    
    }
    

    Floaters ON/OFF
    Developer: DoktorSAS
    Link: https://github.com/DoktorSAS/BO2-GSC/blob/master/Trickshot/FloatersON%26OFF.c
    Description: This code is not all mine, the floater code is not mine i foudn it online i only added a system to turn it of for a player, exemple if player dont like floater he can turn it of for him selff (tahts mean if he hit the killcam heve no floaters) using menu options or something else

    init(){ //Made by DoktorSAS
    
    	level thread Floaters(); //Remeber to add this line\
    
    }
    
    //Floater
    
    Floaters(){
    
    	level waittill("game_ended");
    
    	foreach(player in level.players){
    
                   if(isAlive(player) && !player isOnGround() && player.fon){
    
                    	player thread FloatDown();
    
                    }
    
            }
    
    }
    
    FloatDown(){
    
        z = 0;
    
        startingOrigin = self getOrigin();
    
        floaterPlatform = spawn("script_model", startingOrigin - (0, 0, 20));
    
        playerAngles = self getPlayerAngles();
    
        floaterPlatform.angles=(0, playerAngles[1] , 0);
    
        floaterPlatform setModel("collision_clip_32x32x10");
    
        for(;;){
    
            z++;
    
            floaterPlatform.origin=(startingOrigin - (0, 0, z*1 ));
    
            wait .01;
    
        }
    
    }
    
    //Floater ON/OFF
    
    floateronoff(){
    
    	if(self.fon == true){
    
    		self iprintln("Floater ^1OFF");
    
    		self.fon = false;
    
    	}else if(self.fon == false){
    
    		self iprintln("Floaters ^2ON");
    
    		self.fon = true;
    
    	}
    
    }
    

    Bots Can't win
    Developer: DoktorSAS
    Link: https://github.com/DoktorSAS/BO2-GSC/blob/master/botcantwin.h
    Description: This code don't remove weapon, but the bot can't reache the score limit, the can kill and get some points but when they reace scorelimit-1 the bot go back to 0

    onPlayerConnect()
    {
        for(;;){
            level waittill("connected", player);
    		/*Remeber to add this 2 Lines in onPlayerConnected function*/
            if(isDefined(player.pers["isBot"]) && player.pers["isBot"])
    			player thread botCantWin();
    		else	
           	player thread onPlayerSpawned();
        }
    }
    
    /*
    	This code don't remove weapon, but the bot can't reache the score limit, the can kill and 
    	get some points but when they reace scorelimit-1 the bot go back to 0
    */
    botCantWin(){ //Made By DoktorSAS
     	self endon("disconnect");
    	level endon("game_ended");
        for(;;)
        {
        	wait 0.25;
        	if(self.pers["pointstowin"] >= level.scorelimit - 1){
        		self.pointstowin = 0;
    			self.pers["pointstowin"] = self.pointstowin;
    			self.score = 0;
    			self.pers["score"] = self.score;
    			self.kills = 0;
    			self.deaths = 0;
    			self.headshots = 0;
    			self.pers["kills"] = self.kills;
    			self.pers["deaths"] = self.deaths;
    			self.pers["headshots"] = self.headshots;
        	}
        }
    }
    
  • Is it possible to get the bots to take away their weapons or make them stop shooting? ๐Ÿ•ถ

  • @Sorex ya we need something like that

  • @NOXSYS I added a system to remove bot score when they reach scorelimit - 1

  • @Sorex I found a solution to remove the weapons so that not a problem anymore ๐Ÿ˜„

  • This post is deleted!
  • @Sorex I tried to put it in the code and it keeps saying bad syntax on line (___) <------- it had different numbers each time.

  • @Zeid2005 There no error, i hope you are not Duui. On the codes there no syntax error, you make something wrong

  • @Sorex i want to use this code i just dont know where to put it i have more things to ask abt making a trick shoting server so just dm heatslash#6323 on discord please

  • How do i use the .c files on my server?

  • @yRxbbie you can't, you need to use the .gsc file, the .c is only to make the code colorfull. Because this codes are only codes and this codes can't work if tou don't add it in your mods

  • I'm trying to add just 2 bots for an SND server and it keeps making it 17 bots. is there anyway u can help me?

Log in to reply