Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Premium/Moderator - How to make Premium Membership/Moderator special features

Status
Not open for further replies.
Joined
Jan 1, 2009
Messages
384
Reaction score
20

AdriaN401MasteR - Premium/Moderator - How to make Premium Membership/Moderator special features - RaGEZONE Forums
Some of you may want to earn money from your game, show ads that only normal users (not premium) can see, and add some modules that just premium members can use..

This tutorial can be used to create a Moderator group also that can see only the pages you want them to see.

So, let's start with the easy part. The database.
We will add Moderator and Premium columns ( that's the way I want to do it, if you want to do it your way than your are free to do that ):
PHP:
ALTER TABLE `game_users` 
ADD `Premium` INT(1) NOT NULL,
ADD `Moderator` INT(1) NOT NULL

Now create a template notpremium.tpl
PHP:
<style type="text/css">
<!--
.style7 {color: #FF0000}
.style8 {
	color: #FFFF00;
	font-weight: bold;
}
-->
</style>
<br />
<table width="672" colspan="4">
<tr><td class="c" colspan="9"><center>
  <font color=red><b>Premium Membership</b></font>
</center></td></tr>
<tr>
  <th colspan="9"><p>You do not have access to this section/feature because you do not own a Premium Membership Package.</p>
    <p><a href="donate.php">For more informations, click here.</a></p>
    <p> Donating to our community is in the benefit of both sides. As we all know nothing is     free and will never be. We are currently hosting a dedicated server which we payed for a couple of months     ahead. We expect that  we can reach the necesary sum to continue this server for    our players. We offer you the chance of buying ingame utilities for this donations. You win, you get     a server and items and we get the pleasure of a growing community. </p>
    <p> </p>
    <p><br />
    </p></th>
</tr>
</table> 
</body> 
</html>
Don't complain about HTML structure :mad:

Now choose the files you want to hide from normal users. Let's say simulator.php.

At the beginning you have
PHP:
define('INSIDE'  , true);
define('INSTALL' , false);

$xnova_root_path = './';
include($xnova_root_path . 'extension.inc');
include($xnova_root_path . 'common.' . $phpEx);

if(isset($_POST['submit'])) {;

And So On
After include($xnova_root_path . 'common.' . $phpEx); or include($ugumela_root_path . 'common.' . $phpEx);, add before anything else:
PHP:
if(($user['Premium']=="")||($user['Premium']=="0")) {
$body = gettemplate('notpremium');
$page = parsetemplate($body, $parse);
display($page, $lang['Chat'], false);

}else{
And a } at the end of the file.

So you will have:
PHP:
<?php

/**
* Trinity Dev
*/

define('INSIDE'  , true);
define('INSTALL' , false);

$xnova_root_path = './';
include($xnova_root_path . 'extension.inc');
include($xnova_root_path . 'common.' . $phpEx);

if(($user['Premium']=="")||($user['Premium']=="0")) {
$body = gettemplate('notpremium');
$page = parsetemplate($body, $parse);
display($page, $lang['Chat'], false);

}else{
and a } at the end of the file.

That will show the template we created above to any users that has nothing or 0 in the Premium column. So in that template you will post a Buy A Premium Account message :closedeyes:

If you want to show this page only to mods then instead of if(($user['Premium']=="")||($user['Premium']=="0")) make it if(($user['Moderator']=="")||($user['Moderator']=="0")) or if you want to work with authleve then if($user['authlevel']>1).

You can do that on any page.

Now let's say you want to add some ads.

In the php code of the page you want to have the ads on, add:
PHP:
if(($user['Premium']=="")||($user['Premium']=="0")||($user['Moderator']=="0")||($user['Moderator']==""))
$ads="ad html code/script code / blabla";
else
$ads="";
$parse['adverts']=$ads;
And on the TPL template add {adverts} where you want the ads to be. They will appear to non-premium and non-mods.. you can also add an exception so it wont show to admins...

Anyway that's the way to do it. You can add Please Upgrade messages and anything else you want.

On my files I've also added some button so I can easely make and unmake users premium from the admin panel.. upgrade planets.. etc. Also I've added some columns to know when the user has become premium, what premium account he has, how many days and how much he paid for it...you can do that to ;).

If you need more help just post it.

Was this usefull at all?:sneaky2: Give a thank you!:wink:
 
Last edited:
Skilled Illusionist
Joined
Oct 28, 2008
Messages
379
Reaction score
47
I dont want to be flaming, but just simply hiding pages from people? Isn't that like evil :p. But the ads idea I used too myself.
Also i have the system that people buy a building from god (=admin) and for each level they have it they unlock beter buildings and ships and etc.
Though nice work ;)
 
Joined
Jan 1, 2009
Messages
384
Reaction score
20
I always wanted to change my name in Evil Adrian or something like that...

You can use it for any premium features.. but I do not need to tell you that xD.. so I won't
 
Joined
Oct 2, 2010
Messages
9
Reaction score
0
This is realy nice tutorial but i do all thinks but they didnt work. Maybe i do somethink wrong. I am big noob on this thinks. Someone help me pleas.
 
Status
Not open for further replies.
Back
Top