vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   vBookie - vBulletin Betting Hack (https://vborg.vbsupport.ru/showthread.php?t=65844)

tjdrico 06-03-2004 10:00 PM

vBookie - vBulletin Betting Hack
 
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 https://vborg.vbsupport.ru/ 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 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 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.

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 this post 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 this post. 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.

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

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.


_______________________________________

sabret00the 06-04-2004 09:27 PM

/me clicks install again

msimplay 06-04-2004 11:11 PM

sounds excellent :D will install tomoz :D

corsacrazy 06-04-2004 11:36 PM

how and WHO organises the events? because i was thinking right, i own a car website and i thought members can each own a car and put cash into the pot and race eachother is that possible with this ?

dniMTheory 06-05-2004 12:45 AM

Got it installed with no problems at all. Perfect instructions.

A few things.

1. My "open until" and "payout on" dates are the same as the time I posted the thread.
It just says "This event will pay out after 1 Minute Ago at 12:00 AM" even though i set the payout for two days from now. Same thing for event info.

2. I'm using Ucash and the display of richest people is way off.

007 06-05-2004 05:50 AM

Can this be used to bet on real events such as sports? There would be no "odds" needed then. Simply wait until the end of the game and then someone would go enter the score. Is this possible with this?

tjdrico 06-05-2004 07:44 AM

Quote:

Originally Posted by corsacrazy
how and WHO organises the events? because i was thinking right, i own a car website and i thought members can each own a car and put cash into the pot and race eachother is that possible with this ?

If you give them the right permissions, anyone can post events, but payouts are always made by "the system". It's not possible to win from another poster as such.

tjdrico 06-05-2004 07:46 AM

Quote:

Originally Posted by 006
Can this be used to bet on real events such as sports? There would be no "odds" needed then. Simply wait until the end of the game and then someone would go enter the score. Is this possible with this?

Do you mean just betting on "the winner"? If so you could just enter each team/participants name as an Outcome, with them all having Odds of 1/1. Then just select the winning team when you settle the bet. Everyone who bet on the winner would get their stake back plus the same amount again.

tjdrico 06-05-2004 07:53 AM

Quote:

Originally Posted by dniMTheory
Got it installed with no problems at all. Perfect instructions.

A few things.

1. My "open until" and "payout on" dates are the same as the time I posted the thread.
It just says "This event will pay out after 1 Minute Ago at 12:00 AM" even though i set the payout for two days from now. Same thing for event info.

2. I'm using Ucash and the display of richest people is way off.

1. I've never had that problem, so it's difficult to suggest what the reason is without access to your forum/event. I will try to replicate it. What timezone are you using?

2. The query I'm using is this:

PHP Code:

$q "SELECT u.username, p.".$vboptions['uttpoints_pointsfield']." AS cash FROM " TABLE_PREFIX $vboptions['uttpoints_pointtable']." AS p LEFT JOIN " TABLE_PREFIX "user AS u ON u.userid=p.userid ORDER BY cash DESC LIMIT 5"

That should work out something like:

[sql]
SELECT u.username, p.money AS cash FROM user AS p LEFT JOIN user AS u ON u.userid=p.userid ORDER BY cash DESC LIMIT 5
[/sql]

It might be that I don't understand uCash properly, as I don't really use it. I'll try to find out what's what and iron out any glitches.

deathemperor 06-05-2004 08:48 AM

great, this is what I was asking hundreds of time. Thank you tjdrico !
going to install this soon
thanks again.

sabret00the 06-05-2004 09:18 AM

upgrade went mega smoothly

yl88 06-05-2004 02:47 PM

good job, i will install it later.

Beermonster 06-05-2004 03:59 PM

[high]* Beermonster clicks install again :)[/high]

xQuEeNzNaZcHox 06-05-2004 05:34 PM

I truly screwed up

www.nymfans.com

tjdrico 06-05-2004 05:39 PM

Quote:

Originally Posted by xQuEeNzNaZcHox
I truly screwed up

