The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
V3Arcade - Pay for Play (Permissions Based) Details »» | |||||||||||||||||||||||||||
V3Arcade - Pay for Play (Permissions Based)
Developer Last Online: Oct 2005
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'; Code:
// ################### PRE-CACHE TEMPLATES AND DATA ###################### // get special phrase groups $phrasegroups = array(); Code:
$gameplaysremaining = $permissions['playquota'] - $bbuserinfo['totalplays']; 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'); 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 IN FILE: admin/usergroup.php FIND: Code:
'pmquota' => 0, 'pmsendmax' => 5, 'attachlimit' => 1000000, Code:
'pmquota' => 0, 'playquota' => 0, 'pmsendmax' => 5, 'attachlimit' => 1000000, 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']); 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); IN FILE: admin/user.php FIND: Code:
$display = array('username' => 1, 'options' => 1, 'email' => 1, 'joindate' => 1, 'lastvisit' => 1, 'posts' => 1); Code:
$display = array('username' => 1, 'options' => 1, 'email' => 1, 'joindate' => 1, 'lastvisit' => 1, 'posts' => 1, 'totalplays' => 1); 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 "; 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 "; Code:
print_input_row($vbphrase['post_count'], 'user[posts]', $user['posts']); Code:
print_input_row("Total Games Played", 'user[totalplays]', $user['totalplays']); Code:
$user['posts'] = intval($user['posts']); Code:
$user['totalplays'] = intval($user['totalplays']); Code:
print_yes_no_row($vbphrase['display_post_count'], 'display[posts]', 1); Code:
print_yes_no_row("Total Arcade Plays", 'display[totalplays]',1); Code:
if ($display['posts']) { $header[] = $vbphrase['post_count']; } Code:
if ($display['totalplays']) { $header[] = $vbphrase['total_plays']; } Code:
if ($display['posts']) { $cell[] = vb_number_format($user['posts']); } Code:
if ($display['totalplays']) { $cell[] = vb_number_format($user['totalplays']); } 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. Varname: total_plays TEXT: Total Games Played IN TEMPLATE: arcade_header FIND: Code:
| <a href="arcade.php?do=challenges">Challenges</a> | Code:
| <a href="arcade.php?do=challenges">Challenges</a> | You can play $gameplaysremaining more Games Enjoy! (Screen shots are attached) Supporters / CoAuthors Show Your Support
|
Comments |
#2
|
||||
|
||||
sounds interesting thanks for sharing Dechevious
|
#3
|
|||
|
|||
Quote:
|
#4
|
|||
|
|||
Sooo lets get this straight.. I am part of Usergroup b.... I run out of credits... does it put me back into usergroup again?
|
#5
|
|||
|
|||
Quote:
|
#6
|
|||
|
|||
Quote:
If I am part of Usergroup B... 100 credits. I run out. Will I go back to Usergroup A who all have 0 credits. or will I just be Usergroup B with no money. |
#7
|
|||
|
|||
Quote:
HOWEVER - Just for you my friend, I have created the following addon which which allow you to do just that! 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. This 'Add-On' assumes you have already installed the hack, as is, above. Run the following Query to set the field in your SQL DB - Dont forget to add your prefix if needed: Code:
ALTER TABLE usergroup ADD COLUMN expiretousergroupid smallint(5) unsigned NOT NULL default '0'; Code:
'pmquota' => 0, 'playquota' => 0, 'pmsendmax' => 5, 'attachlimit' => 1000000, Code:
'pmquota' => 0, 'playquota' => 0, 'expiretousergroupid' => 0, 'pmsendmax' => 5, 'attachlimit' => 1000000, Code:
print_input_row("How many Games can they Play ? <dfn>You can restrict them to how many games they can play in the arcade</dfn>", 'usergroup[playquota]', $usergroup['playquota'], 1, 20); Code:
print_chooser_row("What usergroup is assigned when all plays are used ? <dfn>This will become their new DEFAULT usergroup.</dfn>" , 'usergroup[expiretousergroupid]', 'usergroup', $usergroup['expiretousergroupid']); if (!empty($user['membergroupids'])) { $usergroupids = $user['usergroupid'] . (!empty($user['membergroupids']) ? ',' . $user['membergroupids'] : ''); print_chooser_row($vbphrase['display_usergroup'], 'user[displaygroupid]', 'usergroup', iif($user['displaygroupid'] == 0, -1, $user['displaygroupid']), $vbphrase['default'], 0, "WHERE usergroupid IN ($usergroupids)"); } $tempgroup = $user['usergroupid']; $user['usergroupid'] = 0; IN FILE: arcade.php FIND: Code:
if ($bbuserinfo['totalplays'] > $permissions['playquota'] OR ($bbuserinfo['totalplays'] == $permissions['playquota'])) { Code:
$expirestogroup = $permissions['expiretousergroupid']; $DB_site->query("UPDATE " . TABLE_PREFIX . "user SET usergroupid='$expirestogroup', totalplays=0 WHERE userid = $bbuserinfo[userid]"); Make sure you now also define the default access level the user will be placed in once his game plays are complete. I updated the usergroupmanager.gif thumbnail as well, in this post. Enjoy! |
#8
|
|||
|
|||
Is this any different that the Arcade Pass hack?
Can't the same thing be done by using that in combination with the built-in uShop action 'buy usergroup access'? |
#9
|
|||
|
|||
Quote:
I dont use the ushop to know that it is, and or is not, capable of doing what this hack does. However, if uShop can specify that a -usergroup- can play 'x' number of games, and maintain those rights, while also removing those rights when the quota has been met, then perhaps it can do similarly the same thing. You would need to ask that hacks author for those details. I've never been partial to using an external program, to work with another. I find it best to code it when needed, where needed, as needed, for the even keeled flow and operation. |
#10
|
|||
|
|||
Quote:
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. last question... can this be done never tired so I learned ask frist. Priamary is Reg user. call it A secondary is b arcade pass scondayr is c call is hummm girls on the site. see where I am getting at? 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. let me know if it can even be done. 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. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|