PDA

View Full Version : Slotmachine


mapleblade
05-04-2011, 06:17 AM
hiya, my first mod in years now :P, i made a simple slotmachine for leveling up adoptables mod.

If users get 1,1,1 , they get 20 EXTRA coins,
If users get 2,2,2 , they get 30 EXTRA coins,
If users get 3,3,3 , they get 50 EXTRA coins,

SCREENSHOTS:
http://i470.photobucket.com/albums/rr61/mapleblade/slotmachine1.png
http://i470.photobucket.com/albums/rr61/mapleblade/slotmachine2.png
Okay Lets get started,

In Levelup.php

Find for:
if($isfrozen == "no"){


Directly UNDER that paste this code:

$slot1 = rand(1,3);
$slot2 = rand(1,3);
$slot3 = rand(1,3);

if($slot1 == 1 && $slot2 == 1 && $slot3 == 1){
$extrareward = 20;
}elseif($slot1 == 2 && $slot2 == 2 && $slot3 == 2){
$extrareward = 30;
}elseif($slot1 == 3 && $slot2 == 3 && $slot3 == 3){
$extrareward = 50;
}else{
$extrareward = 0;
}


if($extrareward > 1){
$rewardmessage = "Congratulations, you have gained ".$extrareward." ". grabanysetting('cost') ." because you had the slot machine right!";
}else{
$rewardmessage = "Sorry, you didnt win a prize this time, try again later.";
}


then under that code u will see:

changecash(grabanysetting('rewardmoney'), $GLOBALS['username'], $GLOBALS['money']);

REPLACE that with this code:

changecash(grabanysetting('rewardmoney')+ $extrareward, $GLOBALS['username'], $GLOBALS['money']);


now the final stuff find:

$article_content = $article_content . "<div align='center'><br />You have earned ". grabanysetting('rewardmoney') ." ". grabanysetting('cost') ." for leveling up this adoptable. <br />You now have {$GLOBALS['money']} ".grabanysetting('cost')."</div>";


And REPLACE that with:
$article_content = $article_content . "<div align='center'><br /><img src='slotmachine/".$slot1.".png'><img src='slotmachine/".$slot2.".png'><img src='slotmachine/".$slot3.".png'><br />".$rewardmessage."<br /><br />You have earned ". grabanysetting('rewardmoney') ." ". grabanysetting('cost') ." for leveling up this adoptable. <br />You now have {$GLOBALS['money']} ".grabanysetting('cost')."</div>";


Now Download the attached .zip and place the whole slotmachine map where all your php files are (root), this map is only needed for the images for the slotmachine, u can change them to whatever you like :)

Rozel
05-04-2011, 09:58 AM
Oh, this is awesome! I can't wait to try it out ^^ Maybe it'll give more reason to click pets. Thanks.

mapleblade
05-04-2011, 10:00 AM
:P, finally a comment XD, and yeah, that was wat i had in mind.

AlexC
05-04-2011, 11:23 AM
could this be edited to be put in an arcade of sorts? o: this is an awesome code!

mapleblade
05-04-2011, 11:42 AM
i think this could be editted to put in an arcade, i think it wouldnt be that hard.

AlexC
05-04-2011, 11:50 AM
my members have been requesting an arcade, I'm not sure how to really create one that awards cash... D:

mapleblade
05-04-2011, 11:52 AM
i can make u an page only for the slotmachine if you want, but remeber they may spam the page for infinite cash, or what kind of security do u want?

AlexC
05-04-2011, 11:58 AM
perhaps if it was made so that people can only win a number of times? Or only visit the page a number of times?

That would be awesome if you could do that. :D I'll send some points your way if you could~

mapleblade
05-04-2011, 12:09 PM
uhm that would require some mysql stuff etc and time and dates would be tricky, but u mean, they visit 3 times and then they can NEVER do it again?

AlexC
05-04-2011, 12:11 PM
per day. xD like the pet pages - you visit once a day, then tomorrow you can do it again. If it's too difficult, it's fine, I'll see what I can do myself.

mapleblade
05-04-2011, 12:11 PM
i can give u the php now if u want to, its just spammable by refreshing, or i can make a security that u can only use it ONCE a day nd higher the prices?

AlexC
05-04-2011, 12:16 PM
making it so they can use it once a day is fine. ^.^ Thank you very, very much!

mapleblade
05-04-2011, 12:21 PM
im almost done :), gotta make the MYSQL database for the records, and test it :)

mapleblade
05-04-2011, 12:25 PM
DONE!, should i PM the .php and the mysql query to u :)?

AlexC
05-04-2011, 12:25 PM
thank you again! :D I think this is one of the first free games on this site.

EDIT: You could post it here - then other people can use it?

mapleblade
05-04-2011, 12:29 PM
oh ill just start a new topic :), its in ur inbox btw

AlexC
05-04-2011, 12:31 PM
thank you once again. ^.^ I will test it in a bit, I'm in the middle of attempting to write. ... and reading webcomics.

Rozel
05-11-2011, 05:23 PM
The images don't seem like they're showing up :/ The url seems correct and all.