This is a auto voting tutorial without MySQL, every revision and calling back RsPsCoding to check if someone actuelly voted. I am not sad so this also works for the other communities.
Server Sided
474 Server Sided
Spoiler for 474:
Declare this code in src > server > model > players > client.java
Code:
public void checkVote(String playerName, String IP) {
try {
String urlString = "http://www.rspscoding.biz/check_vote/call_back.php?ip="+IP+"&id="+serverid+"";
int serverid = 1;
int vote_item = 995;
int vote_item_amount = 20000000;
urlString = urlString.replaceAll(" ", "_");
URL url = new URL(urlString);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String results = reader.readLine();
if(results.length() > 0) {
if(results.equals(serverid) && checkVote2(playerName) == true) {
c.getItems().addItem(vote_item, vote_item_amount);
} else {
c.sendMessage"Our system couldn't find your vote, you might not have voted yet.");
}
}
} catch (MalformedURLException e) {
System.out.println("Error checking a vote on RsPsCodig.");
} catch (IOException e) {
System.out.println("Error checking a vote on RsPsCodig.");
}
}
public boolean checkVote2(String playerName) {
try {
String urlString = "http://www.domain.com/check_vote.php?username="+playerName+"&auth=JFHDJ484F";
urlString = urlString.replaceAll(" ", "_");
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String results = reader.readLine();
if(results.length() > 0) {
if(results.equals("true")) {
return true;
}
}
} catch (MalformedURLException e) {
//System.out.println("Error in vote check.");
} catch (IOException e) {
//System.out.println("Error in vote check.");
}
return false;
}
In src > server > model > players > packets > Commands.java add the following command "::claim / ::redeem".
Change the auth code to the auth code you add website sided and the server ID declared as "int serverid = 1;" to your own ID, for example is ID 1 "TkoScape".
Change the domain name / path / url to yours, remember the action and username which are readed by the GET method in PHP need to be exactly correct.
Wesite Sided
Upload the files attached in the attachement of this message to your webhost, the files can be downloaded below.
Change the auth code website sided but also server sided, add the map "database" with the maps "vote" and "ip" in the map of your "vote.php" is uploaded in.
If you cannot download the files you can read them below. If you have downloaded the files and changed the details server and website expecially in "vote.html" the RsPsCoding, RuneLocus and Rune-Server vote URL.
<style>
* {
color: #ffffff;
}
</style>
<br><br><br><br><br><br><br><br><center style="font-family: Arial;"><h1>Please click on the button RsPsCoding, RuneLocus or Rune-Server!</h1><br><h3>Copyright &copy; RsPsCoding - Call Vote Back Project.</h3></center>
disabled.html
Code:
<html>
<head>
<title>Disabled, go back and vote</title>
<style>
* {
font-family: Arial;
}
</style>
</head>
<body>
<br><br>
<h1 align="center">You didn't vote on all sites yet, go back and vote.</h1>
</body>
If you have questions on doing this you can post it in my PM or in this topic. If any errors occur please report them to me I wrote this out of my head without testing on 2:00 night.
This is especially made for RsPsCoding server purposes but also for RuneLocus and Rune-Server.
Warning: fopen(database/vote/ip/92.29.114.39-12-08-11.txt) [function.fopen]: failed to open stream: No such file or directory in /home/rhokib11/public_html/vote/vote.php on line 9
Dude, learn yourself, it took me 17 months of continuous research to learn how to import a project.
Originally Posted by Pollution
When? And Idiot, I'm using a oldschool, it's not easy to get the command for an oldschool, retard c u.
Originally Posted by Waj_Assif
I sayin u dont contribute never aall u do is finna tryin attack ppl and always finna start fights .......
Originally Posted by Kris
You must be one of those slower breeds.
Originally Posted by Gandalf
Just piss off ploter hacker fella dumb fuck. Your a donor to a rsps community, I'm a Mainowner to a Private Server thats 7+ Years old. Lmfao kid, get a life. Don't let my name come out of your mouth again. Or it wont end nicely for you. Understand me big boy?
Originally Posted by Tojad
What do you know about Public Void and int without this [] is only 1 integer, why?
src\server\model\players\Client.java:553: int cannot be dereferenced
String results = reader.readLine();
^
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Press any key to continue . . .
Code:
src\server\model\players\Client.java:552: int cannot be dereferenced
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(
)));
^
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Press any key to continue . . .
i've already tried fixing it but i couldnt quite manage doing that
src\server\model\players\Client.java:553: int cannot be dereferenced
String results = reader.readLine();
^
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Press any key to continue . . .
Code:
src\server\model\players\Client.java:552: int cannot be dereferenced
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(
)));
^
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Press any key to continue . . .
i've already tried fixing it but i couldnt quite manage doing that