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!

[REVCMS] Simple little addon, random prize award script for client

xHosts.uk - Windows & Linux VPS - Cosmic Guard
[VIP] Member
Joined
Sep 10, 2011
Messages
857
Reaction score
354
Hey

I see people wanting neat little addons for RevCMS
Works with Standard PHX / GTE database

I made a simple random little prize award script, great for using on your client to reward users, easy to expand on and edit

Currently setup to award a random prize of either credits, pixels, shells (vip points) or a furni

Hope its useful for some people


ngqMinN - [REVCMS] Simple little addon, random prize award script for client - RaGEZONE Forums


Simply copy and paste the code below at the top of your client.php file and edit prizes for your own hotel


Credits :

Kryptos - Rev VMS
Me - Coding this addon
Robot - Helping test script
Katrina2015 - Helping test the script

<?php
$random = rand(95,358); // Random number range, closer the min and max more chance of winning
switch ($random){

case 98: // Credits
mysql_query("UPDATE users SET credits = credits+500 WHERE id = '".$_SESSION['user']['id']."'");
echo "<script>alert('Congratulations!, {username} You have won 500 credits');</script>";
break;

case 186: // Pixels
mysql_query("UPDATE users SET activity_points = activity_points+500 WHERE id = '".$_SESSION['user']['id']."'");
echo "<script>alert('Congratulations!, {username} You have won 500 pixels');</script>";
break;

case 356: // Points
mysql_query("UPDATE users SET vip_points = vip_points+50 WHERE id = '".$_SESSION['user']['id']."'");
echo "<script>alert('Congratulations!, {username} You have won 50 points');</script>";
break;

case 239: // furni // Furni ID 202 is throne in basic phx catalogue
mysql_query("INSERT INTO items (`user_id`, `base_item`) VALUES ('".$_SESSION['user']['id']."', 202);");
echo "<script>alert('Congratulations!, {username} You have won a rare throne');</script>";
break;
}

?>
 

Attachments

You must be registered for see attachments list
Last edited:
Retired
Joined
Apr 15, 2015
Messages
715
Reaction score
238
Nice release Johno, keep up the good work!
 
Loyalty
Loyal Member
Joined
May 4, 2012
Messages
1,763
Reaction score
884
This can however be further developed , such as having the users to click on a button , lets say "Lucky draw of the day"

Would make thing more fun yeah?


However so , good release , this is something new. Good work
 
Newbie Spellweaver
Joined
Jun 17, 2015
Messages
34
Reaction score
12
Great Release Johno thanks for this will deffo come to good use on Yablow
 
Elite Diviner
Joined
Aug 4, 2013
Messages
466
Reaction score
169
This is awesome!

Idea for anyone who would like to go about doing it - make the hotelview_promos have the option for a random vault crack and when you click the button (once every 24 hrs) it runs this script
 
Newbie Spellweaver
Joined
Aug 2, 2009
Messages
76
Reaction score
2
Great release! I will be adding this to my hotel for sure.

Is there any way you could make it so that the person receives furni instead of just coins/pixels/points?
 
Experienced Elementalist
Joined
Apr 4, 2015
Messages
237
Reaction score
88
Thanks, this is really handy. One thing, now everyone is gonna refresh the whole time the client to get prizes.


Great release! I will be adding this to my hotel for sure.

Is there any way you could make it so that the person receives furni instead of just coins/pixels/points?

Look at case 239.

case 239: // furni // Furni ID 202 is throne in basic phx catalogue

mysql_query("INSERT INTO items (`user_id`, `base_item`) VALUES ('".$_SESSION['user']['id']."', 202);");
echo "<script>alert('Congratulations!, {username} You have won a rare throne');</script>";
break;
}

?>
 
Newbie Spellweaver
Joined
Aug 2, 2009
Messages
76
Reaction score
2
Thanks, this is really handy. One thing, now everyone is gonna refresh the whole time the client to get prizes.




Look at case 239.

