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)

Jay... 06-22-2006 01:27 PM

can this system be prevented from going into minus?

armstrong 06-23-2006 07:35 AM

Hello Blaine, I am not familiar with VB's plugin/hooks/internal workings/etc, but can code basic php/mysql. Could you post a short sample php code to do something elementary, like say transfer money from userA to userB? From this point, I should be able to work it out. I would really appreciate it if you can do this!

Blaine0002 06-23-2006 01:58 PM

really not much has anything to do with it, its mostly just backend queries and other stuff. for example a donation template would look somthing like
PHP Code:

<form action="donate.php?$session[sessionurl]do=DoDonateMoney" method='post'>
<
table class="tborder" cellpadding="6" cellspacing="1" border="0" width="100%" align="center">
<
tr>
<
td class='tcat' align='center' colspan='6' width='1%'><a style="float:right" href="#top" onclick="return toggle_collapse('donate_money')"><img id="collapseimg_donate_money" src="$stylevar[imgdir_button]/collapse_tcat.gif" alt="" border="0" /></a>Donate Money!</td></tr>
<
tbody id="collapseobj_donate_money" style="{$vbcollapse['collapseobj_donate_money']}">
<
tr>
<
td class='thead' align='center' width='50%'><b>Amount</b></td>
<
td class='thead' align='center' width='50%'><b>To [Enter Username]</b></td>
</
tr>
<
tr>
<
td class='alt1' align='center' width='50%'><input type='text' class='bginput' name='amount'></td>
<
td class='alt1' align='center' width='50%'><input type='text' class='bginput' name='to' value='{$to}'></td>
</
tr>
<
tr>
<
td class='tfoot' colspan='2' align='center'><input type='submit' value='Donate Money!' class='bginput'></td>
</
tr>
</
table>
</
form

and then the backend php file would look somthing like this
PHP Code:

<?php
<?php
  error_reporting
(E_ALL & ~E_NOTICE);
  
define('NO_REGISTER_GLOBALS'1);
  
define('THIS_SCRIPT''donate');
  
//call the template
  
$actiontemplates = array('Donate' => array('itemshop_donate_money', ), );
  
// main DONATE
  
if ($_GET['do'] == "Donate") {
      
$navbits = array("itemshop.php?$session[sessionurl]&do=" $Action => "Donate");
      
$navbits[""] = "Send Money To Members";
      
$to $_GET['to'];
      eval(
'$template .= "' fetch_template('itemshop_donate_money') . '";');
  }

  
// DONATE function [Money]
    
if ($_GET['do'] == "DoDonateMoney") {
      
$navbits = array("itemshop.php?$session[sessionurl]&do=" $Action => "Donate");
      
$navbits[""] = "Sending Money";
      
      
$amount $_POST['amount'];
      
$amount str_replace(","""$amount);
      
$doname $_POST['to'];
      
$doname addslashes(htmlspecialchars_uni($doname));
      
      if (!
$user $db->query_first("select * from " TABLE_PREFIX "user where username='{$doname}'")) {
      
// user dosent exist
      
eval(standard_error(fetch_error('error_shop_sendmtonoexist')));
      }
      
      if (
$user_shop['userid'] == $vbulletin->userinfo['userid']) {
      
//user is self
      
eval(standard_error(fetch_error('error_shop_sendmtonoself')));
      }
      
      if (
$amount || $amount == 0) {
      
//cant send 0
      
eval(standard_error(fetch_error('error_shop_sendmsomthing')));
      }
      
      if (
$vbulletin->userinfo[$vbulletin->options['itemshop_pointfield']] - $amount 0) {
      
//you dont have enough
      
eval(standard_error(fetch_error('error_shop_donthave')));
      }
      
      
//take money
      
$db->query("update " TABLE_PREFIX "user set {$vbulletin->options['itemshop_pointfield']}={$vbulletin->options['itemshop_pointfield']}+'{$amount}' where userid='{$user_shop['userid']}'");
      
//give money
      
$db->query("update " TABLE_PREFIX "user set {$vbulletin->options['itemshop_pointfield']}={$vbulletin->options['itemshop_pointfield']}-'{$amount}' where userid='{$vbulletin->userinfo['userid']}'");
      
      
$vbulletin->url "donate.php?$session[sessionurl]do=Donate" $vbulletin->session->vars['sessionurl'] ."";
      
//donated successfully!
      
eval(print_standard_redirect('shop_r_donatesuccess'truetrue));
  }
?>

if you even have the slightest knowledge of php i think you can figure it out from there. If you need help there are some great resources in the modifaction tutorials forum! :)

armstrong 06-25-2006 11:07 AM

Thank you, Blaine. This is great stuff. :tu: I like how I can use this with my own code, which means I can keep my forum's cash system lean and focused only on the stuff I really need.

Blaine0002 06-26-2006 10:36 PM

Glad you enjoy it. I am currently planning on integrating this with v3arcade and IBproarcade, so reccommend any other plugins you guys want.

stonner 06-27-2006 09:01 PM

Quote:

Originally Posted by Michael_Tree
Can you please add something where you get points per first place score in ibp pro arcade?

Thanks!

would be very interested too...

Blaine0002 06-28-2006 12:58 PM

I am working on integrating this with both arcade systems.

stonner 06-28-2006 01:02 PM

this would be great...

functions:
cost per game
wins per game if in highscore list.

would this be possible?

Blaine0002 06-28-2006 04:05 PM

hmm how about somthing like you specify a number, and they get #1 on the highscores, they get that number X 10, number 9 would be X 5. ect. or what were you thinking?

stonner 06-28-2006 09:12 PM

yes something like this.

and a fix price per game.

would this be possible?


All times are GMT. The time now is 12:33 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.01850 seconds
  • Memory Usage 1,787KB
  • 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
  • (2)bbcode_php_printable
  • (1)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