Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Banned
    Join Date
    Dec 2006
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Random % Problems

    hi basicly im building on a mafia RPG game

    and on my crime script it looks like this
    http://i18.tinypic.com/4mrxix4.jpg

    all my %'s are random im wanting the layout to look liek the bottom one and for the % chance to be lower on the higher payout crime
    so on mine the 1st option would be the highest % and then goes down in % as each crime pays higher

    could anyone help me.heres my whole crime.php code
    also msn: lethal_s65@hotmail.co.uk if anyone is interested in doing any work free for me would be gladly appreciated

    PHP Code:
    <?php
    session_start
    ();
    include_once 
    "includes/db_connect.php";
    include_once 
    "includes/functions.php";
    include_once 
    "includes/jail_check.php";
    include_once
    "probe.php";
    $page="crime.php";

    script_check($page); 


    $fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));

    $username=$_SESSION['username'];
    $radiobutton=$_POST['radiobutton'];
    $above mysql_query("SELECT * FROM users WHERE username='$username'");
    $info mysql_fetch_object($above);
    $chance explode("-"$info->crimechance);


    if (
    $info->lastcrime time()){
    $left $info->lastcrime time();
    echo 
    "Slow down you wil break your mouse, you have done a crime latley,you have to wait for $left seconds!";
    exit();
    }


    if (
    $_POST['submit']){

    $suc $chance[$radiobutton];
    $ran rand(1,100);

        
        if (
    $ran <= $suc){
        

    if (
    $radiobutton == "0"){
      
    $win rand(100,200);
      
    $success $chance[0];
      
    $quote="Your Street Mugging was Successfull.";
    }elseif (
    $radiobutton == "1"){
      
    $win rand(20,40);
      
    $success $chance[1];
      
    $quote="Loose Pockets Pay Money";
      
    }elseif (
    $radiobutton == "2"){
      
    $win rand(500,1000);
      
    $success $chance[2];
      
    $quote="Your Credit Card was not Tracked";
    }elseif (
    $radiobutton == "3"){
      
    $win rand(1000,2000);
      
    $success $chance[3];
      
    $quote="Lotting was Successfull";
    }elseif (
    $radiobutton == "4"){
      
    $win rand(2000,4000);
      
    $success $chance[4];
      
    $quote="You Were Successfull";
    }elseif (
    $radiobutton == "5"){
      
    $win rand(4000,10000);
      
    $success $chance[5];
      
    $quote="Your Transaction was Successfull";
    }elseif (
    $radiobutton == "6"){
      
    $win rand(9000,10000);
      
    $success $chance[6];
      
    $quote="You did it successfully!!";
    $item_rand rand(1,100);
    }
    $new_item = array('Weed seeds','Bandanna','Black boots','Bling','Chain','Yellow Pages','Tracking Device','Cheese Burger','Fries','Chicken Nuggets','Crisps','Curry','Fish');
    $rand_item rand(0,12);
    $item_get=$new_item[$rand_item];
    if (
    $item_rand >= "90"){

    if (
    $item_get == "Weed seeds"){
    $value="4000";
    }elseif (
    $item_get == "Bandanna"){
    $value="500";
    }elseif (
    $item_get == "Black boots"){
    $value="300";
    }elseif (
    $item_get == "Bling"){
    $value="3000";
    }elseif (
    $item_get == "Chain"){
    $value="3000";
    }elseif (
    $item_get == "Yellow Pages"){
    $value="10000";
    }elseif (
    $item_get == "Tracking Device"){
    $value="20000";
    }elseif (
    $item_get == "Cheese Burger"){
    $value="200";
    }elseif (
    $item_get == "Fries"){
    $value="110";
    }elseif (
    $item_get == "Chicken Nuggets"){
    $value="180";
    }elseif (
    $item_get == "Crisps"){
    $value="100";
    }elseif (
    $item_get == "Curry"){
    $value="500";
    }elseif (
    $item_get == "Fish"){
    $value="250";
    }




    echo 
    "Congratulations, you smashed open the safe and you got away with $item_get";
    mysql_query("INSERT INTO `items` ( `id` , `item` , `value`,`owner` ) 
    VALUES (
    '', '$item_get', '$value','$username'
    )"
    );

    }else{
    echo 
    "$quote Congratulations ! you got away with ï¿½$win!!";
    rankcheck();
    $timetime() + 120;
    $newrank=rand(1,10);


    $n_money=$info->money+$win;

    $new_rank=$info->rankpoints rand(4,10);
    mysql_query("UPDATE users SET money='$n_money', rankpoints='$new_rank' WHERE username='$username'");
    mysql_query("UPDATE user_info SET crimes=crimes+1 WHERE username='$username'");
    }



      }else{
      if (
    $radiobutton == "0"){
      
    $quote="Your Came away with Bruises";
    }elseif (
    $radiobutton == "1"){
    $quote="You was too heavy handed";
    }elseif (
    $radiobutton == "2"){

      
    $quote="The Credit Card was Tracked";
    }elseif (
    $radiobutton == "3"){

      
    $quote="Unlucky the Police was everywhere";
    }elseif (
    $radiobutton == "4"){

      
    $quote="The Bank CLosed Before you Got there";
    }elseif (
    $radiobutton == "5"){

      
    $quote="Un-Successfull The Kid Escaped";
    }elseif (
    $radiobutton == "6"){
      
    $quote="You did not do the crime suscessfully";
    }
    rankcheck();



    echo 
    "$quote Bad luck, you got away with nothing!";
    $new_rank $info->rankpoints rand(1,5);
    mysql_query("UPDATE users SET rankpoints='$new_rank' WHERE username='$username'");
     
    mysql_query("UPDATE user_info SET crimes=crimes+1 WHERE username='$username'"); 
    $reason "Crime";
    require_once
    "includes/failed.php";
    }

    if(
    $chance[0] == 1){$chance[1] = 1;}
        elseif((
    $chance[0] >= 1) && ($chance[0] <= 2)){$chance[0] = rand(1,$chance[0]);}
        elseif((
    $chance[0] >= 2) && ($chance[0] <= 10)){$chance[0] = rand(10,$chance[0]);}
        elseif((
    $chance[0] >= 5) && ($chance[0] <= 25)){$chance[0] = rand(25,$chance[0]);}
        elseif((
    $chance[0] >= 18) && ($chance[0] <= 36)){$chance[0] = rand(36,$chance[0]);}
        elseif((
    $chance[0] >= 25) && ($chance[0] <= 49)){$chance[0] = rand(49,$chance[0]);}
            elseif((
    $chance[0] >= 36) && ($chance[0] <= 58)){$chance[0] = rand(58,$chance[0]);}
            elseif((
    $chance[0] >= 49) && ($chance[0] <= 55)){$chance[0] = rand(55,$chance[0]);}
        elseif(
    $chance[0] >= 55){$chance[0] = rand(55,$chance[0]);}
        

        if(
    $chance[0] == 1){$chance[1] = 0;}
        elseif((
    $chance[0] >= 1) && ($chance[0] <= 2)){$chance[1] = rand(0,$chance[0]);}
        elseif((
    $chance[0] >= 3) && ($chance[0] <= 8)){$chance[1] = rand(7,$chance[0]);}
        elseif((
    $chance[0] >= 9) && ($chance[0] <= 15)){$chance[1] = rand(14,$chance[0]);}
        elseif((
    $chance[0] >= 16) && ($chance[0] <= 34)){$chance[1] = rand(33,$chance[0]);}
        elseif((
    $chance[0] >= 35) && ($chance[0] <= 74)){$chance[1] = rand(45,$chance[0]);}
        elseif(
    $chance[0] >= 75){$chance[1] = rand(50,$chance[0]);}

        if(
    $chance[0] == 1){$chance[2] = 0;}
        elseif((
    $chance[0] >= 1) && ($chance[0] <= 2)){$chance[2] = rand(0,$chance[0]);}
        elseif((
    $chance[0] >= 3) && ($chance[0] <= 8)){$chance[2] = rand(6,$chance[0]);}
        elseif((
    $chance[0] >= 9) && ($chance[0] <= 15)){$chance[2] = rand(13,$chance[0]);}
        elseif((
    $chance[0] >= 16) && ($chance[0] <= 34)){$chance[2] = rand(32,$chance[0]);}
        elseif((
    $chance[0] >= 35) && ($chance[0] <= 74)){$chance[2] = rand(60,$chance[0]);}
        elseif(
    $chance[0] >= 75){$chance[2] = rand(85,$chance[0]);}

        if(
    $chance[0] == 1){$chance[3] = 0;}
        elseif((
    $chance[0] >= 1) && ($chance[0] <= 2)){$chance[3] = rand(0,$chance[0]);}
        elseif((
    $chance[0] >= 3) && ($chance[0] <= 9)){$chance[3] = rand(7,$chance[0]);}
        elseif((
    $chance[0] >= 10) && ($chance[0] <= 17)){$chance[3] = rand(14,$chance[0]);}
        elseif((
    $chance[0] >= 18) && ($chance[0] <= 37)){$chance[3] = rand(35,$chance[0]);}
        elseif((
    $chance[0] >= 38) && ($chance[0] <= 76)){$chance[3] = rand(60,$chance[0]);}
        elseif(
    $chance[0] >= 77){$chance[3] = rand(70,$chance[0]);}
    //echo
        
    if($chance[0] == 1){$chance[4] = 0;}
        elseif((
    $chance[0] >= 1) && ($chance[0] <= 3)){$chance[4] = rand(0,$chance[0]);}
        elseif((
    $chance[0] >= 4) && ($chance[0] <= 11)){$chance[4] = rand(9,$chance[0]);}
        elseif((
    $chance[0] >= 12) && ($chance[0] <= 19)){$chance[4] = rand(16,$chance[0])-14;}
        elseif((
    $chance[0] >= 20) && ($chance[0] <= 39)){$chance[4] = rand(28,$chance[0])-14;}
        elseif((
    $chance[0] >= 40) && ($chance[0] <= 79)){$chance[4] = rand(69,$chance[0])-14;}
        elseif(
    $chance[0] >= 80){$chance[4] = rand(75,$chance[0])-14;}
            
        
    //echo
        
    if($chance[0] == 1){$chance[5] = 0;}
        elseif((
    $chance[0] >= 1) && ($chance[0] <= 3)){$chance[5] = rand(0,$chance[0]);}
        elseif((
    $chance[0] >= 4) && ($chance[0] <= 11)){$chance[5] = rand(9,$chance[0]);}
        elseif((
    $chance[0] >= 12) && ($chance[0] <= 19)){$chance[5] = rand(16,$chance[0])-14;}
        elseif((
    $chance[0] >= 20) && ($chance[0] <= 39)){$chance[5] = rand(28,$chance[0])-14;}
        elseif((
    $chance[0] >= 40) && ($chance[0] <= 79)){$chance[5] = rand(69,$chance[0])-14;}
        elseif(
    $chance[0] >= 80){$chance[5] = rand(75,$chance[0])-14;}
            
        
    //echo
        
    if($chance[0] == 1){$chance[6] = 0;}
        elseif((
    $chance[0] >= 1) && ($chance[0] <= 3)){$chance[6] = rand(0,$chance[0]);}
        elseif((
    $chance[0] >= 4) && ($chance[0] <= 11)){$chance[6] = rand(9,$chance[0]);}
        elseif((
    $chance[0] >= 12) && ($chance[0] <= 19)){$chance[6] = rand(16,$chance[0])-14;}
        elseif((
    $chance[0] >= 20) && ($chance[0] <= 39)){$chance[6] = rand(28,$chance[0])-14;}
        elseif((
    $chance[0] >= 40) && ($chance[0] <= 79)){$chance[6] = rand(69,$chance[0])-14;}
        elseif(
    $chance[0] >= 80){$chance[6] = rand(75,$chance[0])-14;}
        
    if(
    $chance[0] > 100){
            
    $chance[0] = 100;
        }    
        if(
    $chance[1] > 100){
            
    $chance[1] = 100;
        }    
        if(
    $chance[2] > 100){
            
    $chance[2] = 100;
        }    
        if(
    $chance[3] > 100){
            
    $chance[3] = 100;
        }
        if(
    $chance[4] > 100){
            
    $chance[4] = 100;
        }    
        if(
    $chance[5] > 100){
            
    $chance[5] = 100;
        }    
            if(
    $chance[6] > 100){
            
    $chance[6] = 100;
        }    

        
        
    $chance[0]++;
        if (
    $chance[0] > 110){
            
    $chance[0] = 110;
        }

    $arrayrates = array($chance[0], $chance[1], $chance[2], $chance[3], $chance[4], $chance[5], $chance[6]);
        
    $newrates implode("-"$arrayrates);
        
    $tim time() + rand(60,200);
        
    mysql_query("UPDATE users SET crimechance='$newrates',lastcrime='$tim' WHERE username='$username'");
            exit;



    }

    ?>






    <html><head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel=stylesheet href=includes/in.css type=text/css>
    </head>


    <center> <body> 
    <form name="form1" method="post" action="">

      <table width="53%" height="127" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor=black class=thinline>
        <!--DWLayoutTable-->
        <tr> 
          <td colspan="3" background="includes/grad.jpg"><center>
              <strong>Crimes</strong> </center></td>
        </tr>


    <tr>
    <td colspan="2">
    <img src="images/crime.gif" border="0">
    </td>
    </tr>

        <tr> 
          <td width="67%" height="9" valign="top"  background="http://i1.tinypic.com/21opx91.jpg"> <input type="radio" name="radiobutton" value="0" onClick="this.document.img.src='images/crimes/phone_boy.jpg'">
            <font color="black"><b>Do a Street Mugg</td>
          <td width="33%" valign="top" background="http://i1.tinypic.com/21opx91.jpg"><font color="black"><b><?php echo "$chance[0]"?>&nbsp;<b>%</td>
        </tr>
        <tr> 
          <td height="17" valign="top" background="http://i1.tinypic.com/21opx91.jpg"><input type="radio" name="radiobutton" value="1" onClick="this.document.img.src='images/crimes/coffee.jpg'">
            <font color="black"><b> Pickpocket Someone</td>
          <td width="33%" valign="top" background="http://i1.tinypic.com/21opx91.jpg"><font color="black"><b><?php echo "$chance[1]"?><b>%</td>
        </tr>
        <tr> 
          <td height="4" valign="top"  background="http://i1.tinypic.com/21opx91.jpg"> <input type="radio" name="radiobutton" value="2" onClick="this.document.img.src='images/crimes/old_lady.jpg'">
            <font color="black"><b>Commit Credit Card Fraud</td>
          <td width="33%" valign="top" background="http://i1.tinypic.com/21opx91.jpg"><font color="black"><b><?php echo "$chance[2]"?><b>%</td>
        </tr>
        <tr> 
          <td height="4" valign="top"  background="http://i1.tinypic.com/21opx91.jpg"> <input type="radio" name="radiobutton" value="3" onClick="this.document.img.src='images/crimes/tesco.jpg'">
            <font color="black"><b>Drive-By Looting</td>
          <td width="33%" valign="top" background="http://i1.tinypic.com/21opx91.jpg"><font color="black"><b><?php echo "$chance[3]"?><b>%</td>
        </tr>
        <tr> 
          <td height="4" valign="top"  background="http://i1.tinypic.com/21opx91.jpg"><input type="radio" name="radiobutton" value="4" onClick="this.document.img.src='images/crimes/***.jpg'">
            <font color="black"><b>Rob a Bank</td>
          <td width="33%" valign="top" background="http://i1.tinypic.com/21opx91.jpg"><font color="black"><b><?php echo "$chance[4]"?><b>%</td>
        </tr>
        <tr> 
          <td height="4" valign="top"  background="http://i1.tinypic.com/21opx91.jpg"> <input type="radio" name="radiobutton" value="5" onClick="this.document.img.src='images/crimes/bank_vault.jpg'">
            <font color="black"><b>Kidnap Someone</td>
          <td width="33%" valign="top" background="http://i1.tinypic.com/21opx91.jpg"><font color="black"><b><?php echo "$chance[5]"?><b>%</td>
          
        </tr>
           <tr> 
          <td height="4" valign="top"  background="http://i1.tinypic.com/21opx91.jpg"> <input type="radio" name="radiobutton" value="6" onClick="this.document.img.src='images/crimes/bank_vault.jpg'">
            <font color="black"><b><?php
          
    if($fetch->location == "England") { echo "Steal from a phonebox"; }
    if(
    $fetch->location == "Japan") { echo "hijack a bullet train"; }
    if(
    $fetch->location == "Colombia") { echo "Steal some cocaine"; }
    if(
    $fetch->location == "Usa") { echo "Rob burgerking"; }
    if(
    $fetch->location == "South Africa") { echo "Steal a tiger"; }
    if(
    $fetch->location == "Mexico") { echo "Hold up a salsa bar"; }
    ?></td>
    <td width="33%" valign="top" background="http://i1.tinypic.com/21opx91.jpg"><font color="black"><b><?php echo "$chance[2]"?><b>%</td>
          
        </tr>
    <tr> 

       <td width="33%" valign="top" background="http://i1.tinypic.com/21opx91.jpg" colspan="2"> <center><input name="submit" type="submit" id="submit" value="Commit A Crime"> 
          </td>
        </tr>
      </table>

    </form>
    </html>

  • #2
    New Coder cheat's Avatar
    Join Date
    Nov 2006
    Location
    England, Britain
    Posts
    74
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ive seen that script before can i ask where you bought it.

  • #3
    Banned
    Join Date
    Dec 2006
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    dont need to buy it mate can download it anywhere lol

  • #4
    Banned
    Join Date
    Dec 2006
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #5
    Banned
    Join Date
    Dec 2006
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i fixed this


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •