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 701 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

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      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