www.nymfans.com

Screwed up the installation?

AzHousePro 06-05-2004 11:02 PM

Excellent hack. It will fit in perfectly with my billiards board.

Mike

xQuEeNzNaZcHox 06-05-2004 11:33 PM

Parse error: parse error, unexpected T_VARIABLE, expecting ')' in /home/nymfans/public_html/includes/init.php on line 868

I get that now. I can't run the install script. I edited all the files and templates, and want to run the installer.

HELP!

xQuEeNzNaZcHox 06-06-2004 12:29 AM

HELP PLEASE! I need to reopen my board.

ap0c 06-06-2004 12:59 AM

check your init.php file edit and redo the changes on a fresh copy if neccessary

xQuEeNzNaZcHox 06-06-2004 01:12 AM

Ok, most is all good, but I still have 2 issues:

- My forums won't expand in vB. They are stuck in the collapsed position.
- I don't have the sticky-like label next to the thread in showthread. Is that normal?

AzHousePro 06-06-2004 02:03 AM

I have it installed and taking bets now. How do I go in and change the odds after the event has been posted?

Is there a way that I could change the poor mode so that everyone gets an extra 25 or 50 dollars when a new event is posted?

Mike

AzHousePro 06-06-2004 06:11 AM

Doh, nevermind.

Mike

tjdrico 06-06-2004 07:07 AM

Quote:

Originally Posted by AzHousePro
I have it installed and taking bets now. How do I go in and change the odds after the event has been posted?

Is there a way that I could change the poor mode so that everyone gets an extra 25 or 50 dollars when a new event is posted?

You've probably already worked this out, but just in case you haven't:

Edit includes/functions_vbookie.php

Find:

PHP Code:

    $amount 25

Change that to 50, or whatever.

tjdrico 06-06-2004 07:08 AM

Quote:

Originally Posted by xQuEeNzNaZcHox
Ok, most is all good, but I still have 2 issues:

- My forums won't expand in vB. They are stuck in the collapsed position.
- I don't have the sticky-like label next to the thread in showthread. Is that normal?

I'm not sure what either of the problems you mention are -- can you provide screenshots?

tjdrico 06-06-2004 02:10 PM

It's been brought to my attention that I neglected to add a way to actually delete an Event. "Abandon" will cancel all bets and place the Event in a closed state, but it still exists in the database. I'll add a method to physically remove an event/detach it from a thread. I expect it to be just an update to vbookie.php, so patching should be very simple.

Apologies for the rather glaring oversight!

xQuEeNzNaZcHox 06-06-2004 02:57 PM

OK, I fixed problem B, but problem A is bad.

Screenshot is attached

xQuEeNzNaZcHox 06-06-2004 03:08 PM

That's my homepage, believe it or not. Thats this list of forums on my homepage.

tjdrico 06-06-2004 03:10 PM

I'm sorry, I can't suggest what you might have done. There are no edits to index.php for vBookie, so that page shouldn't have been affected as far as I can tell. I've checked on my own forum that has vBookie installed, and the forums collapse and uncollapse fine. Check it out here. I can only suppose that you either didn't follow the instructions correctly, or didn't realise that something you were asked to do might conflict with some other hack you've got installed.

Perhaps someone who is more familiar with the forum display page might be able to suggest what the problem may be, but I'm sorry I have no ideas.

tjdrico 06-06-2004 03:38 PM

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.

xQuEeNzNaZcHox 06-06-2004 03:48 PM

HELP ME! Please!!!!!!!!!!!!!!!!!!!!!!!!!!!

djohn 06-06-2004 05:03 PM

Awesome. Before i install this, does it have any group and forum specific permissions, so that only specified groups can bet or post vBookie events in specified forums?

tjdrico 06-06-2004 05:19 PM

Quote:

Originally Posted by djohn
Awesome. Before i install this, does it have any group and forum specific permissions, so that only specified groups can bet or post vBookie events in specified forums?

