View Single Post
  #1  
Old 05-17-2012, 06:00 PM
AlexC's Avatar
AlexC AlexC is offline
Moderator
 
Join Date: Dec 2009
Location: Canada
Posts: 753
Gender: Unknown/Other
Credits: 69,820
AlexC is an unknown quantity at this point
Default changecash() not working

A mod I'm using, which includes a change in cash, is reporting an error;

Fatal error: Call to undefined function changecash() in /home/u973139355/public_html/slotmachine.php on line 51

The line in question is:

Code:
changecash($reward, $GLOBALS['username'], $GLOBALS['money']);
The full page;

Code:
<?php

include("functions/functions.php");

//***************//
//  START SCRIPT //
//***************//


if($isloggedin == "yes"){
// If we are logged in, we check if a user with our username voted for this adoptable today...


	

 // Adoptable is not frozen, end isfrozen else check
$act = $_GET['act'];
if($act == 'confirm'){
    $slot1 = rand(1,6);
    $slot2 = rand(1,6);
    $slot3 = rand(1,6);
    $slot4 = rand(1,6);
    $slot5 = rand(1,6);
    $slot6 = rand(1,6);
    
    if($slot1 == 1 && $slot2 == 1 && $slot3 == 1 && $slot4 == 1 && $slot5 == 1 && $slot6 == 1){
    $reward = 10;
    }elseif($slot1 == 2 && $slot2 == 2 && $slot3 == 2 && $slot4 == 1 && $slot5 == 1 && $slot6 == 1){
    $reward = 20;
    }elseif($slot1 == 3 && $slot2 == 3 && $slot3 == 3 && $slot4 == 1 && $slot5 == 1 && $slot6 == 1){
    $reward = 30;
    }elseif($slot1 == 4 && $slot2 == 4 && $slot3 == 4 && $slot4 == 4 && $slot5 == 4 && $slot6 == 4){
    $reward = 40;
    }elseif($slot1 == 5 && $slot2 == 5 && $slot3 == 5 && $slot4 == 5 && $slot5 == 5 && $slot6 == 5){
    $reward = 50;
    }elseif($slot1 == 6 && $slot2 == 6 && $slot3 == 6 && $slot4 == 6 && $slot5 == 6 && $slot6 == 6){
    $reward = 60;
    }elseif($slot1 == 1 && $slot2 == 2 && $slot3 == 3 && $slot4 == 4 && $slot5 == 5 && $slot6 == 6){
    $reward = 100;
    }else{
    $reward = 0;
    }
    
    
    if($reward > 1){
    $rewardmessage = "Congratulations, you have gained ".$reward." ". grabanysetting('cost') ."!";
    }else{
    $rewardmessage = "Sorry, you didnt win a prize this time, try again later.";
    }

    changecash($reward, $GLOBALS['username'], $GLOBALS['money']);
	$article_content = $article_content . "<div align='center'><br /><img src='".$slot1.".png'><img src='".$slot2.".png'><img src='".$slot3.".png'><br />".$rewardmessage."<br />You now have {$GLOBALS['money']} ".grabanysetting('cost')."</div>";
    
}
	

		else{

		$article_title = "Slot Machine!";
		$article_content = "Welcome at the slot machine!, here you can win various prizes!<br /><br /><a href='slotmachine.php?act=confirm'>Use the slot machine!</a>";


		}




}

else{
$article_title = "Sorry!";
$article_content = "Sorry, as a guest you cant use the slotmachine!, please register or log in.";
}


 // End the ID is not blank and is numeric else check


//***************//
//  OUTPUT PAGE  //
//***************//

echo showpage($article_title, $article_content, $date);

?>
This is a modified version of the script I found on here - it was for 1.2.x but I managed to get it working for 1.3.x before. Then somehow it got all messed up and now I'm not sure how to make it work again.
__________________
Reply With Quote