Jump to content

Jiraiya

Members
  • Posts

    206
  • Joined

  • Last visited

    Never

Posts posted by Jiraiya

  1. im wondering how i would go about creating a script that makes it so that players in my game can only attack other players if both players have a variable that are the same for example:

    player  A location: home  Player B location: town player A and or B can not attack each other

    Player A loation town player B location town players should be able to attack each other. what kind of script would i have to create? any tutorial sites ore example code would be nice thanks

  2. im trying to create a variable update script that changes a when they click on a link here is the code i have so far..

     

    <?php
    
    $username = $_COOKIE['ID_my_site']; 
    mysql_connect("hostname", "username", "password") or die(mysql_error());
    mysql_select_db("databasename") or die(mysql_error());
    $sql = mysql_query("SELECT * FROM users WHERE username = '$username'");
    $row = mysql_fetch_array($sql);
    {
    mysql_query("UPDATE `users` SET `location` = 'Home' WHERE username = '$username'") or die(mysql_error());
    echo '<center>You are home'.$username.'</center>';
    }else{
    echo '<center>You aren't allowed there</center>';
    }
    ?>
    
    
    
    
    
    

  3. im sorry. my question is how would i start this script? here is what i want my leveling script to do.

     

    Skill/maxskill  skill=players current skill  maxskill=skill needed to level up.

     

    i want level one is 1000/2000 so a player will need to gain 1000 skill so that his skill is equal to the maxskill variable 2000/2000 then a level up link should be shown.

    when i player does level up i need to add 1 to the players current level and then to double the maxskill so that when a player reaches level two a players max skill goes from 2000 to 4000 i want the max skill to keep doubling every time a player levels up

     

    if someone could help me get started that would be great  thanks

  4. is that right?

    
    $username = $_COOKIE['ID_my_site'];
    
    $sql = mysql_query("SELECT * FROM users WHERE username = '$username'");
    $row = mysql_fetch_array($sql);
    if($row['skill'] > 5000000){
    mysql_query("UPDATE `users` SET `village` = 'Akatsuki' WHERE username = '$username'") or die(mysql_error());
    }
    ?>

  5. i have my script thats supposed to edit one variable if only if another variable is equal to or greater then 5 million but it dosnt seem to work here is the script

     

    <?php
    
    mysql_connect("localhost", "username", "password") or die(mysql_error());
    mysql_select_db("members") or die(mysql_error());
    
    
    $sql = mysql_query("SELECT * FROM users WHERE username = '$username'");
    $row = mysql_fetch_array($sql);
    if($row['skill'] > 5000000){
    mysql_query("UPDATE `users` SET `village` = 'Akatsuki' WHERE username = '$username'") or die(mysql_error());
    }
    ?>
    
    
    

  6. im not sure whats wrong with my updating script

     

     

     

     

     

    $username = $_COOKIE['ID_my_site'];
    $sql = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error());
    if($r = mysql_fetch_assoc($sql)) {
        $skill = $r['skill'];
        if($skill >= 5000000) {
            //$rank = Akatsuki;
            //Unless Akatsuki is a constant, it should be in quotes.
            $rank = 'Akatsuki';
    
    $query = "UPDATE users rank = '$rank=Akatsuki";

  7. is this rite for updating the rank variable?

     

     

     

    $username = $_COOKIE['ID_my_site']; 
    $sql = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error());
    if($r = mysql_fetch_assoc($sql)) {
        $skill = $r['skill'];
        if($skill >= 5000000) {
            //$rank = Akatsuki;
            //Unless Akatsuki is a constant, it should be in quotes.
            $rank = 'Akatsuki';
    
    $query = "UPDATE users rank = '$rank=Akatsuki";

  8. im confused about how to write the script so that it takes a logged in users data from a table and updates one variable if another variable meets a certain requirement, i have the code below but i want to make sure its done correctly so i dont ruin my table 

     

     

     

     
    
    UPDATE users
    SET column1=value, column2=value2,...
    WHERE some_column=some_value
    
    
    if($skill >= 5000000)
    {
    $rank = Akatsuki;

  9. i need help with my script. i need it to change Variable B for a logged in user if variable A is equal to 5000000 and then to update variable B the database

     

     

     

     

     

    $username = $_COOKIE['ID_my_site'];
    $sql = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error());
    
    
    
    
    if($skill >= 5000000)
    {
    $rank = Akatsuki;
    }
    
    
    ?>

  10. yes i do mean changing a database variable but im not sure how to write the scritp here is what i have so far

     

     

    
    
    $username = $_COOKIE['ID_my_site']; 
    $sql = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error());
    
    
    
    
    if($skill >= 5000000)
    {
    $rank = Akatsuki;
    }
    
    
    ?>

  11. Im having trouble getting this data to be displayed in a table could someone help the code is below.

     

     

     

     

    // Make a MySQL Connection
    
    $query = "SELECT village, SUM(skill), SUM(health) FROM users GROUP BY village";   
    $result = mysql_query($query) or die(mysql_error());	 
    $result = mysql_query($query) or die(mysql_error());
    
    // Print out result
    while($row = mysql_fetch_array($result)){
    echo "Village  ". $row['village']. " total power: ". $row['SUM(skill)'];
    echo "Village  ". $row['village']. " total health: ". $row['SUM(health)'];
    echo "<br />";
    }
    
    
    
    
    // generate and execute query
    
    $query = "SELECT * FROM townranks  ORDER BY sk DESC";
    $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
    
    // if records present
    if (mysql_num_rows($result) > 0)
    {
    // iterate through resultset
    // print article titles
    while($row = mysql_fetch_object($result))
    {
    ?>
      <tr>
        <td><?php echo $row->townname; ?></td>
         <td><?php echo $row->hp; ?></td>
         <td><?php echo $row->sk; ?></td>
         <td><?php echo $row->kage; ?></td>
         <td><?php echo $row->people; ?></td>
      </tr>
    
    
    <table border="1">
    <tr>
    <th>Villag</th>
    <th>Health</th>
    <th>Skill</th>
    <th>Current Hokage</th>
    <th>Citizens</th>
    
    </tr>
    
    
    <?php
    }
    }
    // if no records present
    // display message
    else
    {
    ?>
    <p>No press releases currently available</p>
    
    
    
    
    <?php
    }
    
    // close database connection
    mysql_close($connection);
    ?>

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.