vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Major Additions - ICash, Simple, stand alone point system. (https://vborg.vbsupport.ru/showthread.php?t=119086)

Black Tiger 03-08-2007 12:54 AM

I had posted the same question as Mys has posted here, in the ibProarcade support area, so in fact I have the same question.:)

But I don't have a clue how to work with hooks or how to implement them.
I can understand a little what the db query does you wrote Blaine, but I don't have a clue how to implement it nore where. I would need screenshot examples or a product.xml file or something like that, cause on this territory I'm really a noob.

I would already be very glad if I (for starters) only had a way that users had to pay to play with Icash credits and that I could setup in the ACP the amound of credits needed to play a game. Any help is VERY appreciated!

Blaine0002 03-08-2007 01:01 AM

ok try this, make a new plugin, hook location ibproarcade_play_game

contents somthing like this

PHP Code:

$amount '1';

if ((
$vbulletin->userinfo[$vbulletin->options['icashf']] - $amount) < 0) {
          eval(
standard_error(fetch_error('your_error')));
}
$vbulletin->db->query("update " TABLE_PREFIX "user set {$vbulletin->options['icashf']}={$vbulletin->options['icashf']}-'{$amount}' where userid='{$vbulletin->userinfo['userid']}'"); 

you will need to make a phrase called whatever you want saying somthing like 'you dont have enough to play this game'

heres what each individual thing does
$amount is set to whatever you want your games to cost, you need to set this

if (($vbulletin->userinfo[$vbulletin->options['icashf']] - $amount) < 0) {
eval(standard_error(fetch_error('your_error')));
}

this checks the money row, and sees if they have enough to play the game, if not, ERROR!
of course you will need to make a new error phrase and edit the code to whatever you named your phrase.

$vbulletin->db->query("update " . TABLE_PREFIX . "user set {$vbulletin->options['icashf']}={$vbulletin->options['icashf']}-'{$amount}' where userid='{$vbulletin->userinfo['userid']}'");

if the error passes this updates their settings and minuses the $amount from their points :D

have fun !

Mys 03-08-2007 04:32 AM

Quote:

Originally Posted by Blaine0002 (Post 1198462)
would be simple enough, like just put the following code in whatever hook you want to take action for

PHP Code:

$amount '1';
$vbulletin->db->query("update " TABLE_PREFIX "user set {$vbulletin->options['icashf']}={$vbulletin->options['icashf']}+'{$amount}' where userid='{$vbulletin->userinfo['userid']}'"); 

for example giving points on arcade champ would be the hook ibproarcade_new_champ

Thank you, sir!

I will try to work with that.

Mys 03-08-2007 04:35 AM

really looking forward to hear how Black Tiger makes out with that....

Thanks, again, Blaine!


:up:

2meplie 03-08-2007 01:08 PM

I installed the update a first time. But it was not working correctly (we got points for a new thread but not for a reply). I tried to reinstall it and I got this:

Database error in vBulletin 3.6.4:

Invalid SQL:
ALTER TABLE user ADD COLUMN money decimal(15,2) DEFAULT '0' NOT NULL;

MySQL Error : Duplicate column name 'money'
Error Number : 1060

???

2meplie 03-08-2007 02:05 PM

ok I found the way.

nvm

mcqwert 03-08-2007 02:13 PM

So is this working on v3.6 yet?

Blaine0002 03-08-2007 02:20 PM

yes, this has always been working on 3.6..

2mepile was it a problem with my code?

Black Tiger 03-08-2007 02:22 PM

Working fine on 3.6.x mcqwert, no problem.

@Blaine0002: Thanks very much! This evening I have to go out, but I will try to do it like you said later tonight (around 02.00 GMT+1). I'll let you all know how it worked out.

2meplie 03-08-2007 02:29 PM

Quote:

Originally Posted by Blaine0002 (Post 1195448)
it is actually very easy to add points for different actions people do ont he forums, i am going to cover voting on a poll.
Create a new plugin and call it : ICash Poll
The hooklocation should probably be : pollvotedata_postsave
and the code should look somthing like this
PHP Code:

$amount '1';
$vbulletin->db->query("update " TABLE_PREFIX "user set {$vbulletin->options['icashf']}={$vbulletin->options['icashf']}+'{$amount}' where userid='{$vbulletin->userinfo['userid']}'"); 

now just set the $amount variable to the amount you want to give to the voter.

simple as that, you simply have to know what hook is located where.

if you wanted to subtract points all you would need to do is change + to - in the php code.

Have fun and feel free to post your plugins :)

I did this and it does not work. It say:

Fatal error: Call to a member function on a non-object in .../public_html/forum/includes/class_dm_pollvote.php(138) : eval()'d code on line 2


All times are GMT. The time now is 12:49 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.01641 seconds
  • Memory Usage 1,762KB
  • 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
  • (3)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (3)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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