|
Post by rhondairv on May 3, 2010 14:06:28 GMT -8
Can you make it so when the lottery is activated admin can ''hide'' the numbers from any non staff? Then when we need we can show the numbers to the members. The thing is this could be a fun lottery to play, but as it is right now there is not much to do. We want members to be able to post their lotto guesses and then at the end of the week or until someone guesses correctly we can then reveal the winning numbers. Right now we take a snapshot of the numbers then disable the lotto system. When the numbers are guessed we post the pic showing. It would be much better if we could just ''reveal'' the numbers. support.proboards.com/index.cgi?board=codedatabase&action=display&n=1&thread=70609Part 1: Main Header
Code: <script type="text/javascript"> <!-- /* Lottery System v1 by Cr0w Copyright 2006 Do not repost and keep this header intact MAIN HEADER */
xxOn="no" xx="" xx1="" xx2="" xx3=""
if(xxOn=="yes"){ LotteryNumbers = '<table width="250px" cellpadding="4" cellspacing="1" align="center" class="bordercolor" id="LottoTable">'; LotteryNumbers += '<tr>'; LotteryNumbers += '<td class="titlebg" width="100%" colspan="2" align="center">'; LotteryNumbers += '<font size=2><b>Winning Lotto Numbers</B></font>'; LotteryNumbers += '</td>'; LotteryNumbers += '</tr>'; LotteryNumbers += '<tr>'; LotteryNumbers += '<td width="100%" class="windowbg2" vAlign="top" align="center" id="LotteryTable">'; LotteryNumbers += '</td>'; LotteryNumbers += '</tr>'; LotteryNumbers += '</table>'; } else if(xxOn=="no"){ LotteryNumbers = '<table width="250px" cellpadding="4" cellspacing="1" align="center" class="bordercolor" id="LottoTable" style="display: none">'; LotteryNumbers += '<tr>'; LotteryNumbers += '<td class="titlebg" width="100%" colspan="2" align="center">'; LotteryNumbers += '<font size=2><b>Winning Lotto Numbers</B></font>'; LotteryNumbers += '</td>'; LotteryNumbers += '</tr>'; LotteryNumbers += '<tr>'; LotteryNumbers += '<td width="100%" class="windowbg2" vAlign="top" align="center" id="LotteryTable">'; LotteryNumbers += '</td>'; LotteryNumbers += '</tr>'; LotteryNumbers += '</table>'; } document.write(LotteryNumbers); //--> </script> Part 2: Main Footer
Code: <script type="text/javascript"> <!-- /* Lottery System by Cr0w Copyright 2006 Do not repost and keep this header intact MAIN FOOTER */
var HighNum="99" //Edit this to the highest number the lottery can go up to
if(location.href.match(/system=Lottery/)){ document.title = document.title.replace('Modify Headers and Footers','Lottery Settings'); Table = document.getElementsByTagName('Table'); for(t=4;t<Table.length;t++){ Table.item(t).style.display = 'none' } var x=Math.round(Math.random()*HighNum) var x1=Math.round(Math.random()*HighNum) var x2=Math.round(Math.random()*HighNum) var x3=Math.round(Math.random()*HighNum) LottoBody = '<div style="display: none">'; LottoBody += '<input type="text" value="'+x+'" id="Lottonum">'; LottoBody += '<input type="text" value="'+x1+'" id="Lottonum1">'; LottoBody += '<input type="text" value="'+x2+'" id="Lottonum2">'; LottoBody += '<input type="text" value="'+x3+'" id="Lottonum3">'; LottoBody += '</div>'; LottoBody += '<table border="0" cellpadding="4" cellspacing="1" class="bordercolor" width="92%" align="center">'; LottoBody += '<tr>'; LottoBody += '<td class="titlebg"><b>Lottery Settings</b></td></tr>'; LottoBody += '<tr><td class="windowbg">Click the "Activate Lottery" button to enable the lottery system. Once you click the button, the lottery table will be displayed, along with 4 randomly selected numbers. These numbers will remain the same to everyone on your forum.<br /><br /> Once you click the "De-activate Lottery" button, the table will disappear, and will once again be displayed when you click on "Activate Lottery" again.'; LottoBody += '</td></tr><tr>'; LottoBody += '<td class="windowbg">'; LottoBody += '<center><input type="button" value="Activate Lottery" onclick="LottoSave()"> <input type="button" value="De-activate Lottery" onclick="LottoOff()"></center>'; LottoBody += '</td></tr></table>'; document.write(LottoBody); function LottoSave(){ var xxxOn= document.getElementById('LottoOn'); var xxx= document.getElementById('Lottonum'); var xxx1= document.getElementById('Lottonum1'); var xxx2= document.getElementById('Lottonum2'); var xxx3= document.getElementById('Lottonum3');
header = document.getElementsByName('header').item(0); header.value = header.value.replace(new RegExp('xxOn="'+xxOn+'"',"i"),'xxOn="yes"'); header.value = header.value.replace(new RegExp('xx="'+xx+'"',"i"),'xx="'+xxx.value+'"'); header.value = header.value.replace(new RegExp('xx1="'+xx1+'"',"i"),'xx1="'+xxx1.value+'"'); header.value = header.value.replace(new RegExp('xx2="'+xx2+'"',"i"),'xx2="'+xxx2.value+'"'); header.value = header.value.replace(new RegExp('xx3="'+xx3+'"',"i"),'xx3="'+xxx3.value+'"'); document.forms.item(0).submit(true); } function LottoOff(){ header = document.getElementsByName('header').item(0); header.value = header.value.replace(new RegExp('xxOn="'+xxOn+'"',"i"),'xxOn="no"'); document.forms.item(0).submit(true); } } document.getElementById("LotteryTable").innerHTML = +xx+', '+xx1+', '+xx2+', '+xx3;
var div = document.getElementsByTagName('div'); for(q=0;q<div.length;q++){ if(div[q].innerHTML.match(/Headers\sand\sFooters/i)){ div[q].innerHTML+='<br /><a href="index.cgi?action=headersfooters2&id=-&system=Lottery">Lottery System</a>'; }} //--> </script>
|
|
|
Post by Wormopolis on May 18, 2010 1:40:49 GMT -8
I will need to install this in order to understand how it works.
stay tuned.
|
|
|
Post by Wormopolis on May 18, 2010 1:58:41 GMT -8
so my experimenting led me to this:
until you "activate" the lottery, the table stays hidden anyway. once activated, it THEN picks the 4 numbers and shows the table.
so.. by current operaton of the code.. its already doing what you want. Just have the members pick their guesses, then at the end of the week, "activate" the lottery. it will then pick the 4 numbers and they will stay those same numbers until you deactivate it again.
or are you looking to keep the previous lottery displays and start a new lottery each week?
|
|
|
Post by rhondairv on May 18, 2010 4:33:28 GMT -8
The person running it lets people guess through out the week. They could win before the week is out.
If they guess their numbers get edited out of post so others can continue guessing.
So we need to know the winning numbers before they start to pick them.
No, we don't need the previous winning numbers stay up.
|
|
|
Post by Wormopolis on May 18, 2010 11:31:32 GMT -8
a normal lottery doesnt pick the winning numbers first though. That is what I am getting at. at the end of the week, you activate the system, IT picks the winning numbers. then you go back into the thread looking to see if anyone picked those numbers.
that way no one can give out what their guesses were because they knew they had won based on the fact you removed their post. all guesses would be in order of posting as well. so if you had 2 winners, and you needed a way to show that person A actually won because they picked the winning numbers first, you had an intact thread display. by NOT picking winning numbers first, people can guess all they want because NO ONE knows what the winning numbers are yet.
see what Im getting at?
|
|
|
Post by rhondairv on May 18, 2010 17:44:22 GMT -8
Yeah i see, we're just not normal lmao
|
|
|
Post by Wormopolis on May 18, 2010 18:03:04 GMT -8
The other issue with just hiding the table, is if you pick the numbers first, then just have it hide the table, anyone can just go into your source to see what numbers were picked and then post their "guess".
|
|
|
Post by Wormopolis on May 18, 2010 18:04:51 GMT -8
Im really starting to think its the "facebook like/dislike" code that keeps slowing the loading time for the forum... I might just disable it this weekend and see if everything improves.
|
|
|
Post by rhondairv on May 18, 2010 18:54:50 GMT -8
If it is let me know. I am using it also and mine is running slow.I have been wondering what it is. ok, then lets scrap this project. We can do it the way we are and it's safer as far as anyone finding out what the numbers are.
|
|
|
Post by rhondairv on Oct 11, 2010 17:37:55 GMT -8
I have Q about this... anyway to make it so i can have more than 4 numbers showing (7 tops) and rename the title?
|
|
Bones
Code Helper
Posts: 131
Bones said 0 great things
|
Post by Bones on Jan 10, 2011 0:20:07 GMT -8
Here is a rewrite of the code that allowed draw time choosing of how many numbers was to be drawn.
|
|
|
Post by rhondairv on Jan 13, 2011 9:59:21 GMT -8
thank you ;D
|
|
Bones
Code Helper
Posts: 131
Bones said 0 great things
|
Post by Bones on Mar 23, 2011 13:24:52 GMT -8
|
|