vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   vBookie for vBulletin 3.5 (https://vborg.vbsupport.ru/showthread.php?t=94128)

Adam21 03-16-2006 12:37 PM

Quote:

Originally Posted by Catsgot9
I deleted a thread that had a bet in it.. now the bet stays there inactive. How can I remove this from vbookie?

CatsGot9

i think maybe this post can help u.:)
https://vborg.vbsupport.ru/showpost....&postcount=250

Adam21 03-16-2006 03:05 PM

Psybernaut:i tried to settle a test bet,the payout was supposed to be more than what the bookie's vcash have in hand.the result is the bookie have a huge enormous value of vcash instead.any ideas?

Adam21 03-16-2006 03:06 PM

Quote:

That's it! ...unless you're using vbBux, then you need a couple more mods...


psybernaut:if i'm using vcash,would i still need to carry those other hacks below as well?

Andreas 03-16-2006 10:35 PM

Quote:

Originally Posted by psybernaut
that's assuming Andreas is willing to hand it over of course... I'm not looking to step on toes :)

This assumption is wrong. I will not hand over this hack to someone else.

psybernaut 03-16-2006 11:06 PM

Quote:

Originally Posted by Andreas
This assumption is wrong. I will not hand over this hack to someone else.

ok... like I said, I'm not looking to step on toes. I'd just like to see this great mod moving forward again :)

geo1 - sorry about that problem, vcash is an unsigned int so it wraps to a large number instead of going negative.

Here's a fix that will set the bookies cash to 0 instead of going negative. NOTE: a bookie can exploit this by putting all their cash in the bank (for vbbux/ebux/ucash) before settling bets, so it's not perfect! This applies to all cash systems, just replace the entire vbookie_take_bookie_cash() function.

In includes/functions_vbookie.php, find:
Code:

// psybernaut mod
function vbookie_take_bookie_cash($userid, $amount)
{
        global $vbulletin;

        switch ($vbulletin->options['vbookiecash'])
        {
                case 'vcash':
                        $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET vbookie_cash=vbookie_cash-$amount WHERE userid=$userid");
                        break;
                case 'ucash':
                        $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET ucash=ucash-$amount WHERE userid=$userid");
                        break;
                case 'ebux':
                        $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET ebux=ebux-$amount WHERE userid=$userid");
                        break;
                case 'custom':
                        ($hook = vBulletinHook::fetch_hook('vbookie_take_bookie_cash')) ? eval($hook) : false;

        }
}

Replace with:
Code:

// psybernaut mod
function vbookie_take_bookie_cash($userid, $amount)
{
        global $vbulletin;

        $bookie = $vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid=$userid");

        switch ($vbulletin->options['vbookiecash'])
        {
                case 'vcash':
                        if($amount > $bookie['vbookie_cash'])
                        {
                                $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET vbookie_cash=0 WHERE userid=$userid");
                        }
                        else
                        {
                                $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET vbookie_cash=vbookie_cash-$amount WHERE userid=$userid");
                        }
                        break;
                case 'ucash':
                        if($amount > $bookie['ucash'])
                        {
                                $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET ucash=0 WHERE userid=$userid");
                        }
                        else
                        {
                                $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET ucash=ucash-$amount WHERE userid=$userid");
                        }
                        break;
                case 'ebux':
                        if($amount > $bookie['ebux'])
                        {
                                $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET ebux=0 WHERE userid=$userid");
                        }
                        else
                        {
                                $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET ebux=ebux-$amount WHERE userid=$userid");
                        }
                        break;
                case 'custom':
                        ($hook = vBulletinHook::fetch_hook('vbookie_take_bookie_cash')) ? eval($hook) : false;
        }
}

If you implemented the hook for vbBux, edit it (the 'vBookie With vbPlaza - Take Bookie Cash' hook) and replace the php code with this:
Code:

// take the bookies money
$bookie = $vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid=$userid");
if($amount > $bookie['vbbux'])
{
        $amount = $amount - $bookie['vbbux'];
        $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET vbbux=0 WHERE userid=$userid");
        if($amount > $bookie['vbbank'])
        {
                $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET vbbank=0 WHERE userid=$userid");
        }
        else
        {
                $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET vbbank=vbbank-$amount WHERE userid=$userid");

        }
}
else
{
        $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET vbbux=vbbux-$amount WHERE userid=$userid");
}

Quote:

Originally Posted by geo1
psybernaut:if i'm using vcash,would i still need to carry those other hacks below as well?

No. You only need that part if you're using vbBux.

I'll update my original post to include these changes, so only make this change if you already made the mod previously and need to fix the 'paying out more that you have' issue.

EDIT: Updated the vbbux hook to deduct money from the bookie's bank account if they don't have enough cash on hand.

Catsgot9 03-16-2006 11:31 PM

The question is... If I want to use the bookie option so they can go broke... will this mod work with vcash? I do not have any other cash methods installed..

Thanks in advance, Psybernaut!

Catsgot9

psybernaut 03-16-2006 11:33 PM

Quote:

