Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Mys v1.2.x Mods

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 05-04-2011, 01:40 PM
mapleblade mapleblade is offline
Epicness sausage
 
Join Date: May 2009
Posts: 180
Gender: Male
Credits: 25,050
mapleblade
Default slotmachine.php, the slotmachine from the levelup, but for the arcade!

Hiya there as u may have seen, ive made a slotmachine script for when u level and adoptable, that u have a chance to win prices!

Now ive made it that its an new .php file wich includes:

-Unspammable (users can only use it once a day)
-Easy customizable price gold amount



First of all, you will need to run a MYSQL Query
PHP Code:
CREATE TABLE IF NOT EXISTS `adopts_slotmachine_used` (
  `
datevarchar(30) DEFAULT NULL,
  `
usernamevarchar(50) DEFAULT NULL,
  `
ipvarchar(50) DEFAULT NULL
ENGINE=MyISAM DEFAULT CHARSET=latin1
Second: Download the slotmachine map for the images (if you dont already have it from the levelup script)

Third: Download slotmachine.php

And your done :D

EXTRA!
Now the prices seem pretty low, 20,30,50 for once a day, but here i will explain how to edit the prices.

in slotmachine.php find:
PHP Code:
if($slot1 == && $slot2 == && $slot3 == 1){ 
You will see this line under it, this is if all slots are pointed at 1
PHP Code:
$reward 20
Change that value to whatever you like to get as prize when someone gets all 1's

Example:
PHP Code:
$reward 300
Do that the same for 2 and 3, those are precisely the same as the above, and should be under this first code.

Hoep i helped :)
Attached Files
File Type: zip slotmachine.zip (1.2 KB, 112 views)
File Type: php slotmachine.php (2.6 KB, 106 views)
__________________
Need coding help? send me a PM! :)
Reply With Quote
  #2  
Old 05-04-2011, 02:15 PM
Solistia's Avatar
Solistia Solistia is offline
Member
 
Join Date: Mar 2011
Location: California
Posts: 23
Gender: Female
Credits: 4,094
Solistia is on a distinguished road
Default

This is really awesome. I do find 1 problem though. If a user lines up 2 numbers, but they're in slot 2 & 3, they don't get the match 2 prize, only match 1. Is there any way to change that?
Reply With Quote
  #3  
Old 05-04-2011, 02:20 PM
mapleblade mapleblade is offline
Epicness sausage
 
Join Date: May 2009
Posts: 180
Gender: Male
Credits: 25,050
mapleblade
Default

u have to have all 3 numbers to get a prize, that was meant to be

well, my base is coded like if slot1 =2 and slot2=2 and slot3=2 , then u will get a price, its easy to change tough. as u see this code
PHP Code:
if($slot1 == && $slot2 == && $slot3 == 1){
    
$reward 20;
    } 
You could in example change it to your likings i.e
PHP Code:
if($slot2 == && $slot3 == 1){
    
$reward 20;
    } 
this gives 20 coins when slot 2 and 3 are 1, try messing around with it, its easy :)
__________________
Need coding help? send me a PM! :)
Reply With Quote
  #4  
Old 05-04-2011, 02:27 PM
Solistia's Avatar
Solistia Solistia is offline
Member
 
Join Date: Mar 2011
Location: California
Posts: 23
Gender: Female
Credits: 4,094
Solistia is on a distinguished road
Default

ah, I see, I'll try adding some new prize numbers then :3
Thank you!
Reply With Quote
  #5  
Old 05-04-2011, 02:28 PM
mapleblade mapleblade is offline
Epicness sausage
 
Join Date: May 2009
Posts: 180
Gender: Male
Credits: 25,050
mapleblade
Default

No Problem :)
__________________
Need coding help? send me a PM! :)
Reply With Quote
  #6  
Old 05-04-2011, 02:34 PM
Solistia's Avatar
Solistia Solistia is offline
Member
 
Join Date: Mar 2011
Location: California
Posts: 23
Gender: Female
Credits: 4,094
Solistia is on a distinguished road
Default

Just in case others would like there to be a match 2 secondary prize (and just change the rewards to match your taste)
Code:
    if($slot1 == 1 && $slot2 == 1 && $slot3 == 1){
    $reward = 30;
    }elseif($slot1 == 2 && $slot2 == 2 && $slot3 == 2){
    $reward = 30;
    }elseif($slot1 == 3 && $slot2 == 3 && $slot3 == 3){
    $reward = 30;
    }elseif($slot1 == 1 && $slot2 == 1 && $slot3 == 2){
    $reward = 10;
    }elseif($slot1 == 1 && $slot2 == 1 && $slot3 == 3){
    $reward = 10;
    }elseif($slot1 == 2 && $slot2 == 1 && $slot3 == 1){
    $reward = 10;
    }elseif($slot1 == 3 && $slot2 == 1 && $slot3 == 1){
    $reward = 10;
    }elseif($slot1 == 2 && $slot2 == 2 && $slot3 == 1){
    $reward = 10;
    }elseif($slot1 == 2 && $slot2 == 2 && $slot3 == 3){
    $reward = 10;
    }elseif($slot1 == 1 && $slot2 == 2 && $slot3 == 2){
    $reward = 10;
    }elseif($slot1 == 3 && $slot2 == 2 && $slot3 == 2){
    $reward = 10;
    }elseif($slot1 == 3 && $slot2 == 3 && $slot3 == 1){
    $reward = 10;
    }elseif($slot1 == 3 && $slot2 == 3 && $slot3 == 2){
    $reward = 10;
    }elseif($slot1 == 1 && $slot2 == 3 && $slot3 == 3){
    $reward = 10;
    }elseif($slot1 == 2 && $slot2 == 3 && $slot3 == 3){
    $reward = 10;
    }else{
    $reward = 1;
    }
It's the long way I'm sure, but I'm no coder |D;;

Last edited by Solistia; 05-04-2011 at 02:37 PM.
Reply With Quote
  #7  
Old 05-04-2011, 02:54 PM
mapleblade mapleblade is offline
Epicness sausage
 
Join Date: May 2009
Posts: 180
Gender: Male
Credits: 25,050
mapleblade
Default

i am not a VERY good coder myself too, but i manage to do stuff, it looks good :)
__________________
Need coding help? send me a PM! :)
Reply With Quote
  #8  
Old 05-05-2011, 01:56 AM
fadillzzz fadillzzz is offline
Dev Staff
 
Join Date: Jan 2010
Posts: 501
Gender: Male
Credits: 37,857
fadillzzz is an unknown quantity at this point
Default

Quote:
Originally Posted by Solistia View Post
Just in case others would like there to be a match 2 secondary prize (and just change the rewards to match your taste)
Code:
    if($slot1 == 1 && $slot2 == 1 && $slot3 == 1){
    $reward = 30;
    }elseif($slot1 == 2 && $slot2 == 2 && $slot3 == 2){
    $reward = 30;
    }elseif($slot1 == 3 && $slot2 == 3 && $slot3 == 3){
    $reward = 30;
    }elseif($slot1 == 1 && $slot2 == 1 && $slot3 == 2){
    $reward = 10;
    }elseif($slot1 == 1 && $slot2 == 1 && $slot3 == 3){
    $reward = 10;
    }elseif($slot1 == 2 && $slot2 == 1 && $slot3 == 1){
    $reward = 10;
    }elseif($slot1 == 3 && $slot2 == 1 && $slot3 == 1){
    $reward = 10;
    }elseif($slot1 == 2 && $slot2 == 2 && $slot3 == 1){
    $reward = 10;
    }elseif($slot1 == 2 && $slot2 == 2 && $slot3 == 3){
    $reward = 10;
    }elseif($slot1 == 1 && $slot2 == 2 && $slot3 == 2){
    $reward = 10;
    }elseif($slot1 == 3 && $slot2 == 2 && $slot3 == 2){
    $reward = 10;
    }elseif($slot1 == 3 && $slot2 == 3 && $slot3 == 1){
    $reward = 10;
    }elseif($slot1 == 3 && $slot2 == 3 && $slot3 == 2){
    $reward = 10;
    }elseif($slot1 == 1 && $slot2 == 3 && $slot3 == 3){
    $reward = 10;
    }elseif($slot1 == 2 && $slot2 == 3 && $slot3 == 3){
    $reward = 10;
    }else{
    $reward = 1;
    }
It's the long way I'm sure, but I'm no coder |D;;
Instead of writing super long if statements like a longcat, I suggest you take advantage of array.
This is just a small example:
PHP Code:
$slot = array(1=>mt_rand(1,3), 2=>mt_rand(1,3), 3=>mt_rand(1,3));

$match count(array_unique($slot));

if (
$match === 3)
{
    
// No match. 
}
elseif (
$match === 2)
{
    
// 2 Slots match each other.
}
elseif (
$match === 1)
{
    
// All slots match each other. (i.e. jackpot! :D)

Reply With Quote
  #9  
Old 05-05-2011, 02:15 AM
mapleblade mapleblade is offline
Epicness sausage
 
Join Date: May 2009
Posts: 180
Gender: Male
Credits: 25,050
mapleblade
Default

thanks, im not that good with array, i saw some examples, but if all 3 match would be good for me xD
__________________
Need coding help? send me a PM! :)
Reply With Quote
  #10  
Old 05-05-2011, 05:46 AM
fadillzzz fadillzzz is offline
Dev Staff
 
Join Date: Jan 2010
Posts: 501
Gender: Male
Credits: 37,857
fadillzzz is an unknown quantity at this point
Default

Mapleblade, instead of comparing the variable to a number why not just compare it to each other?
PHP Code:
if($slot1 == && $slot2 == && $slot3 == 1){
    
$reward 20;
    } 

should be
PHP Code:
if($slot1 === $slot2 && $slot2 === $slot3){
    
$reward 20;
    } 
That way, you don't need to create another if statement to compare the variable to another number like 2 or 3.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with levelup in 1.3.3? Infernette Questions and Supports 1 03-25-2013 06:47 PM
Arcade Site Idea Nemesis Other Chat 8 09-01-2012 06:16 PM
Slotmachine mapleblade Mys v1.2.x Mods 17 05-11-2011 06:23 PM
help with levelup.php please Sensacionsk8 Questions and Supports 7 02-27-2011 02:44 PM
help me with levelup.php Sensacionsk8 Questions and Supports 0 02-23-2011 06:48 PM


All times are GMT -5. The time now is 08:08 PM.

Currently Active Users: 721 (0 members and 721 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636