Apps Home
|
Create an App
Nefer
Author:
ssssssss
Description
Source Code
Launch App
Current Users
Created by:
Ssssssss
// Title: Tip to View // Author: dude69fun // Version: 1.1 // vars var current_viewers = 0; var current_previewers = 0; var allow_preview = false; var fanclub_free = false; var mod_free = false; var mod_invite = false; var automatic_start = false; var countdown = 1; var preview_duration = 1; var stopped = false; var latest_join = 'nobody'; cb.settings_choices = [ {name: 'viewers_needed', type: 'int', minValue: 0, defaultValue: 0, label: "Minimum Viewers needed to start show"}, {name: 'full_cost', type: 'int', minValue: 1, defaultValue: 150, label: "Tokens for a full ticket"}, {name: 'allow_preview', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'yes', label: "Allow cheaper preview tickets?"}, {name: 'preview_cost', type: 'int', minValue: 1, defaultValue: 20, label: "Tokens for a preview ticket", required: false}, {name: 'preview_duration', type: 'int', minValue: 1, defaultValue: 60, label: "Duration of a preview ticket in seconds", required: false}, {name: 'fanclub_free', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'no', label: "Allow Fanclub Members to view the show for free?"}, {name: 'mod_free', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'no', label: "Allow Moderators to view the show for free?"}, {name: 'mod_invite', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'no', label: "Allow Moderators to invite and remove viewers to/from the show?"}, {name: 'automatic_start', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'yes', label: "Automatically start the show?"}, {name: 'start_countdown', type: 'int', minValue: 1, defaultValue: 10, label: "Countdown to start the show"}, {name: 'hidden_message', type: 'str', minLength: 1, maxLength: 255, defaultValue: "Tip to View my show!", label: "Message when the cam is hidden"} ]; // Custom Functions function addToPreview(user){ cb.limitCam_addUsers([user]); current_previewers += 1; cb.sendNotice("Do not tip the full tokens while in preview!",user,'#FFFFFF','#FF0000'); cb.setTimeout(function(){removeFromPreview(user)},preview_duration); } function removeFromPreview(user){ current_previewers -= 1; cb.limitCam_removeUsers([user]); } function startShow(){ if(!cb.limitCam_isRunning()){ cb.limitCam_start(cb.settings.hidden_message); } } function init(){ if(cb.settings.allow_preview == 'yes'){ allow_preview = true; } if(cb.settings.fanclub_free == 'yes'){ fanclub_free = true; } if(cb.settings.mod_free == 'yes'){ mod_free = true; } if(cb.settings.mod_invite == 'yes'){ mod_invite = true; } if(cb.settings.automatic_start == 'yes'){ automatic_start = true; } if(mod_free){ cb.sendNotice("Please log in again to be able to view the hidden cam for free!", '', '#FFFFFF', '##FF0000', 'bolder', 'red'); } if(fanclub_free){ cb.sendNotice("Please log in again to be able to view the hidden cam for free!", '', '#FFFFFF', '##FF0000', 'bolder', 'green'); } cb.sendNotice("Tip to View has been started! Type '!help' to get help.\nTip "+cb.settings.full_cost+" to join the show!"); if(allow_preview){ cb.sendNotice('Tip ' + cb.settings.preview_cost + ' tokens to get a preview for ' + cb.settings.preview_duration + ' seconds while the show is running!'); } // debug cb.limitCam_addUsers('dude69fun'); countdown = 1000 * cb.settings.start_countdown; // added 2 seconds preview for unhiding lag compensation preview_duration = (1000 * cb.settings.preview_duration) + 2000; cb.changeRoomSubject('#bigtits #blonde #deepthroat #blueeyes #flattummy Tip ' + cb.settings.full_cost + ' tokens to view the hidden cam show! Or Tip ' + cb.settings.preview_cost + ' tokens to spy for ' + cb.settings.preview_duration + ' seconds!'); cb.drawPanel(); } // Tip Handler cb.onTip(function(tip) { if(tip['amount'] >= cb.settings.full_cost){ cb.limitCam_addUsers([tip['from_user']]); current_viewers += 1; latest_join = tip['from_user']; cb.drawPanel(); if(automatic_start && current_viewers >= cb.settings.viewers_needed && !stopped && !cb.limitCam_isRunning()){ cb.setTimeout(startShow,countdown); cb.sendNotice("Tip to View will start in " + cb.settings.start_countdown + " seconds!\nTip "+cb.settings.full_cost+" to join the show!"); if(allow_preview){ cb.sendNotice('Tip ' + cb.settings.preview_cost + ' tokens to get a preview for ' + cb.settings.preview_duration + ' seconds while the show is running!'); } } } else if(tip['amount'] >= cb.settings.preview_cost && allow_preview){ addToPreview(tip['from_user']); } }); // Panel Handler cb.onDrawPanel(function(user) { return { 'template': '3_rows_of_labels', 'row1_label': 'Current Viewers:', 'row1_value': current_viewers + ' / ' + cb.settings.viewers_needed, 'row2_label': 'Tip2View:', 'row2_value': cb.settings.full_cost, 'row3_label': 'Latest To Join:', 'row3_value': latest_join }; }); // Mod/FanClub Handler cb.onEnter(function(user) { var username = user['user']; if(mod_free && user['is_mod'] && !cb.limitCam_userHasAccess([username])){ cb.limitCam_addUsers([username]); cb.sendNotice("You can now view the hidden show for free, because you are a moderator!",username); } else if(fanclub_free && user['in_fanclub'] && !cb.limitCam_userHasAccess([username])){ cb.limitCam_addUsers([username]); cb.sendNotice("You can now view the hidden show for free, because you are in the fanclub!",username); } cb.sendNotice("Tip to View is running! Type '!help' to get help.",username); }); // Chat Handler cb.onMessage(function(msg) { var message = msg['m']; var user = msg['user']; var username = ""; if (user == cb.room_slug && message == '!start') { cb.setTimeout(startShow,countdown); cb.sendNotice("Tip to View will start in " + cb.settings.start_countdown + " seconds!\nTip "+cb.settings.full_cost+" to join the show!"); if(allow_preview){ cb.sendNotice('Tip ' + cb.settings.preview_cost + ' tokens to get a preview for ' + cb.settings.preview_duration + ' seconds while the show is running!'); } } else if (user == cb.room_slug && message == '!stop' && cb.limitCam_isRunning()) { cb.limitCam_stop(); cb.sendNotice("Tip to View has been stopped!"); stopped = true; } else if ((user == cb.room_slug || msg['is_mod']) && message.substring(0, 7) == '!remove') { username = message.substring(8, message.length); if (cb.limitCam_userHasAccess(username)) { cb.limitCam_removeUsers([username]); cb.sendNotice(username + ' was removed from the show by ' + user + '!',cb.room_slug,'#FFFFFF','#FF0000'); cb.sendNotice('You have been removed by the broadcaster!',username); } } else if ((user == cb.room_slug || msg['is_mod']) && message.substring(0, 7) == '!invite') { username = message.substring(8, message.length); if (!cb.limitCam_userHasAccess(username)) { cb.limitCam_addUsers([username]); cb.sendNotice(username + ' was invited to the show by ' + user + '!',cb.room_slug,'#FFFFFF','#FF0000'); cb.sendNotice('You have been invited by the broadcaster!',username); } } else if (message == '!check') { if (cb.limitCam_userHasAccess(user)){ cb.sendNotice('You are invited!',user); } else { cb.sendNotice('You are not invited! Tip ' + cb.settings.full_cost + ' tokens to join!',user); } } else if (message == '!help') { if (user == cb.room_slug) { cb.sendNotice('All Commands:\n"!start" to manually start the show.\n"!stop" to stop the show.\n"!remove username" to exclude someone.\n"!invite username" to invite someone.',cb.room_slug); } else { cb.sendNotice('Use "!check" to see if you are invited!\nTip ' + cb.settings.full_cost + ' tokens to join the show!',user); if (allow_preview) { cb.sendNotice('Tip ' + cb.settings.preview_cost + ' tokens to get a preview for ' + cb.settings.preview_duration + ' seconds while the show is running!',user); } } } if (message[0] == '!') { msg['X-Spam'] = true; } }); init();
© Copyright Chaturbate 2011- 2025. All Rights Reserved.