Originally Posted by Catsgot9
The question is... If I want to use the bookie option so they can go broke... will this mod work with vcash? I do not have any other cash methods installed..

Thanks in advance, Psybernaut!

Catsgot9

Yes, this mod works with vCash.

Porky 03-17-2006 12:59 AM

does this work with 3.54?

psybernaut 03-17-2006 01:05 AM

Quote:

Originally Posted by Porky
does this work with 3.54?

Yes.

Adam21 03-17-2006 02:42 AM

Thanks psybernaut!i'll correct that once i've reach home...:)

djwins 03-17-2006 05:13 AM

Quote:

Originally Posted by mclark2112
Is there any way to retain my users old vCash from before the 3.5 upgrade? I haven't updated vBookie yet, so I'm sure it is still in the database.

Quote:

Originally Posted by xug
Yeah, any info for people who have this already in their database?

Any upgrade path for people using the pre-3.5vB version?

Adam21 03-17-2006 09:23 AM

thanks to psybernaut,i've vbookie events paying out from the vbookies themselves.works great!thanks alot!

Baudman 03-18-2006 02:38 AM

I just installed this hack and can't get it to except my attempts to change the usergroups permissions. I click on a usergroup and set everything to yes and then save it. It says it saves but then I check to see if its set to yes and they arn't. Has anyone else had this proble? or am I doing something wrong?

Andreas 03-18-2006 03:05 AM

> Has anyone else had this proble?
Everyone has because the install code is "broken".
Just import the XML again and select override

Baudman 03-18-2006 03:23 AM

Quote:

Originally Posted by Andreas
> Has anyone else had this proble?
Everyone has because the install code is "broken".
Just import the XML again and select override

thanks I acually found another thread that said to rebuild the bitfields and it worked. My only other question is how do I delete an event from the event list? I have deleted the original thread but it still shows on the list.

Andreas 03-18-2006 12:25 PM

Should have been deleted too, though as it has not been deleted ... not possible.

VodkaFish 03-18-2006 03:43 PM

On the main vbookie page, the dropdown to show different events:
Currently showing * Events. Switch to * Events
If you choose "settled", it brings my forum down. mysql gets a too many connections error. I do have a lot of settled events, but I can't understand why one query would bring it down. Either way, just thought I'd report it. I took the option off of my forums for the meantime. I'm using the latest version of vbookie.

Andreas 03-18-2006 04:18 PM

Edit vbookie.php and replace
PHP Code:

LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON thread.vbookie_item_id item.item_id 

with
PHP Code:

LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (thread.threadid item.threadid

[sql]ALTER TABLE vbookie_items ADD INDEX (item_status);
UPDATE vbookie_items, thread SET vbookie_items.threadid=thread.threadid WHERE thread.vbookie_item_id=vbookie_items.item_id;
[/sql]
Execute these queries and check if it does help.

Freesteyelz 03-18-2006 11:15 PM

I'm currently testing this mod. I think you've done an awesome job, Andreas. :) Is it possible to add (either in XML or SQL Query) variance in the amount of cash (default 500) by Usergroup upon registration and current registries? This is what I'm thinking:

In XML:

Code:

$db->query_write("ALTER TABLE " . TABLE_PREFIX . "user ADD vbookie_cash BIGINT UNSIGNED DEFAULT '500' AFTER pmunread WHERE usergroupid='x'");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "user ADD vbookie_cash BIGINT UNSIGNED DEFAULT '1500' AFTER pmunread WHERE usergroupid='y'");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "user ADD vbookie_cash BIGINT UNSIGNED DEFAULT '5000' AFTER pmunread WHERE usergroupid='z'");

And:

Code:

        $db->query_write("UPDATE " . TABLE_PREFIX . "user SET vbookie_cash=500" WHERE usergroupid='x');
        $db->query_write("UPDATE " . TABLE_PREFIX . "user SET vbookie_cash=1500" WHERE usergroupid='y');
        $db->query_write("UPDATE " . TABLE_PREFIX . "user SET vbookie_cash=5000" WHERE usergroupid='z');

Where "x", "y" and "z" are the specified UserIDs will be set. I realize that there isn't a "usergroupid" TABLE but I'm not sure of the workaround. :)

------------------------

EDITED: I modified the code bit and this part worked in SQL Query. :) Well, sort of. It only changes curent registered members upon usergroupid definition. New registries still inherit default vcash settings:

Code:

UPDATE user SET vbookie_cash='500' WHERE usergroupid='x';
UPDATE user SET vbookie_cash='1000' WHERE usergroupid='y';
UPDATE user SET vbookie_cash='5000' WHERE usergroupid='z';

For ALTER TABLE in SQL Query I'm trying to figure out this:

Code:

ALTER TABLE vbtest_user ADD vbookie_cash BIGINT UNSIGNED DEFAULT '5000' WHERE usergroupid='z' AFTER pmunread;
I'm getting a syntax error at "WHERE usergroupid='z'". Then again, do I need this portion for new and current registries to work properly?

------------------------

Edited Again: I could set SQL Query for userids such as:

Code:

