Points mod

All web design discussion, including Ultimate Quiz MOD support.

Moderator: CricketMX Forum Moderators

Post Reply
egdcltd
Greenhorn
Greenhorn
Posts: 2
Joined: Sat Dec 01, 2007 10:31 pm
Contact:

The Ultimate Quiz Mod doesn't seem to be compatible with Points Mod as is. However, doing the following seems to work okay:

Code: Select all

OPEN

quiz.php

FIND

			// Let's do the cash
			if( $board_config['Quiz_CashMOD_On'] == ON )
			{
			include($phpbb_root_path . 'includes/functions_cash.'.$phpEx);
			
				// Lets get the currency.. err... name?
				$get_cash_name = "SELECT cash_name FROM " . CASH_TABLE . " WHERE cash_dbfield = '" . $board_config['Quiz_Cash_Currency'] . "'";
				
					if( !$get_cash_result = $db->sql_query($get_cash_name) )
					{
						message_die(GENERAL_ERROR, 'Unable to execute cash name query', '', __LINE__, __FILE__, $get_cash_name);
					}
			
			$actual_cash_name = $db->sql_fetchrow($get_cash_result);
			
			$cash_per_correct = $board_config['Quiz_Cash_Correct'];
			$cash_per_incorrect = $board_config['Quiz_Cash_Incorrect'];
			$cash_tax = $board_config['Quiz_Cash_Tax'];
			
			$total_cash = ( ( @array_sum($correct) * $cash_per_correct ) - ( @array_sum($incorrect) * $cash_per_incorrect ) - ( $cash_tax ) );
			
			if( $total_cash > 0 || $total_cash == 0 )
			{
			$cash_language_variable = sprintf($lang['Quiz_cash_total_result_gain'], $total_cash, $actual_cash_name['cash_name']);
			
				$cash_sql = "UPDATE " . USERS_TABLE . " SET " . $board_config['Quiz_Cash_Currency'] . " = " . $board_config['Quiz_Cash_Currency'] . " + " . intval($total_cash) . " WHERE user_id = " . $userdata['user_id'];
			}
			
			else if( $total_cash < 0 )
			{
			$total_cash = str_replace('-', '', $total_cash);
			$cash_language_variable = sprintf($lang['Quiz_cash_total_result_loss'], $total_cash, $actual_cash_name['cash_name']);
			
				$cash_sql = "UPDATE " . USERS_TABLE . " SET " . $board_config['Quiz_Cash_Currency'] . " = " . $board_config['Quiz_Cash_Currency'] . " - " . intval($total_cash) . " WHERE user_id = " . $userdata['user_id'];
			}

REPLACE WITH

			// Let's do the cash
			if( $board_config['Quiz_CashMOD_On'] == ON )
			{
			
			// Lets get the currency.. err... name?

			$actual_cash_name = $board_config['points_name'];
			
			$cash_per_correct = $board_config['Quiz_Cash_Correct'];
			$cash_per_incorrect = $board_config['Quiz_Cash_Incorrect'];
			$cash_tax = $board_config['Quiz_Cash_Tax'];
			
			$total_cash = ( ( @array_sum($correct) * $cash_per_correct ) - ( @array_sum($incorrect) * $cash_per_incorrect ) - ( $cash_tax ) );
			
			if( $total_cash > 0 || $total_cash == 0 )
			{
			$cash_language_variable = sprintf($lang['Quiz_cash_total_result_gain'], $total_cash, $actual_cash_name);
			
				$cash_sql = "UPDATE " . USERS_TABLE . " SET user_points = user_points + " . intval($total_cash) . " WHERE user_id = " . $userdata['user_id'];
			}
			
			else if( $total_cash < 0 )
			{
			$total_cash = str_replace('-', '', $total_cash);
			$cash_language_variable = sprintf($lang['Quiz_cash_total_result_loss'], $total_cash, $actual_cash_name);
			
				$cash_sql = "UPDATE " . USERS_TABLE . " SET user_points = user_points - " . intval($total_cash) . " WHERE user_id = " . $userdata['user_id'];
			}
User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

Hi,

It is only compatible with the Cash MOD. But thanks for posting that, I will include it in the Readme topic above! Cheers :)
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
Post Reply