Freebie vendor script

Discussion in 'Scripting Library' started by VenumusVortex, Sep 15, 2016.

  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Please note:This forum is primarily intended for receiving help from other DigiWorldz users, and official support from the DigiWorldz team is not guaranteed here. If you require urgent support it is highly recommended that you Create a Support Ticket with the relevant information.
Welcome to DigiWorldz official forums! We would love to have you join us today! Here at the forums we allow you to get updates on regular news on the grid, technical updates, and more! Click on the "Register Now" button to join us today! Already a resident? No problem at all just use your inworld name!
  1. VenumusVortex

    VenumusVortex Community Resident
    Community Resident

    Sep 12, 2016
    6
    2
    Male
    unemployed
    Hamilton, Ontario, Canada
    This is so you can give freebie items to digi residents but prevent any HG visitor from getting your freebie items
    Place the script in a prim along with 1 or all of your freebie items and let everyone know ;)

    Code:
    string hguri = "login.digiworldz.com"; // uri to the grid via hypergrid just leave out the :8002
    // dont worry about the rest below, the script will self configure itself
    integer localchan;
    integer glisten;
    list defbtns = ["GET FREEBIE", "EXIT"];
    diamenu(key toucher) {
        glisten = llListen(localchan, "", toucher, "");
        llDialog(toucher, "How may I help you "+llKey2Name(toucher)+"?", defbtns, localchan);
    }
    deliveritems(key avi) {
        list invlist = [];
        integer c = llGetInventoryNumber(INVENTORY_ALL);
        integer i = 0;
        for (i; i < c; ++i) {
            string iname = llGetInventoryName(INVENTORY_ALL, i);
            if (iname != llGetScriptName()) {
                invlist += iname;
            }
        }
        if (invlist != []) {
            llGiveInventoryList(avi, llGetObjectName(), invlist);
            llSay(0, "items sent!");
        }else{
            llSay(0, "Sorry no items to freely give in this prim at this time.");
        }
    }
    default {
        state_entry() {
            localchan = -(llRound(llFrand(999999)) + 99999);
        }
        touch_end(integer nd) {
            string aviname = llDetectedName(0);
            key toucher = llDetectedKey(0);
            if (llSubStringIndex(aviname, "@") == -1) {
                diamenu(toucher);
            }else if (llSubStringIndex(aviname, hguri) != -1) {
                diamenu(toucher);
            }else{
                llSay(0, "You are not of this world.");
            }
        }
        listen(integer chan, string name, key id, string msg) {
            if (chan == localchan) {
                llListenRemove(glisten);
                if (msg == "EXIT") {
                    // do nothing and just close the listen silently
                }
                if (msg == "GET FREEBIE") {
                    deliveritems(id);
                }
            }
        }
        on_rez(integer sp) {
            llResetScript();
        }
        changed(integer c) {
            if (c & CHANGED_REGION_START) {
                llResetScript();
            }
        }
    }
    
     
    Digital Status likes this.

Share This Page