Skip to content
  • 0 Unread 0
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Collapse

Plutonium

  1. Home
  2. BO2 Modding Releases & Resources
  3. Zombie AFK command

Zombie AFK command

Scheduled Pinned Locked Moved BO2 Modding Releases & Resources
1 Posts 1 Posters 726 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.
  • ReuSundefined Offline
    ReuSundefined Offline
    ReuS
    wrote on last edited by
    #1

    Sharing my AFK command, inspired by THS.Shiniri command reworked it for my uses.

    Features

    • Paid AFK command ($10,000 per minute).
    • If the player moves, they are refunded for the remaining time, and AFK mode is canceled.
    cmd_afk(args){
        assert(string::to_lower(args[0]) == "!afk");
        if (args.size < 2){
            self tell("Usage: !afk <minutes>");
            return;
        }
        if (int(args[1]) < 0){
            self tell("You can't be afk for negative time");
            return;
        }
        if (!isNumeric(args[1])) {
            self tell("Invalid input! Please enter a valid number.");
            return;
        }
    
        if (int(args[1]) * 10000 > self.score){
            self tell("You don't have enough money to be afk for that long");
            return;
        }
        self.score -= int(args[1]) * 10000;
    
        seconds_to_be_afk = int(args[1]) * 60;
        if (seconds_to_be_afk > 1800) {
            self tell("You can't be afk for more than 30 minutes");
            return;
        }
        counter = 0;
        for (i = 3; i > 0; i--) {
            self tell("Going AFK in " + i + "...");
            wait 1;
        }
    	old_origin = self.origin;
    	old_angles = self getPlayerAngles();
    
        for(;;) {
            if (counter == 0) {
                self.ignoreme = 1; // Zombies wont find the player
                self enableInvulnerability(); // God mode is on
                say(self.name + " is ^1AFK for " + args[1] + " minute(s)");
            } else if (counter == seconds_to_be_afk) {
                self.ignoreme = 0;
                self disableInvulnerability();
                say (self.name + " is no longer AFK");
                break;
            } else if (seconds_to_be_afk - counter <= 10) {
                self tell("Time afk left: " + (seconds_to_be_afk - counter) + " seconds");
            } else if ((seconds_to_be_afk - counter) % 10 == 0) {
                self tell("Time afk left: " + (seconds_to_be_afk - counter) + " seconds");
            }
    
            // Check if the player has moved
            if (self.origin != old_origin || self getPlayerAngles() != old_angles) {
                remaining_seconds_afk = seconds_to_be_afk - counter;
                self.ignoreme = 0;
                self disableInvulnerability();
                self tell("You moved! AFK disabled. Refunding remaining time.");
                self.score += remaining_seconds_afk * 166;
                say (self.name + " is no longer AFK");
                break;
            }
            counter++;
            wait 1;
        }
    }
    
    isNumeric(str) {
        if (!isDefined(str) || str == "") {
            return false;
        }
    
        for (i = 0; i < str.size; i++) {
            if (str[i] < "0" || str[i] > "9") {
                return false;
            }
        }
        return true;
    }
    
    
    
    1 Reply Last reply
    0

    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
    • Unread 0
    • Recent
    • Tags
    • Popular
    • Users
    • Groups