UPDATE vbtest_user SET vbookie_cash='5000' WHERE userid='z';
Although I'd prefer doing it mass in XML or SQL Query. If it's not possible, by setting individual variance in SQL Query will it create a DB problem?

majoreyeswater 03-19-2006 11:35 AM

Love this mod, adds such value to my board.

Wondering if might be able to get a bit of help.

A member created an event in vBookie, then my some mistake, they deleted the thread before they had closed the event.

The event is now still listed in vBookie, and can't be closed or deleted.

Any help appreciated.

Zowners 03-21-2006 09:10 PM

^yah i have the same problem :(

hitmanuk2k 03-23-2006 06:47 PM

Having some trouble. When updating Usergroup settings, it is not saving the vBookie settings. As in, when I select "yes" can post events, it does not change to this, and stays on "no" when the page reloads.

Andreas 03-23-2006 07:07 PM

As posted half a ton of times already
Import the XML again or rebuild bitfields.

Daniel Thomas 03-25-2006 03:13 AM

deleted

psybernaut 03-25-2006 03:19 AM

Hey Andreas, how hard would it be to fix this permissions problem? I haven't looked at the code yet, but if you like I'd be happy look into it and send you an update.

Raven Michaels 03-26-2006 06:41 AM

For some reason...whenever I edit the admin permissions to be able to add vBookie stuff...I save and then when I look at it again...its back to no...

...anyone one else have that prob?

chairman miaow 03-26-2006 08:18 PM

Good grief !

:confused:

Andreas 03-26-2006 11:08 PM

<a href="https://vborg.vbsupport.ru/showpost.php?p=932906&postcount=743" target="_blank">https://vborg.vbsupport.ru/showp...&postcount=743</a>

AKINCI 03-27-2006 12:00 AM

edit, I found
Code:

UPDATE user SET vbookie_cash = ('500')
Thanks, very good hack.
But after 2 billion vcash, it counts not correctly.
How can I put back by sql query all user again to 500 vcash?
Thus I start again from the beginning.

Greets

natralis 03-27-2006 05:50 AM

All installed and uploaded as instructed however when in my Usergroup manager it will not allow me to change the options to Yes for posting events, and allowing to edit,etc it says updating but then sticks with them disabled.

Any ideas why or possible fix?

psybernaut 03-27-2006 06:06 AM

Quote:

Originally Posted by natralis
All installed and uploaded as instructed however when in my Usergroup manager it will not allow me to change the options to Yes for posting events, and allowing to edit,etc it says updating but then sticks with them disabled.

Any ideas why or possible fix?

Try reading the last few posts...

natralis 03-27-2006 06:10 AM

Have uploaded the plugin again and still no effect, how do i rebuild bit fields?

Rabbitoh Warren 03-27-2006 06:19 AM

FFS! Anyone else sick and tired of the same question being asked by people either too lazy or too stupid to read the bloody thread? :angry:

natralis 03-27-2006 06:22 AM

Well sorry for asking for help thought this was meant to be a helpful community.

psybernaut 03-27-2006 06:44 AM

Quote:

Originally Posted by natralis
Well sorry for asking for help thought this was meant to be a helpful community.

natralis, please try searching the thread or reading through previous posts. This question has been answered countless times already.

natralis 03-27-2006 09:08 AM

Problem solved thanks to all those who helped. And will read more next time.

psybernaut 03-28-2006 09:24 PM

Minor fix.. when showing bet statistics (vbookie.php?do=stats), private bets don't show up correctly. ie. You see "$vbphrase[anon] won 1850 on ..." instead of "anon won 1850 on ...".

The fix is pretty simple. In vbookie.php, find:
Code:

$user = '<i>$vbphrase[anon]</i>';
Replace with
Code:

$user = $vbphrase['anon'];
ie. it's missing the single quotes around 'anon' in the vbphrase. I dropped the italic tags just to save messing around with single quotes within single quotes.

majoreyeswater 03-30-2006 09:45 AM

Quote:

Originally Posted by majoreyeswater
Love this mod, adds such value to my board.

Wondering if might be able to get a bit of help.

A member created an event in vBookie, then my some mistake, they deleted the thread before they had closed the event.

The event is now still listed in vBookie, and can't be closed or deleted.

Any help appreciated.

Sorry to be a pain, but if someone could tell me how to delete an entry in vbookie that is no longer eidtable or no longer has a thread attached to it I would appreciate it.

I know we created the problem ourselves, but will take all the help I can get....

subnet_rx 03-30-2006 02:22 PM

I'm having problems integrating vBookie with eBux. I have either 1.0.6 or 1.0.7, can't remember which, but it lets me select ebux as an option. The problem is, it uses the wrong database field for the bank. It uses ebank, where the field in the user table is vbbank. How can I fix this?

FROGGYJ 03-30-2006 04:40 PM

ok I know this used to work fine with ebux, but it seems as though every since I upgraded ebux to the latest vbplaza I'm having issues now. I just wondering if there is something I have to update to reflect the changes or perhaps I have another problem.


All times are GMT. The time now is 06:32 PM.

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.02483 seconds
  • Memory Usage 1,855KB
  • 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
  • (11)bbcode_code_printable
  • (2)bbcode_php_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)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