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

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. "Failed to load custom script 'scripts/zm/xxx'"

"Failed to load custom script 'scripts/zm/xxx'"

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
3 Posts 3 Posters 419 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • dogmachineundefined Offline
    dogmachineundefined Offline
    dogmachine
    wrote on last edited by
    #1

    long story short, I have been working on getting another modder's GSC to compile (can't find the original author's post) and finally got it to compile. now, when I boot up my server, i get "Failed to load custom script":

    console.jpg

    other scripts load just fine. ive tried everything I can think of to no avail. ive been dealing with this shit on and off for two weeks and im really drawing a blank here. is it just me, or is trying to learn GSC the most painful coding experience imaginable? lmao. i cant even find another instance of someone getting this very generic error message.

    below is "my" code. sorry for the wall of code; didnt wanna leave anything out and i honestly dont understand github. i miss MATLAB more and more every day that i spend working on this shit.

    #include common_scripts\utility;
    #include maps\mp\_utility;
    
    init()
    {
        // configurable dvars
        level.bank_allow_banking = getDvarIntDefault("bank_allow_banking", 1);      // disable/enable banking (on by default)
        level.bank_allow_paying = getDvarIntDefault("bank_allow_paying", 1);        // disable/enable paying to other players. (on by default)
        level.bank_use_exclamation = getDvarIntDefault("bank_use_exclamation", 1);  // uses ! as prefix for commands. (on by default)
    
        // create bank folders/files
        level.bank_folder = va("%s/bank", getdvar("fs_homepath"));
        if (!directoryExists(level.bank_folder))
            createDirectory(level.bank_folder);
    
        // add callback to player chat
        onPlayerSay(::player_say);
    }
    
    errorMsg(msg) // used for error messaging
    {
        self tell(va("^1ERROR: ^7%s", msg));
    }
    
    getBankFileName() // confirm existance of bank accounts file for a particular player
    {
        guid = self getGuid();
        return level.bankFolder + "/" + guid;
    }
    
    
    bankWrite(value) // stuff for interating with the bank
    {
        name = self getBankFileName();
        writeFile(name, value);
    }
    
    bankRead()
    {
        name = self getBankFileName();
        if (!fileExists(name))
        {
            return 0;
        }
        return int64_op(readFile(name), "+", 0);
    }
    
    bankAdd(value)
    {
        current = self bankRead();
        self bankWrite(int64_op(current, "+", value));
    }
    
    bankSub(value)
    {
        current = self bankRead();
        self bankWrite(int64_op(current, "-", value));
    }
    
    bankRemove()
    {
        name = self getBankFileName();
        removeFile(name);
    }
    
    playerSay(message, mode)
    {
        
    	message = toLower(message);
        if (message[0] == ".")
        {
            
            if (level.intermission)
            {
                self errorMsg("The bank is inaccessible after the game ends.");
                return false;
            }
            args = strtok(message, " "); // creates new strings at the gaps in the command string (ie. ".p xyz 100" --> ".p" "xyz" "100")
            userCommand = getSubStr(args[0], 1); // userCommand is the first substring excluding the period (ie. ".withdraw" --> "withdraw")
    
            switch (userCommand) // checks the userCommand substring to see if it matches any case
            {
                case "deposit":
                case "d":
                {
                    if (is_false(level.bankAllowBanking)) // if the dvar = 0, error message is displayed
                    {
                        self errorMsg("Banking is not enabled on this server.");
                        return false;
                    }
    
                    self thread deposit(args); // attempt to deposit the requested amount
                    return false;
                }
                case "withdraw":
                case "w":
                {
                    if (is_false(level.bankAllowBanking)) // if the dvar = 0, error message is displayed
                    {
                        self errorMsg("Banking is not enabled on this server.");
                        return false;
                    }
                    
                    self thread withdraw(args); // attempt to withdraw the requested amount
                    return false;
                }
                case "balance":
                case "b":
                case "money":
                {
                    if (is_false(level.bankAllowBanking)) // if the dvar = 0, error message is displayed
                    {
                        self errorMsg("banking is not enabled on this server.");
                        return false;
                    }
    
                    self thread balance(); // show the user their balance
                    return false;
                }
                case "pay":
                case "p":
                {
                    if (is_false(level.bankAllowBanking)) // if the dvar = 0, error message is displayed
                    {
                        self errorMsg("banking is not enabled on this server.");
                        return false;
                    }
    
                    if (is_false(level.bankAllowPaying)) // if the dvar = 0, error message is displayed
                    {
                        self tell("paying is not enabled on this server.");
                        return false;
                    }
    
                    self thread pay(args);
                    return false;
                }
    
                default:
                {
                    return;
                }
            }
        }
    }
    
    deposit(args)
    {
        if (!isdefined(args[1])) // if the user does not give an "amount" argument, errorMsg
        {
            self errorMsg("usage: ^1/deposit ^7<amount|all>");
            return;
        }
    
        deposit = args[1]; // args[1] is the second substring, should include an integer value or keyword
    
        if (deposit == "all") // if instead of an integer value the user passes "all", deposit all of their money
        {
            depositInternal(self.score);
            return;
        }
    
        deposit = int(deposit); // by this point, we've determined that the second substring should be an integer
    
        if (int64_op(deposit, "<=", 0)) // is deposit negative?
        {
            self errorMsg("You cannot deposit negative amounts of money. Try the withdraw command...");
            return;
        }
    
        if (int64_op(deposit, ">", self.score)) // is the amount the user trying to deposit more than they have?
        {
            self errorMsg("You cannot deposit more money than you have.");
            return;
        }
    
        depositInternal(deposit); // if the request seems logical, deposit the money
    }
    
    depositInternal(money)
    {
        self bankAdd(money);
        self.score = self.score - money;
        self tell(va("you deposited ^2$%s^7 into the bank. Your balance reads ^2$%s ^7.", money, self bankRead()));
    }
    
    withdraw(args)
    {
        if (!isdefined(args[1])) // is the second substring undefined?
        {
            self errorMsg("usage: ^1/withdraw ^7<amount|all>");
            return;
        }
    
        withdraw = args[1]; // withdraw equals the second substring
    
        if (withdraw == "all")
        {
            withdraw = self bankRead(); // if the user passes "all", then they want to take all of the money out of their bank s.t. "all" = their balance
        }
    
        withdraw = int(withdraw); // convert the substring to an integer
    
        if (int64_op(withdraw, "<=", 0))
        {
            self errorMsg("You cannot withdraw negative amounts of money. Try the deposit command...");
            return;
        }
    
        newScore = int64_op(self.score, "+", withdraw); // see what happens if we add the user's withdraw amount to their current score
        if (int64_op(newScore, ">", 1000000)) // would this create a score of over one million? (bad)
        {
            value = 1000000 - self.score; // withdraw enough to reach one million points. if they already have one million, nothing happens
            if (value == 0)
            {
                self errorMsg("You have already reached the point limit (1,000,000)!");
            }
    
            withdrawInternal(value); // withdraw 1000000 - self.score (don't let the user cross one million points)
        }
        else
        {
            withdrawInternal(withdraw); // if the user's input doesn't make their score exceed 1000000, go for it
        }
    }
    
    withdrawInternal(money)
    {
        currentBal = self bankRead(); // create a var "currentBal" equal to what is recorded in the bankfolder for that guid
        if (int64_op(currentBal, "<", money)) // are they trying to pull more money out than they have?
        {
            self errorMsg("You cannot withdraw more money than you have. Check your balance!");
            return;
        }
    
        self bankSub(money); // take the money out of their bank
        currentBal = self bankRead(); // redefine currentBal to their updated bank balance
        self tell(va("You withdrew ^2$%s ^7from your bank account, leaving you with ^2$%s ^7.", money, currentBal));
    
        if (int64_op(currentBal, "==", 0))
        {
            self bankRemove(); // if they take all of their money out, delete their bank file
        }
    
        self.score += money; // add the withdrawn amout to their score
    }
    
    pay(args)
    {
        if (!isdefined(args[1])) // does the "player" arg exist?
        {
            self errorMsg("usage: ^1/pay ^7<player> <amount>");
            return;
        }
    
        if (!isdefined(args[2])) // does the "amount" arg exist?
        {
            self errorMsg("usage: ^1/pay ^7<player> <amount>");
            return;
        }
    
        targetPlayer = args[1]; // the target player is equal to the second substring
    
        foreach (p in level.players) 
        {
            playerName = tolower(get_player_name(p));
            if (issubstr(playerName, targetPlayer)) // is args[2] shorthand for someone's name? ie. yellow instead of yellowbob03
                player = p;
        }
    
        if (!isdefined(player))
        {
            self errorMsg(va("Unable to find player with name ^1%s^7", targetPlayer)); // if we can't find a name like args[1], give up
            return;
        }
    
        amount = int(args[2]); // args[2] corresponds to how much we wanna pay args[1]
    
        if (int64_op(amount, "<=", 0)) // is args[2] negative?
        {
            self errorMsg("You cannot pay an amount less than zero.");
            return;
        }
    
        if (int64_op(amount, ">", self.score)) // is args[2] greater than the amount of points we have on hand?
        {
            self errorMsg("you cannot pay more money than you have.");
            return;
        }
    
        self.score -= amount; // take args[2] from the paying player
        player.score += amount; // add args[2] to the recieving player
    
        self tell(va("You paid ^2$%s ^7to %s.", amount, player.name)); // success message
        player tell(va("%s ^7paid you ^2$%s^7!", self.name, amount)); // success message
    }
    
    balance()
    {
        balance = self bankRead();
        self tell(va("Balance: ^2$%s", balance));
    }
    
    MIDO-FLEXundefined JezuzLizardundefined 2 Replies Last reply
    0
    • MIDO-FLEXundefined Offline
      MIDO-FLEXundefined Offline
      MIDO-FLEX
      replied to dogmachine on last edited by
      #2
      This post is deleted!
      1 Reply Last reply
      0
      • JezuzLizardundefined Offline
        JezuzLizardundefined Offline
        JezuzLizard Plutonium Staff
        replied to dogmachine on last edited by
        #3

        dogmachine That error message only occurs if the script wasn't compiled. Verify that you are putting the compiled script in the scripts\zm\ folder.

        1 Reply Last reply
        0

        • Login

        • Don't have an account? Register

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