Yes. You can use the standard permissions system to grant/revoke rights to:

- add/edit an event
- edit someone else's events
- bet on events

These can be applied to user groups, or turned on/off on specific forums.

On my forums I have Registered Users allowed to bet, Bookies allowed to add/edit anyone's, and Restricted Bookies allowed to add/edit their own.

tjdrico 06-06-2004 05:33 PM

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.

Wolffman 06-06-2004 07:25 PM

When I tried to edit the permissions this came up:

Code:

Database error in vBulletin 3.0.1:

Invalid SQL: UPDATE usergroup SET

### UPDATE QUERY GENERATED BY fetch_query_sql() ###
        title = 'Members',
        description = '',
        usertitle = '',
        opentag = '',
        closetag = '',
        passwordexpires = '0',
        passwordhistory = '0',
        attachlimit = '0',
        canpostvbookieevent = '1',
        caneditothersvbookieevents = '1',
        canbet = '1',
        avatarmaxwidth = '150',
        avatarmaxheight = '150',
        avatarmaxsize = '50000',
        profilepicmaxwidth = '200',
        profilepicmaxheight = '200',
        profilepicmaxsize = '65535',
        pmquota = '40',
        pmsendmax = '5',
        uttstore_discount = '0',
        forumpermissions = '127487',
        pmpermissions = '3',
        calendarpermissions = '17',
        wolpermissions = '1',
        adminpermissions = '0',
        genericpermissions = '7879',
        genericoptions = '30',
        shoutboxpermissions = '0',
        siguploaderpermissions = '0',
        arcadepermissions = '0'
WHERE usergroupid=2
mysql error: Unknown column 'canpostvbookieevent' in 'field list'

mysql error number: 1054


tjdrico 06-06-2004 07:45 PM

Quote:

Originally Posted by Wolffman
When I tried to edit the permissions this came up:

Code:

Database error in vBulletin 3.0.1:

Invalid SQL: UPDATE usergroup SET

### UPDATE QUERY GENERATED BY fetch_query_sql() ###
        title = 'Members',
        description = '',
        usertitle = '',
        opentag = '',
        closetag = '',
        passwordexpires = '0',
        passwordhistory = '0',
        attachlimit = '0',
        canpostvbookieevent = '1',
        caneditothersvbookieevents = '1',
        canbet = '1',
        avatarmaxwidth = '150',
        avatarmaxheight = '150',
        avatarmaxsize = '50000',
        profilepicmaxwidth = '200',
        profilepicmaxheight = '200',
        profilepicmaxsize = '65535',
        pmquota = '40',
        pmsendmax = '5',
        uttstore_discount = '0',
        forumpermissions = '127487',
        pmpermissions = '3',
        calendarpermissions = '17',
        wolpermissions = '1',
        adminpermissions = '0',
        genericpermissions = '7879',
        genericoptions = '30',
        shoutboxpermissions = '0',
        siguploaderpermissions = '0',
        arcadepermissions = '0'
WHERE usergroupid=2
mysql error: Unknown column 'canpostvbookieevent' in 'field list'

mysql error number: 1054


According to my local mySQL, those columns shouldn't be in usergroup anyway:

Code:

