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
    New Coder cheat's Avatar
    Join Date
    Nov 2006
    Location
    England, Britain
    Posts
    74
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Special item script

    ok ive got a mafia game and it has a feature called credits which a player can buy and use for special items. this is my script.
    <?
    include_once "includes/functions.php";
    $query=mysql_query("SELECT * FROM users WHERE username='$username' LIMIT 1");
    $info = mysql_fetch_object($query);
    $query1=mysql_query("SELECT * FROM users WHERE username='$username' LIMIT 1");


    if($_POST['spend']){
    $type=$_POST['radiobutton'];
    if($type==1){
    if($info->points < 10){
    echo "You need more Credits";
    }elseif($info->points >= 10){
    $newpoints=$info->points-10;
    mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
    mysql_query("UPDATE users SET weapon='Dragunov' WHERE username='$username'");
    echo "Sucsessful";
    }}
    elseif($type==2){
    if($info->points < 10){
    echo "You need more Credits";
    }elseif($info->points >= 10){
    $newpoints=$info->points-10;
    mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
    mysql_query("UPDATE users SET protection='Armoured Limo' WHERE username='$username'");
    echo "Sucsessful";
    }}
    elseif($type==17){
    if($info->points < 10){
    echo "You need more Credits";
    }elseif($info->points >= 10){
    $newpoints=$info->points-10;
    mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
    mysql_query("UPDATE users SET health='100' WHERE username='$username'");
    echo "Sucsessful";
    }}
    elseif($type==3){
    if($info->points < 5){
    echo "You need more Credits";
    }elseif($info->points >= 5){
    $newpoints=$info->points-5;
    $newmoney1=$info->money+2500000;
    mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
    mysql_query("UPDATE users SET money='$newmoney1' WHERE username='$username'");
    echo "Sucsessful";
    }}
    elseif($type==4){
    if($info->points < 5){
    echo "You need more Credits";
    }elseif($info->points >= 5){
    $newpoints=$info->points-5;
    $newbullets1=$info->bullets+1000;
    mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
    mysql_query("UPDATE users SET bullets='$newbullets1' WHERE username='$username'");
    echo "Sucsessful";
    }}
    elseif($type==18){
    if($info->points < 1){
    echo "You need more Credits";
    }elseif($info->points >= 1){
    $newpoints=$info->points-1;
    $newhealth1=$info->health+10;
    mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
    mysql_query("UPDATE users SET health='$newhealth1' WHERE username='$username'");
    echo "Sucsessful";
    }}
    elseif($type==19){
    if($info->points < 10){
    echo "You need more Credits";
    }elseif($info->points >= 10){
    $newpoints=$info->points-10;
    $newlevel1=$info->level+1;
    mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
    mysql_query("UPDATE users SET health='$newlevel1' WHERE username='$username'");
    echo "Sucsessful";
    }}
    elseif($type==4){
    if($info->points < 1){
    echo "You need more Credits";
    }elseif($info->points >= 1){
    $newpoints=$info->points-1;
    $newbullets1=$info->health+10;
    mysql_query("UPDATE users SET points='$newhealth' WHERE username='$username'");
    mysql_query("UPDATE users SET bullets='$newhealth1' WHERE username='$username'");
    echo "Sucsessful";
    }}
    elseif($type==5){
    if($info->points < 10){
    echo "You need more Credits";
    }elseif($info->points >= 10){
    $newpoints=$info->points-10;
    mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
    mysql_query("UPDATE users SET last_oc='0' WHERE username='$username'");
    echo "Sucsessful";
    }}
    elseif($type==6){
    if($info->points < 1){
    echo "You need more Credits";
    }elseif($info->points >= 1){
    $newpoints=$info->points-1;
    mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
    mysql_query("UPDATE users SET lasttravel='0' WHERE username='$username'");
    echo "Sucsessful";
    }}
    elseif($type==7){
    if($info->points < 1){
    echo "You need more Credits";
    }elseif($info->points >= 1){
    $newpoints=$info->points-1;
    mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
    mysql_query("UPDATE users SET lastgta='0' WHERE username='$username'");
    echo "Sucsessful";
    }}
    elseif($type==15){
    if($info->points < 1){
    echo "You need more Credits";
    }elseif($info->points >= 1){
    $newpoints=$info->points-1;
    mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
    mysql_query("UPDATE users SET last_kill='0' WHERE username='$username'");
    echo "Sucsessful";
    }}
    elseif($type==8){
    if($info->points < 1){
    echo "You need more Credits";
    }elseif($info->points >= 1){
    $newpoints=$info->points-1;
    mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
    mysql_query("UPDATE users SET lastcrime='0' WHERE username='$username'");
    echo "Sucsessful";
    }}
    elseif($type==9){
    if($info->points < 90){
    echo "You need more Credits";
    }elseif($info->points >= 90){
    $newpoints=$info->points-90;
    $newrpoints=$info->rankpoints+100;
    mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
    mysql_query("UPDATE users SET rankpoints='$newrpoints' WHERE username='$username'");
    echo "Sucsessful";
    }}
    elseif($type==10){
    if($info->points < 1){
    echo "You need more Credits";
    }elseif($info->points >= 1){
    $newpoints=$info->points-1;
    mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
    mysql_query("INSERT INTO `lotto` (`id`, `owner`) VALUES ('', '$username');");
    mysql_query("INSERT INTO `lotto` (`id`, `owner`) VALUES ('', '$username');");
    mysql_query("INSERT INTO `lotto` (`id`, `owner`) VALUES ('', '$username');");
    mysql_query("INSERT INTO `lotto` (`id`, `owner`) VALUES ('', '$username');");
    mysql_query("INSERT INTO `lotto` (`id`, `owner`) VALUES ('', '$username');");
    mysql_query("INSERT INTO `lotto` (`id`, `owner`) VALUES ('', '$username');");
    mysql_query("INSERT INTO `lotto` (`id`, `owner`) VALUES ('', '$username');");
    mysql_query("INSERT INTO `lotto` (`id`, `owner`) VALUES ('', '$username');");
    mysql_query("INSERT INTO `lotto` (`id`, `owner`) VALUES ('', '$username');");
    mysql_query("INSERT INTO `lotto` (`id`, `owner`) VALUES ('', '$username');");
    echo "Sucsessful";
    }}

    elseif($type==11){
    if($info->points < 120){
    echo "You need more Credits";
    }elseif($info->points >= 120){
    $newpoints=$info->points-120;
    $newrpoints=$info->rankpoints+100;
    mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
    mysql_query("UPDATE users SET status='Dead' WHERE username='$duser2'");
    echo "Sucsessful";
    }}

    elseif($type==12){
    if($info->points < 500){
    echo "You need more Credits";
    }elseif($info->points >= 500){
    $newpoints=$info->points-500;
    $newrpoints=$info->rankpoints+100;
    mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
    mysql_query("UPDATE users SET status='Alive' WHERE username='$duser'");
    echo "Sucsessful";
    }}

    elseif($type==13){
    if($info->points < 750){
    echo "You need more Credits";
    }elseif($info->points >= 750){
    $newpoints=$info->points-750;
    $newrpoints=$info->rankpoints+100;
    mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
    mysql_query("UPDATE users SET Gender='$duser3' WHERE username='$username'");
    echo "Sucsessful";
    }}

    elseif($type==14){
    if($info->points < 1200){
    echo "You need more Credits";
    }elseif($info->points >= 1200){
    $newpoints=$info->points-1200;
    $newrpoints=$info->rankpoints+100;
    mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
    mysql_query("UPDATE users SET username='$duser4' WHERE username='$username'");
    echo "Sucsessful";
    }}
    elseif($type==16){
    if($info->points < 7){
    echo "You need more Credits";
    }elseif($info->points >= 7){
    $newpoints=$info->points-7;
    $newbackfire1=$info->backfire+200;
    mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
    mysql_query("UPDATE users SET backfire='$newbackfire1' WHERE username='$username'");
    echo "Sucsessful";
    }}


    }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>
    <body>
    after you have purchased credits please allow up to 24 hours for a admin to add the credits to your account.
    <form id="form1" name="form1" method="post" action="">

    <table width="400" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="000000">
    <tr>
    <td colspan=3 class=header><div align="center">Credits. You have <?=$info->points; ?> Credits </div></td>
    </tr>
    <tr bgcolor=white>
    <td width=6% class=tip>&nbsp;</td>
    <td width=70% class=tip><div align="center">Description</div></td>
    <td width=24% class=tip><div align="center">Price</div></td>
    </tr>
    <tr>
    <td><input name="radiobutton" type="radio" value="1" /></td>
    <td>Dragunov</td>
    <td>10 Credits </td>
    </tr>
    <tr>
    <td><input name="radiobutton" type="radio" value="2" /></td>
    <td>Armoured Limo</td>
    <td>10 Credits </td>
    </tr>
    <tr>
    <td><input name="radiobutton" type="radio" value="3" /></td>
    <td>&pound;2,500,000</td>
    <td>5 Credits</td>
    </tr>
    <tr>
    <td><input name="radiobutton" type="radio" value="4" /></td>
    <td>1000 Bullets </td>
    <td>5 Credits</td>
    </tr>
    <tr>
    <td><input name="radiobutton" type="radio" value="5" /></td>
    <td>Reset OC Timer </td>
    <td>10 Credits </td>
    </tr>
    <tr>
    <td><input name="radiobutton" type="radio" value="15" /></td>
    <td>Reset shoot Timer </td>
    <td>1 Credits </td>
    </tr>
    <tr>
    <td><input name="radiobutton" type="radio" value="6" /></td>
    <td>Reset Travel Timer</td>
    <td>1 Credits </td>
    </tr>
    <tr>
    <td><input name="radiobutton" type="radio" value="7" /></td>
    <td>Reset GTA Timer</td>
    <td>1 Credits </td>
    </tr>
    <tr>
    <td><input name="radiobutton" type="radio" value="8" /></td>
    <td>Reset Crime Timer</td>
    <td>1 Credits </td>
    </tr>
    <td><input name="radiobutton" type="radio" value="18" /></td>
    <td>10% Health Pack</td>
    <td>1 Credits</td>
    <tr>
    <td><input name="radiobutton" type="radio" value="16" /></td>
    <td>Put Backfire to 200 Bullets</td>
    <td>7 Credits </td>
    </tr>
    <tr>
    <td><input name="radiobutton" type="radio" value="9" /></td>
    <td>Move Up a Rank </td>
    <td>90 Credits </td>
    </tr>
    <tr>
    <td><input name="radiobutton" type="radio" value="17" /></td>
    <td>Restore to Full Health </td>
    <td>10 Credits </td>
    </tr>
    <tr>
    <td><input name="radiobutton" type="radio" value="19" /></td>
    <td>Go to Next GYM Level</td>
    <td>10 Credits </td>
    </tr>
    <tr>
    <td><input name="radiobutton" type="radio" value="10" /></td>
    <td>Get 10 lotto tickets </td>
    <td>1 Credits </td>
    <tr>
    <td><input name="radiobutton" type="radio" value="11" /></td>
    <td>Instance Kill Any User- Username To Kill:
    <input type="text" name="duser2" /></td>
    <td>120 Credits </td>
    </tr>
    <tr>
    <td><input name="radiobutton" type="radio" value="12" /></td>
    <td>Revive A Dead Account - Username To Revive:
    <input type="text" name="duser" /></td>
    <td>500 Credits </td>
    </tr>
    <tr>
    <td><input name="radiobutton" type="radio" value="13" /></td>
    <td>Chage Your Gender - Name Of Gender:
    <input name="duser3" type="text" id="duser3" /></td>
    <td>750 Credits </td>
    </tr>
    <tr>
    <td><input name="radiobutton" type="radio" value="14" /></td>
    <td>Chage Your Name - Username You Want:
    <input name="duser4" type="text" id="duser4"></td>
    <td>1200 Credits</td>

    </tr>
    <tr>
    <td colspan=3>

    <div align="right">
    <input name="spend" type="submit" id="spend" value="Buy!" />
    </div>
    </td>
    </tr>
    </table>
    </form><br><form method=post action=>
    <table width=508 cellspacing=0 cellpadding=0 border=1 bordercolor=black class=thinline align=center>
    <tr class=header>
    <td class=header colspan=2><div align=center>Send Credits</div></td>
    </tr><tr>
    <td><center>
    <div align="center">Username:
    <input type="text" name="to_person"> <br>
    <br>
    Ammount:
    <input type="text" size=10 name="send_amount">
    <input type="submit" name="pointsbutton" value="Send!!">

    <?
    if($_POST['pointsbutton']){
    echo "<p><center>";
    $send_amount=intval(strip_tags($_POST['send_amount']));

    $to_person = strip_tags($_POST['to_person']);
    if (!$to_person){
    echo "Please enter a username.";
    }elseif ($to_person){

    $num_true=mysql_num_rows(mysql_query("SELECT * FROM users WHERE username='$to_person'"));

    if ($num_true == 0){
    echo "No such user.";
    }elseif ($num_true != 0){

    if ($send_amount > "0"){
    if ($send_amount == 0 || !$send_amount || ereg('[^0-9]',$send_amount)){
    print "You cant send that amount.";

    }elseif ($send_amount != 0 || $send_amount || !ereg('[^0-9]',$send_amount)){



    if ($send_amount > $fetch->points){
    echo "You dont have that many Credits.";
    }elseif ($send_amount <= $fetch->points){


    if (strtolower($to_person) == strtolower($username)){
    echo "You cannot send Credits to your self";
    }elseif (strtolower($to_person) != strtolower($username)){

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





    mysql_query("UPDATE users SET points = points-$send_amount WHERE username='$username'");
    mysql_query("UPDATE users SET points = points+$send_amount WHERE username='$to_person'");





    echo "You successfully sent $send_amount Credits.";
    echo "<meta http-equiv=\"refresh\" content=\"3;URL=points.php\">";
    }
    }}}}}}


    ?>




    what i want it to do is either give the user the item or message a admin with what the player chose so that the admin can give it to the player. can someone help me with this please.

  • #2
    Regular Coder
    Join Date
    Oct 2005
    Location
    Right Here
    Posts
    654
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Good luck getting someone to go threw all of that.

  • #3
    New Coder
    Join Date
    Apr 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Honestly looks like he downloaded a game template and now wants us to customize it =p

  • #4
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    <title>Untitled Document</title>
    Must be Dreamweaver or something. :P

    I think you need to learn how to use the database better.

    }}}}}}
    This is quality.

  • #5
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    And to separate your presentation and business logic.. But in all honesty, that "script" is absolute garbage. If you created that I suggest you start again and read through some posts on these forums about code layout and building scalable applications.
    Omnis mico antequam dominus Spookster!


  •  

    Posting Permissions

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