Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
V3Arcade - Pay for Play (Permissions Based) Details »»
V3Arcade - Pay for Play (Permissions Based)
Version: 1.00, by Dechevious Dechevious is offline
Developer Last Online: Oct 2005 Show Printable Version Email this Page

Version: 3.0.6 Rating:
Released: 01-23-2005 Last Update: Never Installs: 2
DB Changes
 
No support by the author.

What this hack does and how it operates:

This hack was requested by Detomah (and a substantial number of others over the years) which will allow you, the admin, to control the number of games that can be played, based on the users access permission level.

The concept/design/installation of this mod is quite simple.

Example:

Usergroup A: You assign how many 'credits' they are assigned.
Usergroup B: You assign how many 'credits' they are assigned.

Lets say you set the default 'credits' to 50 for Usergroup A
Lets say you set the default 'credits' to 100 for Usergroup B

The cost to play 1 game is 1 credit.

1 Game Play is defined when the user selects the game to play and it loads. (Not when it submits a score, as he could play, and simply not submit, thus cheating by not recording his play).

When a user selects the game he wishes to play, a check is made to see if his access level can play. If no, hes given the standard no permission page. If yes, another check is made to get the users access level credit quota, then compares it wiith how many gameplays the user has remaining. If the user has the credits, 1 will be deducted, and the game will load for play. If he has no remaining credits, he will be given the 'You have no more play credits page'. (A simple match equation).

You could create a 'Cost per Game' if you really wanted to, but in this progammers eyes, its more trouble then its actually worth. It wouldnt take much to implement this to work in that fashion.

Likewise, you could change a variable or two, to allow it to work with any of the existing 'Point Systems' which you currently have in place. I dont use any of them, but its also easily done.

This mod is more or less for those who want to offer their user a 'Premium' access level package. Each premium access level would allow them additional game play credits.

Now for the hack:

QUERIES TO BE RUN: (Dont forget to add your prefix if needed)

Code:
ALTER TABLE user ADD COLUMN totalplays smallint(5) unsigned NOT NULL default '0';

ALTER TABLE usergroup ADD COLUMN playquota smallint(5) unsigned NOT NULL default '0';
IN FILE: arcade.php FIND:

Code:
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
DIRECTLY BELOW IT ADD:

Code:
$gameplaysremaining = $permissions['playquota'] - $bbuserinfo['totalplays'];
FIND:

Code:
// ############################ PLAY PAGE ################################
if ($_GET['do']=="play") {

	// pre-cache templates used by all actions
	$globaltemplates = array(
		'ARCADE',
		'arcade_header',
		'arcade_play'
	);
	require_once('./global.php');
	require_once('./includes/functions_user.php');
	require_once('./includes/functions_arcade.php');
DIRECTLY BELOW IT ADD:

Code:
// ### PAY FOR PLAY MOD BY DECHEVIOUS - BEGIN

if ($bbuserinfo['totalplays'] > $permissions['playquota'] OR ($bbuserinfo['totalplays'] == $permissions['playquota']))
{
eval(print_standard_error('error_yourplayquotaexceeded'));
}

$addaplay = $bbuserinfo['totalplays'];
$addaplay = $addaplay + 1;
$DB_site->query("UPDATE " . TABLE_PREFIX . "user SET totalplays='$addaplay' WHERE userid = $bbuserinfo[userid]");

// ### PAY FOR PLAY MOD BY DECHEVIOUS - END
SAVE YOUR FILE - EDITS ARE COMPLETE - MOVE ONTO NEXT STEP.

IN FILE: admin/usergroup.php FIND:

Code:
'pmquota' => 0, 'pmsendmax' => 5, 'attachlimit' => 1000000,
REPLACE IT WITH:

Code:
'pmquota' => 0, 'playquota' => 0, 'pmsendmax' => 5, 'attachlimit' => 1000000,
FIND:

Code:
print_yes_no_row("Can Delete Leaderboard Scores? <dfn>Allows usergroup to delete scores and comments left by other members</dfn>", 'usergroup[candelscores]', $ug_bitfield['candelscores']);
DIRECTLY UNDER IT ADD:

Code:
print_input_row("How many Game Credits are allowed ? <dfn>You can restrict user to how many games he can play in the arcade</dfn>", 'usergroup[playquota]', $usergroup['playquota'], 1, 20);
SAVE YOUR FILE - EDITS ARE COMPLETE - MOVE ONTO NEXT STEP.

IN FILE: admin/user.php FIND:

Code:
$display = array('username' => 1, 'options' => 1, 'email' => 1, 'joindate' => 1, 'lastvisit' => 1, 'posts' => 1);
REPLACE IT WITH:

Code:
$display = array('username' => 1, 'options' => 1, 'email' => 1, 'joindate' => 1, 'lastvisit' => 1, 'posts' => 1, 'totalplays' => 1);
FIND:

Code:
$searchquery = "
		SELECT
		user.userid, reputation, username, usergroupid, birthday_search, email,
		parentemail,(options & $_USEROPTIONS[coppauser]) AS coppauser, homepage, icq, aim, yahoo, msn, signature,
		usertitle, joindate, lastvisit, lastpost, posts, ipaddress, userfield.*
		FROM " . TABLE_PREFIX . "user AS user
		LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid = user.userid)
		LEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid = user.userid)
		WHERE $condition
		ORDER BY $orderby $direction
		LIMIT $limitstart, $limitnumber
	";