mysql> show columns from vb_usergroup;
+---------------------+----------------------+------+-----+---------+----------------+
| Field              | Type                | Null | Key | Default | Extra          |
+---------------------+----------------------+------+-----+---------+----------------+
| usergroupid        | smallint(5) unsigned |      | PRI | NULL    | auto_increment |
| title              | varchar(100)        |      |    |        |                |
| description        | varchar(250)        |      |    |        |                |
| usertitle          | varchar(100)        |      |    |        |                |
| passwordexpires    | smallint(5) unsigned |      |    | 0      |                |
| passwordhistory    | smallint(5) unsigned |      |    | 0      |                |
| pmquota            | smallint(5) unsigned |      |    | 0      |                |
| pmsendmax          | smallint(5) unsigned |      |    | 5      |                |
| pmforwardmax        | smallint(5) unsigned |      |    | 5      |                |
| opentag            | varchar(100)        |      |    |        |                |
| closetag            | varchar(100)        |      |    |        |                |
| canoverride        | smallint(5) unsigned |      |    | 0      |                |
| ispublicgroup      | smallint(5) unsigned |      |    | 0      |                |
| forumpermissions    | int(10) unsigned    |      |    | 0      |                |
| pmpermissions      | int(10) unsigned    |      |    | 0      |                |
| calendarpermissions | int(10) unsigned    |      |    | 0      |                |
| wolpermissions      | int(10) unsigned    |      |    | 0      |                |
| adminpermissions    | int(10) unsigned    |      |    | 0      |                |
| genericpermissions  | int(10) unsigned    |      |    | 0      |                |
| genericoptions      | int(10) unsigned    |      |    | 0      |                |
| pmpermissions_bak  | int(10) unsigned    |      |    | 0      |                |
| attachlimit        | int(10) unsigned    |      |    | 0      |                |
| avatarmaxwidth      | smallint(5) unsigned |      |    | 0      |                |
| avatarmaxheight    | smallint(5) unsigned |      |    | 0      |                |
| avatarmaxsize      | int(10) unsigned    |      |    | 0      |                |
| profilepicmaxwidth  | smallint(5) unsigned |      |    | 0      |                |
| profilepicmaxheight | smallint(5) unsigned |      |    | 0      |                |
| profilepicmaxsize  | int(10) unsigned    |      |    | 0      |                |
| arcadepermissions  | int(10) unsigned    | YES  |    | 0      |                |
| uttstore_discount  | varchar(20)          |      |    | 0      |                |
+---------------------+----------------------+------+-----+---------+----------------+
30 rows in set (0.02 sec)

It looks like you didn't follow the installation instructions correctly. Those three columns (canpostvbookieevent, caneditothersvbookieevents, canbet) should have gone directly below "'canseedelnotice' => 262144," in init.php which would make them part of the 'forumpermissions' group.

I recommend that you go through the installation instructions again, double-checking them against what you've actually done.

Wolffman 06-06-2004 07:57 PM

That was my fault. All I did was forget to add a phrase.

Thanks anyway. :)

tjdrico 06-06-2004 08:02 PM

Quote:

Originally Posted by Wolffman
That was my fault. All I did was forget to add a phrase.

Thanks anyway. :)

Cool! =) Odd error to happen as a result of a missing phrase though.

lordnex 06-06-2004 08:07 PM

Good hack, thanks for posting it! It does take a bit of careful editing as it does go into a few hacks and someone not very observant might overwrite those hacks.

Good job though!

tjdrico 06-06-2004 08:13 PM

Quote:

Originally Posted by lordnex
Good hack, thanks for posting it! It does take a bit of careful editing as it does go into a few hacks and someone not very observant might overwrite those hacks.

I agree. Unfortunately it's impossible to write instructions that cover every available hack, so it's only really possible to write them assuming an 'as new' unhacked installation. If something like v3Arcade has already been added, or uCash perhaps, or Petz, or... or... or... then the instructions might clash; particularly when it comes to bitfield permissions where the next available number in an original installation might be 16, but that might already have been used by another hack. The savvy hacker would know to use 32 instead, but not everyone has such knowledge.

I've tried to stress in the installation instructions the importance of prior backups, but that's advice not everyone will heed. Sensible people would read through all the instructions first, and compare them to their own files before starting, but this is the real world and people aren't that cautious. =)

I think I might update the installation instructions to stress these points though.

Additional:

OK, updated installation instructions:

http://www.kop.nildram.co.uk/images/vbinstall.gif

I think that's about all I can reasonably do. =)

GamerzWorld 06-06-2004 08:49 PM

what do you get to start with? Also can you loose all your cash?


All times are GMT. The time now is 06:23 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03477 seconds
  • Memory Usage 1,905KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (4)bbcode_php_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete