Apps Home
|
Create an App
Joes test app
Author:
hardworkertntest
Description
Source Code
Launch App
Current Users
Created by:
Hardworkertntest
// Title: Joes Crazy Ticket // Author: hardworkertn // Version: 1.0 (11/12/2021) cb.settings_choices = [ {name: 'min_start_tokens', type: 'int', minValue: 1, maxValue: 1000, defaultValue: 49, label: "Ticket Show Price"}, {name: 'hide_message', label: 'Cam Message', type: 'str', minLength: 1, maxLength: 256, defaultValue: 'Joes Crazy Ticket Show! Tip at least ' + cb.settings.min_start_tokens + ' tokens to join in on the fun!' }, ]; // ****************************************** // GLOBAL VARIABLES // ****************************************** var userlist = ["hardworkertn"]; x_totaltickets=0; cb.onStart(user => { cb.chatNotice(user['user'] + ' STARTED JOES CRAZY TICKET APP!'); }); cb.onTip(function(tip) { if (!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), tip['from_user'])) { if(parseInt(tip['amount']) >= cb.settings.min_start_tokens) { output('Added '+ tip['from_user'] + ' to secret show!'); if (cb.limitCam_isRunning()){ output("app is running for loop"); cb.limitCam_addUsers(tip.from_user); } handleTip(tip.amount, tip.from_user); handleArray(tip.from_user); output('Current Users: ' + userlist); } if(parseInt(tip['amount']) < cb.settings.min_start_tokens) { output(tip['from_user'] + ' you must tip ' + cb.settings.min_start_tokens + ' or more to watch the show!'); } } }); // functions function handleTip(amount,user){ } function handleArray(user){ output('adding user: ' + user); userlist.push(user); output('Current Users: ' + userlist); } function arrayRemove(value) { output('incominguser list:' + userlist); return userlist.filter(function(ele){ return ele != value; }); output('returned user list: ' + userlist); } cb.onMessage(function (msg) { var message = msg['m']; var user = msg['user']; var username = ""; var emo = [" :kissy"]; var colr = ['#9F9']; if (cb.room_slug === user && message == '/create') { output(cb.room_slug + 'array created'); handleArray(user); } if (cb.room_slug === user && message == '/start') { output(cb.room_slug + ' has started the show!'); //var userlist = cb.limitCam_allUsersWithAccess() cb.limitCam_start("Joes Crazy Ticket Show Tip " + cb.settings.min_start_tokens + " tokens"); // now add the users from the array to the show. addMax(); //now lets add people who are on the list output('List Current Users: ' + userlist); let arraylength = userlist.length; output("total users in user list: " +arraylength); cb.limitCam_removeAllUsers(); for (let i = 0; i < arraylength; i++) { username=userlist[i] cb.limitCam_addUsers([username]); output("added from array: " + username); } output("All paid ticket holders have been added. You may need to refresh your browser."); } if (cb.room_slug === user && message == '/stop' && cb.limitCam_isRunning()) { output(cb.room_slug + ' has stopped the show!'); cb.limitCam_stop(); cb.limitCam_removeAllUsers(); } if (cb.room_slug === user && message.substring(0, 6) == '/check') { username = message.substring(7, message.length); checkflag = userlist.includes(username); output(username + 'has a check flag: ' + checkflag); // if (cb.limitCam_userHasAccess(username)) { // output(username + " is in the show!"); // } // else { // output(username + " is not in the show!"); // } } //if (cb.room_slug === user && message.substring(0, 7) == '/remove' && cb.limitCam_allUsersWithAccess().length > 0) { if (cb.room_slug === user && message.substring(0, 7) == '/remove') { username = message.substring(8, message.length); userlist = arrayRemove(username); output('var userlist result: ' + userlist); if (cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), username)) { cb.limitCam_removeUsers([username]); output(cb.room_slug + ' has removed ' + username + ' from the show!'); } } if (cb.room_slug === user && message.substring(0, 4) == '/add') { output('message: ' + message); username = message.substring(5, message.length); output('username: ' + username); //handleArray(username); output('adding user: ' + username); userlist.push(username); output('Current Users: ' + userlist); if (cb.limitCam_isRunning()){ output("app is running for loop"); cb.limitCam_addUsers(username); } output(cb.room_slug + ' has added ' + username + ' from the show!'); } if (cb.room_slug === user && message.substring(0, 7) == '/addmax') { addMax(); output(cb.room_slug + '-- the max users were added'); } if (cb.room_slug === user && message === '/camlist') { var usercamlist = cb.limitCam_allUsersWithAccess(); if (usercamlist.length > 0) { output("" + usercamlist.length + (usercamlist.length > 1 ? " users" : " user") + " in show: " + cbjs.arrayJoin(usercamlist, ", ")); } else { output("No users in show."); } } if (cb.room_slug === user && message === '/list') { // let x_totaltickets = userlist.length; //output('Total in List: ' + x_total); output('List Current Users: ' + userlist); } msg.m += " "+ emo[1]; msg['background'] = colr[1]; if (message[0] == '/') { msg['X-Spam'] = true; } // if they bought a ticket, lets give them an icon //checkflag = userlist.includes(username); // msgprefix="*"; // if (checkflag == true){ // msg="$ "; // } return msg; }); function output(message) { cb.chatNotice(message); } function addMax(){ cb.limitCam_addUsers('user1'); cb.limitCam_addUsers('user2'); cb.limitCam_addUsers('user3'); cb.limitCam_addUsers('user4'); cb.limitCam_addUsers('user5'); cb.limitCam_addUsers('user6'); cb.limitCam_addUsers('user7'); cb.limitCam_addUsers('user8'); cb.limitCam_addUsers('user9'); cb.limitCam_addUsers('user10'); cb.limitCam_addUsers('user11'); cb.limitCam_addUsers('user12'); cb.limitCam_addUsers('user13'); cb.limitCam_addUsers('user14'); cb.limitCam_addUsers('user15'); cb.limitCam_addUsers('user16'); cb.limitCam_addUsers('user17'); cb.limitCam_addUsers('user18'); cb.limitCam_addUsers('user19'); cb.limitCam_addUsers('user20'); cb.limitCam_addUsers('user21'); cb.limitCam_addUsers('user22'); cb.limitCam_addUsers('user23'); cb.limitCam_addUsers('user24'); cb.limitCam_addUsers('user25'); cb.limitCam_addUsers('user26'); cb.limitCam_addUsers('user27'); cb.limitCam_addUsers('user28'); cb.limitCam_addUsers('user29'); cb.limitCam_addUsers('user30'); cb.limitCam_addUsers('user31'); cb.limitCam_addUsers('user32'); cb.limitCam_addUsers('user33'); cb.limitCam_addUsers('user34'); cb.limitCam_addUsers('user35'); cb.limitCam_addUsers('user36'); cb.limitCam_addUsers('user37'); cb.limitCam_addUsers('user38'); cb.limitCam_addUsers('user39'); cb.limitCam_addUsers('user40'); cb.limitCam_addUsers('user41'); cb.limitCam_addUsers('user42'); cb.limitCam_addUsers('user43'); cb.limitCam_addUsers('user44'); cb.limitCam_addUsers('user45'); cb.limitCam_addUsers('user46'); cb.limitCam_addUsers('user47'); cb.limitCam_addUsers('user48'); cb.limitCam_addUsers('user49'); cb.limitCam_addUsers('user50'); cb.limitCam_addUsers('user51'); cb.limitCam_addUsers('user52'); cb.limitCam_addUsers('user53'); cb.limitCam_addUsers('user54'); cb.limitCam_addUsers('user55'); cb.limitCam_addUsers('user56'); cb.limitCam_addUsers('user57'); cb.limitCam_addUsers('user58'); cb.limitCam_addUsers('user59'); cb.limitCam_addUsers('user60'); cb.limitCam_addUsers('user61'); cb.limitCam_addUsers('user62'); cb.limitCam_addUsers('user63'); cb.limitCam_addUsers('user64'); cb.limitCam_addUsers('user65'); cb.limitCam_addUsers('user66'); cb.limitCam_addUsers('user67'); cb.limitCam_addUsers('user68'); cb.limitCam_addUsers('user69'); cb.limitCam_addUsers('user70'); }
© Copyright Chaturbate 2011- 2024. All Rights Reserved.