REPLACE IT WITH:

Code:
$searchquery = "
		SELECT
		user.userid, reputation, username, usergroupid, birthday_search, email,
		parentemail,(options & $_USEROPTIONS[coppauser]) AS coppauser, homepage, icq, aim, yahoo, msn, signature,
		usertitle, joindate, lastvisit, lastpost, posts, totalplays, ipaddress, userfield.*
		FROM " . TABLE_PREFIX . "user AS user
		LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid = user.userid)
		LEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid = user.userid)
		WHERE $condition
		ORDER BY $orderby $direction
		LIMIT $limitstart, $limitnumber
	";
FIND:

Code:
print_input_row($vbphrase['post_count'], 'user[posts]', $user['posts']);
DIRECTLY BELOW IT ADD:

Code:
print_input_row("Total Games Played", 'user[totalplays]', $user['totalplays']);
FIND:

Code:
$user['posts'] = intval($user['posts']);
DIRECTLY BELOW IT ADD:

Code:
$user['totalplays'] = intval($user['totalplays']);
FIND:

Code:
print_yes_no_row($vbphrase['display_post_count'], 'display[posts]', 1);
DIRECTLY BELOW IT ADD:

Code:
print_yes_no_row("Total Arcade Plays", 'display[totalplays]',1);
FIND:

Code:
if ($display['posts'])
	{
		$header[] = $vbphrase['post_count'];
	}
DIRECTLY BELOW IT ADD:

Code:
if ($display['totalplays'])
	{
		$header[] = $vbphrase['total_plays'];
	}
FIND:

Code:
if ($display['posts'])
		{
			$cell[] = vb_number_format($user['posts']);
		}
DIRECTLY BELOW IT ADD:

Code:
if ($display['totalplays'])
		{
			$cell[] = vb_number_format($user['totalplays']);
		}
SAVE YOUR FILE - EDITS ARE COMPLETE - MOVE ONTO NEXT STEP.

Goto Phrase Manager, Add a Phrase.

"Front-End Error Messages"

Varname: yourplayquotaexceeded

TEXT:

Code:
You have reached the limit of arcade credits which is assigned to your usergroup. You can obtain more play credits <a href="http://whateveryouwantittogotohere.com">Here</a> or by contacting the system admin.
Add another Phrase, this time in "GLOBAL Phrases".

Varname: total_plays

TEXT: Total Games Played

IN TEMPLATE: arcade_header FIND:

Code:
|  <a href="arcade.php?do=challenges">Challenges</a> |
CHANGE IT TO: (note this line above may vary, dependant on which hacks you already have installed)

Code:
|  <a href="arcade.php?do=challenges">Challenges</a> | You can play $gameplaysremaining more Games
Save everything, upload your files, whamo, presto, changeo, your done. Now goto your admincp and assign the number of play credits each user group is allowed, and your ready to roll.

Enjoy! (Screen shots are attached)

Supporters / CoAuthors

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 01-25-2005, 10:25 PM
Dechevious Dechevious is offline
 
Join Date: Dec 2004
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by T3MEDIA
awsome huck up. SO I KNOW you have a LOT of hacks in your arcade.php it woked no problem right?
Yes I do have a large pile of them at my joint. Had no problems with this one, conflicting with any of the others, nor shall it with yours. I wrote it for the basic version, and the areas where code need to be inserted, have no other mods, thus wouldnt be conflicting.

Quote:
Originally Posted by T3MEDIA
Here is a tiny thing though. can you make your hack put them back into the usergroup they were last in. Reason. I have promotions. I dont want to assume a user was in C when they was really in A. and B is the good credits usergroup.
Sure its doable, but your now talking about a different mod. You would need to define each user on a case by case basis, and not the permissions based off an access level. Example: Is everyone who is in 'registered member' also a member of secondary group 'abc' - Starts to become a logistics issue.

Quote:
Originally Posted by T3MEDIA
I would like this hack to work off secondary groups so the priamary stays the same. that could fix my promotions issue.
however IF they are in the b group its like a bonus.
Yes, thats one way around the above issue. It can be based off of secondary access levels and the default not changed. Simple fix to that, just a matter of a variable change.

Quote:
Originally Posted by T3MEDIA
PS would be nice to have a out of credits page. that would be insane if your using paypal addicted users would really get into that.
That is already incorporated. See the thumbnail screenshots on the 1st post.
Reply With Quote
  #13  
