Jump to content

IAmFoxx

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

IAmFoxx's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry if the title is confusing, I'm not really sure how to explain my problem (also sorry for such a long topic!) Basically for my SMF forum I have the arcade and award system mods installed and I thought I could make a bridge type thing between them where if the user gets a specific score they get given an award automatically. The script I wrote checks the scores to the SMF users ID then inserts an award to the database. The first award I wrote a bit of code for worked fine and the award was given, but then as I added code for another, it would not show up unless the code for any of the awards above it had been satisfied. Currently I have 3 awards, one is to simply log in, which works fine, the I have one for scoring 3000 points in space invaders and 1000 in another game. During my tests I received the login award and I had gotten a score of over 1000 in the other game, but I didn't get the award given, then once I got the 3000 score I was given both. I have no idea why this is happening, I've changed things around putting different checks at the top and the same thing happens the values must be done in the order the checks are or nothing is shown. This is my code for doing the checks: (All the database connections and defining functions are done above this) //Award: Friend! - Log In. ;; 1 Point //This award relies on the function above which exits the script before it executes if a guest is online. //Check they already have the award. $gottenFriend = mysql_num_rows(mysql_query("SELECT * FROM award_leaders WHERE id_member='$usr' AND award='Friend!'")) or die(mysql_error()); //If no, give them it. if($gottenFriend == 0){ SWGiveAward("1","Friend!","Log in! (1P)"); //Insert the award to SMF. mysql_query("INSERT INTO smf_awards (ID_AWARDED_MEMBER,title,givenDate,ID_MEMBER,memberName,filename) VALUES ('$currentUser','Friend!','$time','1','Foxx','$bronze_file')"); //Insert award into recordbase to avoid dupes mysql_query("INSERT INTO award_leaders (id_member,award,points,date) VALUES ('$currentUser','Friend!','1','$now')"); //Update Leaderboard db with new points. mysql_query("UPDATE leaderboard SET points=points+'1' WHERE member_id='$currentUser'"); } //To be safe add new awards here. //Award: Backwards Compatible - Score over 3000 in a single game of Space Invaiders ;; 25 Points //Check they meet the requirements - 3000 points or more. $invade_check = mysql_query("SELECT * FROM smf_arcade_scores WHERE id_game=32 AND id_member='$usr' AND score >=3000") or die(mysql_error()); $invade_check = mysql_num_rows($invade_check) or die(mysql_error()); //Check they haven't already gotten it $gottenBack = mysql_num_rows(mysql_query("SELECT * FROM award_leaders WHERE id_member='$usr' AND award='Backwards Compatible'")) or die(mysql_error()); //If both conditions are good, show em the iframe and put the award into the database, along with scores. if($invade_check > 0 AND $gottenBack == 0){ SWGiveAward("1","Backwards Compatible","Score over 3000 in a game of Space Invaders (25P)"); //Insert the award to SMF. mysql_query("INSERT INTO smf_awards (ID_AWARDED_MEMBER,title,givenDate,ID_MEMBER,memberName,filename) VALUES ('$currentUser','Backwards Compatible','$time','1','Foxx','$bronze_file')"); //Insert award into recordbase to avoid dupes mysql_query("INSERT INTO award_leaders (id_member,award,points,date) VALUES ('$currentUser','Backwards Compatible','25','$now')"); //Update Leaderboard db with new points. mysql_query("UPDATE leaderboard SET points=points+'25' WHERE member_id='$currentUser'"); } //Check they meet the requirements - 1000 points or more. $l2f_check = mysql_query("SELECT * FROM smf_arcade_scores WHERE id_game=5 AND id_member='$usr' AND score >=1000"); $l2f_check = mysql_num_rows($l2f_check) or die(mysql_error()); //Check they haven't already gotten it $gottenFly = mysql_num_rows(mysql_query("SELECT * FROM award_leaders WHERE id_member='$usr' AND award='Learn to Fly'")); //If both conditions are good, show em the iframe and put the award into the database, along with scores. if($l2f_check > 0 AND $gottenFly == 0){ SWGiveAward("1","Learn to Fly","Send a Penguin over 1000M on Bloodypingu (25P)"); //Insert the award to SMF. mysql_query("INSERT INTO smf_awards (ID_AWARDED_MEMBER,title,givenDate,ID_MEMBER,memberName,filename) VALUES ('$currentUser','Learn to Fly','$time','1','Foxx','$bronze_file')"); //Insert award into recordbase to avoid dupes mysql_query("INSERT INTO award_leaders (id_member,award,points,date) VALUES ('$currentUser','Learn to Fly','25','$now')"); //Update Leaderboard db with new points. mysql_query("UPDATE leaderboard SET points=points+'25' WHERE member_id='$currentUser'"); } I've never done anything like this before so if my code is bad I apologise! Thanks!
  2. IAmFoxx

    Hey!

    Im Mark, I've known the basic stuff to PHP for a while now but I've never done anything crazy complex, thought now would be a good start as I'm on a Games Dev course and we're currently doing web design
×
×
  • 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.