Apr 24, 2011 11:54 PM
(This post was last modified: Apr 25, 2011 07:32 AM by silabgarza.)
Okay right now I'm trying to make it so if a user inputs a command, it'll check a database and do the actions according to the databases numbers
Here's the java sided part (atleast my attempt of what i got so far)
Basically, what i'm trying to do is so when they type cmd:auth 95910, it will..
1) check to make sure that the auth 95910 is there
2) if it is, check if it's been used already
3) if not, check what reward they should get
4) set a string as the reward
here's a picture of the database
[img]http://i56.[censored].com/2n0izk2.jpg[/img]
explanation of all of the things
id, time, ipaddress, username, guid; not important for the current time being
authcode; the custom code only for that specific person
used; checks to see if they've claimed their reward yet
reward; an acronym of the reward they're attempting to get
summary: need someone to rewrite my command with decent stability to check the database if the auth they're trying to claim exists, then if it does exist, check if they've already claimed it or not, and if they havn't claimed, have it check what the reward is (set this to a string after checking it)
please and thank you, willing to pay $10 via paypal
msn; [email protected]
, still need this, paying $10
Here's the java sided part (atleast my attempt of what i got so far)
Code
if (command.startsWith("auth") && command.length() > 5) {
String theAuth = command.substring(5);
try {
Statement statement = con.createStatement();
String query = "SELECT * FROM votes WHERE authcode = '" + theAuth + "'";
ResultSet results = statement.executeQuery(query);
if(results.next()) {
ps.close();
ps = Database.getConnection().prepareStatement("UPDATE votes SET used = '1' WHERE authcode = ?");
ps.setString(1, playerCommand.substring(5));
ps.executeUpdate();
//givem the reward
sM("Thanks for voting for us! Enjoy your reward. Remember to vote daily!");
} else {
sM("Error! It appears this isn't a valid auth code. Please double check it. ("+theAuth+")");
}
} catch (Exception e) {
sM("Invalid format, please claim using this format. ::auth @red@authcode");
}
return;
}Basically, what i'm trying to do is so when they type cmd:auth 95910, it will..
1) check to make sure that the auth 95910 is there
2) if it is, check if it's been used already
3) if not, check what reward they should get
4) set a string as the reward
here's a picture of the database
[img]http://i56.[censored].com/2n0izk2.jpg[/img]
explanation of all of the things
id, time, ipaddress, username, guid; not important for the current time being
authcode; the custom code only for that specific person
used; checks to see if they've claimed their reward yet
reward; an acronym of the reward they're attempting to get
summary: need someone to rewrite my command with decent stability to check the database if the auth they're trying to claim exists, then if it does exist, check if they've already claimed it or not, and if they havn't claimed, have it check what the reward is (set this to a string after checking it)
please and thank you, willing to pay $10 via paypal
msn; [email protected]
, still need this, paying $10



![[Image: 0554f17a8b77a40202165c50d6e1ec51.gif]](https://i.gyazo.com/0554f17a8b77a40202165c50d6e1ec51.gif)