Old 01-29-2005, 11:08 AM
Galaxy Galaxy is offline
 
Join Date: Jan 2005
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I dont know if this is just be but I can not get the $gameplaysremaining to show number of gaming points that are left can anyone help I added all the extra mod code slowly and I am sure I did it all right so can anyone think of why its not working other then I am crap at moding haha!

cheers
Reply With Quote
  #14  
Old 01-30-2005, 01:58 AM
Dechevious Dechevious is offline
 
Join Date: Dec 2004
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Galaxy
I dont know if this is just be but I can not get the $gameplaysremaining to show number of gaming points that are left can anyone help I added all the extra mod code slowly and I am sure I did it all right so can anyone think of why its not working other then I am crap at moding haha!

cheers
Fix for the problem:

IN ARCADE.PHP FIND:

Code:
$gameplaysremaining = $permissions['playquota'] - $bbuserinfo['totalplays'];
PLACE IT UNDER THE FOLLOWING CODE:

Code:
// ######################### MAIN ARCADE PAGE ############################
if ($_GET['do'] == "main") {
	// pre-cache templates used by all actions
	$globaltemplates = array(
		'ARCADE',
		'arcade_header',
		'arcade_main',
		'arcade_main_alerts',
		'arcade_main_alerts_bit',
		'arcade_main_games_bit',
		'arcade_main_news',
		'arcade_main_news_bit',
		'arcade_main_welcome'
	);
	require_once('./global.php');
	require_once('./includes/functions_user.php');
	require_once('./includes/functions_arcade.php');
Reply With Quote
  #15  
Old 01-30-2005, 02:07 AM
T3MEDIA T3MEDIA is offline
 
Join Date: Dec 2004
Posts: 944
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

for the newguys ru going to update the top file? not to stress you out or anything.

Me personally I am going to wait for the permision stuff that way this would be fully automated.

Your a better hacker than me but I got something on a site I did. It goes with the permisions and reputation. the promotions part.

I have it so if your permisons drop past x you primary is blah. and if your rep is higher your new group is Y! maybe a simple workaround like that could work.

(or each new user that starts th... nevermind issue with the old ones already there....)
Reply With Quote
  #16  
Old 02-04-2005, 02:44 PM
Galaxy Galaxy is offline
 
Join Date: Jan 2005
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am having problems with the instant access via subscription mod everytime a member logins to my forum it auto sets them as (COPPA) Users Awaiting Moderation and I have to reset them back to member

how ever the problem is there dont use any of there points but yet the mod has changed there status any how do you know of any errors???
Reply With Quote
  #17  
Old 02-04-2005, 09:45 PM
Dechevious Dechevious is offline
 
Join Date: Dec 2004
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Galaxy
I am having problems with the instant access via subscription mod everytime a member logins to my forum it auto sets them as (COPPA) Users Awaiting Moderation and I have to reset them back to member

how ever the problem is there dont use any of there points but yet the mod has changed there status any how do you know of any errors???
That error doesnt have anything to do with this mod.
Reply With Quote
  #18  
Old 02-04-2005, 10:00 PM
Galaxy Galaxy is offline
 
Join Date: Jan 2005
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

me on about the extra mod the

Updated: 01-25-2005 - The following is an 'Add On' mod which will allow you to define a default usergroup that the user will be placed into, once he has used up all of his game plays. This will remove the user from his/her 'premium' access level and place them into a 'normal' access level that you define in your usergroup manager. Further, it will reset his credit level (IE: totalplays) back to 0. In doing so, it makes it much easier for that user to resubscribe, and regain instant access via subscription.

that one I installed it and it keep reseting my accounts even if the users dont use there points up
Reply With Quote
  #19  
Old 02-05-2005, 02:22 PM
Dechevious Dechevious is offline
 
Join Date: Dec 2004
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That would occur only if you have it setup to default to that particular user group. You also want to have the original hack done and working -before- having added that 2nd hack which you make mention of.
Reply With Quote
  #20  
Old 02-15-2005, 05:13 AM
pagekeeper pagekeeper is offline
 
Join Date: Sep 2003
Location: London, UK
Posts: 82
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

is there a version for ibproarcade-vb ? im going to trial it with my current vbarcade version to see if it works well with my members, but im thinking of swapping over to iba so i was just curious.

also can i use this with ushop, if so how ?
Reply With Quote
  #21  
Old 08-25-2005, 04:34 AM
InsaneContender InsaneContender is offline
 
Join Date: May 2003
Location: Sacramento, CA
Posts: 152
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Would using this be that I could create it so that Guests could actually play like 3 games before they are required to register, and also must register to submit scores?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:08 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.04544 seconds
  • Memory Usage 2,335KB
  • Queries Executed 28 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (28)bbcode_code
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete