Back to vBulletin 3.0 Add-Ons

vBookie - vBulletin Betting Hack
Mod Version: 1.00, by tjdrico

This modification is in the archives.
vB Version: 3.0.0 Rating: (5 votes - 4.80 average) Installs: 359
Released: 05 Jun 2004 Last Update: Never Downloads: 389
Not Supported  

vBookie

Introduction

vBookie is a 'bookmakers' or betting extension to vBulletin. It enables authorised members to post Events and Outcomes that forum members can bet on. Each Outcome has its own set of odds, and odds can be modified through the life of an Event (bets that are placed are stored with the prevailing odds, so even if the odds change, your users are paid at the correct rate).

Once the results are known, Events can be settled and forums members awarded their winnings.

vBookie uses its own vCash by default, but this has no more use than as 'bragging rights'. However, vBookie also comes with a built-in switch to allow it to use either uCash or Petz money instead. That means that all bets are paid for and settled using uCash or Petz money, making betting even more attractive than just for fun on forums with uShop/Petz installed. Although vBookie does not have any built-in facility to integrate with any other store hacks, it's a very simple job to hack vBookie itself to integrate it with any store/points system you care to use.

Features
  • master switch to turn vBookie off
  • option to use uCash
  • option to use Petz money
  • settings to restrict the creation of Events to specific user groups
  • settings to restrict which user groups can bet on Events
  • settings to restrict which user groups can edit or settle other people's Events
  • per-Event, specify whether punters may bet on more than one outcome
  • optional 'charity mode' so that the poorest members of the forum always have something to play with
  • supplied with a module for vBadvanced

Please click if you install this hack, thanks. Please also let me know - send me an email or a PM. If you'd let me know the forum URL too that'd be cool!

vBookie is free, and will remain free.

Updates

1.0.0 -> 1.0.1

- adds the ability to delete Events. See this post

Spoiler (click to open)


I've just uploaded a file with version 1.0.1 in it. This is essentially identical to 1.0.0 but it adds the ability to delete Events.

If you have already installed 1.0.0, please download 1.0.1 and overwrite vbookie.php with the new version. Then add the following three phrases and one new template plus one template change:

Phrases
----------------------------------------------------------
type: GLOBAL
varname: vbookie_delete_event
text: Delete <i>vBookie</i> Event
----------------------------------------------------------
type: GLOBAL
varname: vbookie_confirm_delete_event
text: Are you sure you want to <b>delete</b> this <i>vBookie</i> event?
----------------------------------------------------------
type: Front-End Redirect Messages
varname: vbookie_redirect_deleted
text: Your <i>vBookie</i> event has been deleted. If there were any stakes placed on an unsettled bet, they have been returned. You will now be taken back to the main <i>vBookie</i> page.
----------------------------------------------------------

New Template

title: vbookie_confirm_delete_event
Code:
<br />
<form action="vbookie.php" method="post">
<input type="hidden" name="item_id" value="$item_id">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
	<td class="tcat">$vbphrase[vbookie_delete_event]</td>
</tr>
<tr>
	<td class="alt1" colspan="7">
		$vbphrase[vbookie_confirm_delete_event]<br />		
	</td>
</tr>
<tr>
	<td class="thead">
		<input type="hidden" name="s" value="$session[sessionhash]" />
		<input type="hidden" name="t" value="$threadid" />
		<input type="hidden" name="do" value="confirmeddelete" />
		<input type="submit" class="button" name="preview" value="Yes" accesskey="p" tabindex="1" />
	</td>
</tr>
</table>
</form>
<br />
Template CHANGE

title: vbookie_main_items_bit
Code:
<tr> 
<td class="$bgclass">$item[item_title]<span class="smallfont"><br /><a href="showthread.php?t=$item[threadid]">Thread</a> | <a href="vbookie.php?do=viewitem&amp;item_id=$item[item_id]">Info</a>
<if condition="$can_delete"> | <a href="vbookie.php?do=deleteitem&amp;item_id=$item[item_id]">Delete</a></if></span></td>
<td class="$bgclass">$item[group_title]</td>
<td class="$bgclass">$item[item_status]</td>
<td class="$bgclass">$item[created]</td>
<td class="$bgclass">$item[openuntil]</td>
<td class="$bgclass">$item[payafter]</td>
</tr>
Let me know if there are any problems.

Close
for upgrade instructions if you already have 1.0.0

1.0.1 -> 1.0.2

Corrected a minor bug with the charity mode when using uCash. See this post

Spoiler (click to open)


Just updated for 1.0.2 which is a minor fix. I tidied up some stuff and deleted something I shouldn't have. Just upload the includes/functions_vbookie.php file, or do the following change:

Find:

PHP Code:
function vbookie_do_charity()
{
    global 
$DB_site$vbookiesettings
Change to:

PHP Code:
function vbookie_do_charity()
{
    global 
$DB_site$vboptions$vbookiesettings
This would only have affected you if you had the "charity mode" on, and had any users with less than 25 money.

Close
for manual upgrade instructions from 1.0.1.

1.0.2 -> 1.0.3

Corrected a minor bug with the richest people display when using uCash. Just overwrite includes/functions_vbookie.php with the one from the new Zip file.

1.0.3 -> 1.0.4

Corrected some date display problems when using "Detailed" dates. For manual update instructions, see this post

Spoiler (click to open)


If you want to hack that in for the time being anyway, open showthread.php and...

Find:

PHP Code:
    $eventinfo['openuntil_date'] = vbdate($vboptions['dateformat'],$eventinfo['item_open_until'],true);
    
$eventinfo['payafter_date'] = vbdate($vboptions['dateformat'],$eventinfo['item_pay_after'],true);
    
$eventinfo['openuntil_time'] = vbdate($vboptions['timeformat'],$eventinfo['item_open_until'],true);
    
$eventinfo['payafter_time'] = vbdate($vboptions['timeformat'],$eventinfo['item_pay_after'],true); 
and replace it with:

PHP Code:
    $eventinfo['openuntil_date'] = vbdate($vboptions['dateformat'],$eventinfo['item_open_until']);
    
$eventinfo['payafter_date'] = vbdate($vboptions['dateformat'],$eventinfo['item_pay_after']);
    
$eventinfo['openuntil_time'] = vbdate($vboptions['timeformat'],$eventinfo['item_open_until']);
    
$eventinfo['payafter_time'] = vbdate($vboptions['timeformat'],$eventinfo['item_pay_after']); 
Next, open vbookie.php

Find:

PHP Code:
        exec_switch_bg();
        
$item['created'] = vbdate($vboptions['dateformat'],$item['item_created'],true);
        
$item['openuntil'] = vbdate($vboptions['dateformat'],$item['item_open_until'],true);
        
$item['payafter'] = vbdate($vboptions['dateformat'],$item['item_pay_after'],true);
        eval(
'$betitembits .= "' fetch_template('vbookie_main_items_bit') . '";'); 
and replace it with:

PHP Code:
        exec_switch_bg();
        
$item['created'] = vbdate($vboptions['dateformat'],$item['item_created']);
        
$item['openuntil'] = vbdate($vboptions['dateformat'],$item['item_open_until']);
        
$item['payafter'] = vbdate($vboptions['dateformat'],$item['item_pay_after']);
        eval(
'$betitembits .= "' fetch_template('vbookie_main_items_bit') . '";'); 
Then find:

PHP Code:
    $eventinfo['openuntil_date'] = vbdate($vboptions['dateformat'],$eventinfo['item_open_until'],true);
    
$eventinfo['payafter_date'] = vbdate($vboptions['dateformat'],$eventinfo['item_pay_after'],true);
    
$eventinfo['openuntil_time'] = vbdate($vboptions['timeformat'],$eventinfo['item_open_until'],true);
    
$eventinfo['payafter_time'] = vbdate($vboptions['timeformat'],$eventinfo['item_pay_after'],true); 
and replace that with:

PHP Code:
    $eventinfo['openuntil_date'] = vbdate($vboptions['dateformat'],$eventinfo['item_open_until']);
    
$eventinfo['payafter_date'] = vbdate($vboptions['dateformat'],$eventinfo['item_pay_after']);
    
$eventinfo['openuntil_time'] = vbdate($vboptions['timeformat'],$eventinfo['item_open_until']);
    
$eventinfo['payafter_time'] = vbdate($vboptions['timeformat'],$eventinfo['item_pay_after']); 
That should sort the "1 Minute Ago" problem. These edits will be made to the install set from 1.0.4 onwards.

Close
.

Corrected Petz bug whereby all winnings were paid to the bet's owner rather than individual winners. To upgrade from 1.03 or earlier, see http://www.vbulletin.org/forum/showpost.php?p=523030 or overwrite includes/functions.vbookie.php with the 1.0.4 version.

Problems?

-> Petz - If you are using Petz there is a bug in all versions up to and inclusing 1.0.3. Your players won't get paid their winning, and all payouts will end up in the account of the person that posted the Event. To correct this, please see http://www.vbulletin.org/forum/showpost.php?p=523030. This fix will be incororated into 1.0.4 onwards.

-> If you can't post Events, or can't bet on them make sure you have set your user permissions

-> If you have an SQL error Invalid SQL: UPDATE SET =25 WHERE <25 make sure you are using version 1.0.3 or later.

-> If you have any other general problems, please check the installation/hack instructions and make sure you have carried out all the steps and also check that you made the changes correctly

Anything else, ask in this thread.

Other Stuff

-> If you are using Detailed Date & Time display and have a problem with Event dates appearing as '1 Minute Ago', see this post

Spoiler (click to open)


If you want to hack that in for the time being anyway, open showthread.php and...

Find:

PHP Code:
    $eventinfo['openuntil_date'] = vbdate($vboptions['dateformat'],$eventinfo['item_open_until'],true);
    
$eventinfo['payafter_date'] = vbdate($vboptions['dateformat'],$eventinfo['item_pay_after'],true);
    
$eventinfo['openuntil_time'] = vbdate($vboptions['timeformat'],$eventinfo['item_open_until'],true);
    
$eventinfo['payafter_time'] = vbdate($vboptions['timeformat'],$eventinfo['item_pay_after'],true); 
and replace it with:

PHP Code:
    $eventinfo['openuntil_date'] = vbdate($vboptions['dateformat'],$eventinfo['item_open_until']);
    
$eventinfo['payafter_date'] = vbdate($vboptions['dateformat'],$eventinfo['item_pay_after']);
    
$eventinfo['openuntil_time'] = vbdate($vboptions['timeformat'],$eventinfo['item_open_until']);
    
$eventinfo['payafter_time'] = vbdate($vboptions['timeformat'],$eventinfo['item_pay_after']); 
Next, open vbookie.php

Find:

PHP Code:
        exec_switch_bg();
        
$item['created'] = vbdate($vboptions['dateformat'],$item['item_created'],true);
        
$item['openuntil'] = vbdate($vboptions['dateformat'],$item['item_open_until'],true);
        
$item['payafter'] = vbdate($vboptions['dateformat'],$item['item_pay_after'],true);
        eval(
'$betitembits .= "' fetch_template('vbookie_main_items_bit') . '";'); 
and replace it with:

PHP Code:
        exec_switch_bg();
        
$item['created'] = vbdate($vboptions['dateformat'],$item['item_created']);
        
$item['openuntil'] = vbdate($vboptions['dateformat'],$item['item_open_until']);
        
$item['payafter'] = vbdate($vboptions['dateformat'],$item['item_pay_after']);
        eval(
'$betitembits .= "' fetch_template('vbookie_main_items_bit') . '";'); 
Then find:

PHP Code:
    $eventinfo['openuntil_date'] = vbdate($vboptions['dateformat'],$eventinfo['item_open_until'],true);
    
$eventinfo['payafter_date'] = vbdate($vboptions['dateformat'],$eventinfo['item_pay_after'],true);
    
$eventinfo['openuntil_time'] = vbdate($vboptions['timeformat'],$eventinfo['item_open_until'],true);
    
$eventinfo['payafter_time'] = vbdate($vboptions['timeformat'],$eventinfo['item_pay_after'],true); 
and replace that with:

PHP Code:
    $eventinfo['openuntil_date'] = vbdate($vboptions['dateformat'],$eventinfo['item_open_until']);
    
$eventinfo['payafter_date'] = vbdate($vboptions['dateformat'],$eventinfo['item_pay_after']);
    
$eventinfo['openuntil_time'] = vbdate($vboptions['timeformat'],$eventinfo['item_open_until']);
    
$eventinfo['payafter_time'] = vbdate($vboptions['timeformat'],$eventinfo['item_pay_after']); 
That should sort the "1 Minute Ago" problem. These edits will be made to the install set from 1.0.4 onwards.

Close
.

-> If you want to use poster 'Reputation' as the currency for vBookie, see this post

Spoiler (click to open)


Quote by rinkrat
Can this be modded to use VB reputation points as the currency? That would be perfect for my board.
Yes, that's quite possible.

All you'd need to do is hack the functions_vbookie.php file, changing the 8 instances of 'vbookie_cash' to 'reputation'. That should be all you need to do. You might want to alter some of the phrases as well, as they mention 'cash' such as "You do not have enough cash to cover your bets" (vbookie_not_enough_cash) or "You have 300 cash" (vbookie_may_bet), etc.

Also, in the vBookie general settings, turn off the display of vCash in the postbit, as it'd be pointless to display. Since you're dealing with Reputation, you'd also want to turn off the "charity" mode I expect, as that would re-set anyone lower than 25 to a 25 Reputation each time a new Event is added.

Close
.

About Odds

Odds of "5/1" are "amount won per amount placed". This means that I would win 5 for every 1 placed. Of course, if I win, I get my stake back as well. Odds of "1/5" means that I win 1 for every 5 placed. I'd have to place 25 to win just 5.

Decimal Odds

Decimal odds are just another way of displaying the same information. 2.0 is the same as 2/1. 0.2 is the same as 1/5. vBookie only lets you specify odds in terms of x/y, but if you think in terms of decimal you can still work out what odds to provide. Simply think of your decimal odds as "2.0 / 1.0" or "0.5 / 1.0" and then multiply each side through by 10 or 100 until there are only zeros to the right of the decimal point, then just take the whole number part.

2.0 / 1.0 has no decimals, so this is the same as 2/1

0.5 / 1.0 has a 0.5, so multiply both parts by 10 to get 5.0 / 10.0. Then you can specify your odds as 5 / 10. You might also realise that this is the same as 1/2. The technique is a simple way to work out any odds you may need to specify.

Odds of 0.65 -> 0.65 / 1.0 -> 65.0 / 100.0 or 65/100. Then you can divide through by 5 to get to 13 / 20, although this step isn't necessary.

_______________________________________

Download

This modification is archived and cannot be downloaded.

Screenshots

       

   

Similar Mods

vBookie for vBulletin 3.5 vBulletin 3.5 Add-ons

vblts.ru supports vBulletin®, 2022-2024