Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. BO2 Modding Releases & Resources
  3. [Release] [MP] Anti Hardscope code snippet

[Release] [MP] Anti Hardscope code snippet

Scheduled Pinned Locked Moved BO2 Modding Releases & Resources
2 Posts 2 Posters 461 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mikzyundefined Offline
    mikzyundefined Offline
    mikzy
    Banned
    wrote on last edited by mikzy
    #1

    did this earlier for a friend so might as well share here

    call this once on player (I do mine onplayerspawned):

    self thread monitorads();
    

    then put this somewhere in your code:

    monitorads()
    {
    	self endon("disconnect");
    	level endon("game_ended");
    
    	adstime = 0;
    
    	for(;;)
    	{
    		if (self playerAds() == 1) {
    			adstime++;
    		} else if (self playerAds() == 0 && adstime != 0) {
    			adstime = 0;
    		}
    
    		// to change time, do (second divided by 0.05)
    		// ex: 0.5 seconds divided by 0.05 = 10
    		if (adstime == 10)
    		{
    			adstime = 0;
    			self allowads(false);
    			while (self playerAds() != 0) {
    				wait 0.05;
    			}
    			self allowads(true);
    		}
    		wait 0.05;
    	}
    }
    
    Pistakillaundefined 1 Reply Last reply
    3
    • mikzyundefined mikzy

      did this earlier for a friend so might as well share here

      call this once on player (I do mine onplayerspawned):

      self thread monitorads();
      

      then put this somewhere in your code:

      monitorads()
      {
      	self endon("disconnect");
      	level endon("game_ended");
      
      	adstime = 0;
      
      	for(;;)
      	{
      		if (self playerAds() == 1) {
      			adstime++;
      		} else if (self playerAds() == 0 && adstime != 0) {
      			adstime = 0;
      		}
      
      		// to change time, do (second divided by 0.05)
      		// ex: 0.5 seconds divided by 0.05 = 10
      		if (adstime == 10)
      		{
      			adstime = 0;
      			self allowads(false);
      			while (self playerAds() != 0) {
      				wait 0.05;
      			}
      			self allowads(true);
      		}
      		wait 0.05;
      	}
      }
      
      Pistakillaundefined Offline
      Pistakillaundefined Offline
      Pistakilla
      wrote on last edited by
      #2

      mikey Nice release dude!

      1 Reply Last reply
      1
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Donate