case 239: // furni // Furni ID 202 is throne in basic phx catalogue

mysql_query("INSERT INTO items (`user_id`, `base_item`) VALUES ('".$_SESSION['user']['id']."', 202);");
echo "<script>alert('Congratulations!, {username} You have won a rare throne');</script>";
break;
}

?>

I missed that.. Scrolled through a little too fast I guess. Now I like this even more! This is absolutely genius and a very fun thing to have on a retro. This way that one person that always wins events doesn't get everything that is released to the users. Thank you very much for this! Can't wait to see your future releases, if there will be any of course. Good luck!

Is there any way of making the users win these less or more frequently?

Oh and do you know if this will work for AzureEMU?

Sorry about all the questions, but could you make it so that there is only 1 prize every 24 hours? That would reduce refresh spam and wouldn't hurt the ECO that much.
 
Last edited:
xHosts.uk - Windows & Linux VPS - Cosmic Guard
[VIP] Member
Joined
Sep 10, 2011
Messages
857
Reaction score
354
Thanks, this is really handy. One thing, now everyone is gonna refresh the whole time the client to get prizes.




Look at case 239.

case 239: // furni // Furni ID 202 is throne in basic phx catalogue

mysql_query("INSERT INTO items (`user_id`, `base_item`) VALUES ('".$_SESSION['user']['id']."', 202);");
echo "<script>alert('Congratulations!, {username} You have won a rare throne');</script>";
break;
}

?>

I highly doubt people are actually that sad to sit refreshing the client just to win a prize.

I missed that.. Scrolled through a little too fast I guess. Now I like this even more! This is absolutely genius and a very fun thing to have on a retro. This way that one person that always wins events doesn't get everything that is released to the users. Thank you very much for this! Can't wait to see your future releases, if there will be any of course. Good luck!

Is there any way of making the users win these less or more frequently?

Oh and do you know if this will work for AzureEMU?

Sorry about all the questions, but could you make it so that there is only 1 prize every 24 hours? That would reduce refresh spam and wouldn't hurt the ECO that much.

If you change the range of the random, the smaller the range the higher chance of winning, the bigger the range the less chance of winning, I am nearly done coding a page with a button that allows 1 try per account per day.
 
Newbie Spellweaver
Joined
Aug 2, 2009
Messages
76
Reaction score
2
I highly doubt people are actually that sad to sit refreshing the client just to win a prize.



If you change the range of the random, the smaller the range the higher chance of winning, the bigger the range the less chance of winning, I am nearly done coding a page with a button that allows 1 try per account per day.

Alright thanks, will you be releasing the code for that button? If you are, please tag me on the thread. :D I'm glad to see that someone on here is still trying to keep this part of the forum alive.
 
Elite Diviner
Joined
Aug 4, 2013
Messages
466
Reaction score
169
Thanks, this is really handy. One thing, now everyone is gonna refresh the whole time the client to get prizes.
Could you not make it check for your IP and only be able to send x to each IP in the users table as current one time?
 
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,688
It's 2015 and people are still using deprecated MySQL functions in PHP.

It's been 3 Ducking years since it the deprecation was announced.
 
xHosts.uk - Windows & Linux VPS - Cosmic Guard
[VIP] Member
Joined
Sep 10, 2011
Messages
857
Reaction score
354
It's 2015 and people are still using deprecated MySQL functions in PHP.

It's been 3 Ducking years since it the deprecation was announced.

The mysql_query function is used in rev as default, we have people who are new to the community so why confuse them by using other methods, surely keeping in with the basic's of the cms is far better than just adding any old code to the cms
 
Last edited by a moderator:
Newbie Spellweaver
Joined
Aug 17, 2007
Messages
52
Reaction score
7
May i suggest using mt_rand() function instead of rand()? mt_rand is expected to be 4x faster than the rand function, as it uses the Mersene Twister algorithm.
Just a heads up, when everybody else is bitching about the use of mysql_query function >_>
 
Back
Top