MyBB Community Forums

Full Version: Game Section
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
ZiNga BuRgA Wrote:
Paretje Wrote:Yes that's included:
function games_myps_score()
{
	global $db, $mybb;
	
	if($mybb->user['uid'] != 0)
	{
		$db->query("UPDATE ".TABLE_PREFIX."users SET myps=myps+0".$mybb->settings['myps_games_score']." WHERE uid='".$mybb->user['uid']."'");
	}
}

function games_myps_champ()
{
	global $db, $mybb;
	
	if($mybb->user['uid'] != 0)
	{
		$db->query("UPDATE ".TABLE_PREFIX."users SET myps=myps+0".$mybb->settings['myps_games_champ']." WHERE uid='".$mybb->user['uid']."'");
	}
}
From the looks of that code, the same amount of money will be paid if the user gets a score of 1, or a score of 1000000.

As I've said, I think it's a little too basic, and probably somewhat unrealistic.
My plugin multiplies a admin-specifiable, game-specific, factor, which the score is multiplied by to give the resulting earnings.
	if($game['score_type'] == ASC) // is ASC actually define'd somewhere??  I presume this is just a string
		$ourscore = GAMESECT_MAXSCORE - $score;
	else
		$ourscore = $score;
	
	// add money for the score
	user_change_money($mybb->user, intval($ourscore), $game['myplaza_money_factor']);
Anyways, thanks.

Yes, that's true. I think that's the best, because in some there are games where a score of 20 is very good, but there are games that a score of 1.000.000 is not so much... And of course the ASC and DESC games.
That's a very good point, Paretje! It would be hard to put a consistent proportion to giving points. I also like it the way it is now, since I wouldn't want people getting too many of the forum points by playing a lot of games. LOL
Paretje Wrote:Yes, that's true. I think that's the best, because in some there are games where a score of 20 is very good, but there are games that a score of 1.000.000 is not so much... And of course the ASC and DESC games.
That's the whole reason why I made it a game specific rate.
$game['myplaza_money_factor']
Ow. I think it's a good idea, but you must to make it possible to shut it down Wink

Maybe, this is a solution:
if($game['score_type'] == ASC)
{
	//The starting score
	$points = $mybb->settings['gamesect_play_pay_max'];
	
	//Putting down
	$points = $points-ceil($score/$mybb->settings['gamesect_play_pay']));
	
	//Control if the points aren't to low
	if($points <= 0)
	{
		$points = $mybb->settings['gamesect_play_pay_min']
	}
}
else
{
	//The points
	$points = ceil($score/$mybb->settings['gamesect_play_pay']));
	
	//Control if the points aren't too high or to low
	if($points > $mybb->settings['gamesect_play_pay_max'])
	{
		$points = $mybb->settings['gamesect_play_pay_max'];
	}
	elseif($points < $mybb->settings['gamesect_play_pay_min'])
	{
		$points = $mybb->settings['gamesect_play_pay_min'];
	}
}
Hmm, min/max earnings may not be a bad idea.
Thanks.
Ow, I see a big mistake, but you know what I mean Wink
Entrail, and everybody with the sessions problem or who is interested:
http://community.gamesection.org/showthr...06#pid2306
New version
There is a new version of the Game Section, Game Section 1.1.7.

More information:
http://community.gamesection.org/showthread.php?tid=344
New version
There is a new version of the Game Section, Game Section 1.1.8.

More information:
http://community.gamesection.org/showthread.php?tid=345
Here is my activation problem: MySQL error: 1364
Field 'rating' doesn't have a default value
Query: INSERT INTO mybb_games (gid, cid, name, title, description, what, use_keys, bgcolor, active, width, height, dateline, score_type) VALUES ('', '0', 'pacman', 'Pacman', 'Eat all the little dots without letting the ghosts get you!', 'Eat all of the dots.', 'Arrow keys to move.', '000000', 'yes', '360', '420', '1201450753', 'DESC')