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

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. AFK for Zombies

AFK for Zombies

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
1 Posts 1 Posters 689 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.
  • THS.Shiniriundefined Offline
    THS.Shiniriundefined Offline
    THS.Shiniri
    wrote on last edited by
    #1

    So the other Script by Nathan31973 is what I want but his do not work. While Sorex works.

    I tried mashing them together and yeah it kinda worked. The player is recognized AFK and as soon as he moves a few steps he is no longer afk.

    While AFK godmode & ignoreme is on.

    The Problem is they can shoot and still do not get hit by them. So I need a solution to disable the AFK = True status when a player melees shoots or aims.

    Current Code:

    init() // entry point
    {
        level thread onplayerconnect();
    }
    
    onplayerconnect()
    {
        for(;;)
        {
            level waittill("connected", player);
            player thread onplayerspawned();
    		player.clientid = level.clientid;
    		level.clientid++;
        }
    }
    
    onplayerspawned()
    {
    	level endon( "game_ended" );
    	self endon("disconnect");
    	self iprintlnbold("^2GSC loaded!");
    	old_origin = self.origin;
    	old_angles = self getPlayerAngles();
    	seconds_to_be_afk = 5; // Change this value to change wait time to be afk
    	counter = 0;
    	wait 5; // Wait time to turn on AFK Script
    	
    	for(;;)
    	{
    		old_origin = self.origin;
    		old_angles = self getPlayerAngles();
    		wait 1;
    		
    		if(distance(old_origin, self.origin) <= 1 && old_angles == self getPlayerAngles() && counter < seconds_to_be_afk)
    		{
    			counter++;
    		}
    		
    		else if(counter == seconds_to_be_afk)
    		{
    			self.ignoreme = 1; // Zombies wont find the player
    			self enableInvulnerability(); // God mode is on
        		self thread print_to_all( self.name + " is ^1AFK");
        		old_origin = self.origin;
        		old_angles = self getPlayerAngles();
    			
        		while(distance(old_origin, self.origin) <= 5 || old_angles != self getPlayerAngles())
    			{
        			old_angles = self getPlayerAngles();
        			wait 0.05;
        		}
    			
        		self.sessionstate = "playing";
        		counter = 0;
    		}
    		
    		else if(counter < seconds_to_be_afk)
    		{
    		self.ignoreme = 0; // Zombies will find the player again
    		self disableInvulnerability(); // God mode is off
    		}
    		
    		else if(counter > seconds_to_be_afk)
    		{
    			counter = 0;
    		}
    	}
    }
    
    endgame_fix(){
    	self endon("disconnect");
        level endon("end_game");
        level waittill("connected", player);
        for(;;){
        	wait 1;
        	counter = 0;
        	foreach(player in level.players){
        		if(player.sessionstate == "spectator" || !isAlive(player))
        			counter++;
        	}
        	if(counter == level.players.size)
        		level notify("end_game");
        }
    }
    print_to_all( msg ){
    	foreach( player in level.players)
    		player iprintln( msg );
    }
    
    1 Reply Last reply
    0
    • ReuSundefined ReuS referenced this topic on

    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