Hello there,
After some time, I finally coded a simple PHP movechar script.
Once you have entered your charname and accountname, it will verify if the row matches and will send you to the safe point of the zone where your character is in.
Actually, you can't zone in an other zone than the actual one cause I've coded it so people don't use movechar as a cheat (on my server at least).
Here's the code: This is my 2nd php script so be cool if you see a lot of newbish code errors...
Code:
<?php
$host = 'your_host.com';
$dbuser = 'user';
$dbpass = 'password';
$db = 'dbname';
$link = mysql_connect($host, $dbuser, $dbpass)
OR die(mysql_error());
if (!mysql_select_db($db, $link))
{
echo 'Unable to connect to the database.';
echo mysql_errno($link) . ": " . mysql_error($link). "\n";
exit;
}
$charname = $_POST['charname'];
$accountname = $_POST['accountname'];
$query = mysql_query("SELECT zonename FROM empire.character_ WHERE name='$charname';");
if (!$query) {
die('Could not query:' . mysql_error());
}
$find_zonename = mysql_result($query, 0);
echo "Found zone is..... :<b> $find_zonename </b> \r\n <br>";
$query2 = mysql_query("SELECT zoneid FROM character_ WHERE zonename='$find_zonename' LIMIT 1;");
if (!$query2) {
die('Could not query:' . mysql_error());
}
$find_zoneid = mysql_result($query2, 0);
$query3 = mysql_query("SELECT name FROM account WHERE charname='$charname';");
if (!$query3) {
die('Could not query:' . mysql_error());
}
$find_accountname = mysql_result($query3, 0);
$query4 = mysql_query("SELECT safe_x FROM zone WHERE zoneidnumber='$find_zoneid';");
if (!$query4) {
die('Could not query:' . mysql_error());
}
$find_safex = mysql_result($query4, 0);
$query5 = mysql_query("SELECT safe_y FROM zone WHERE zoneidnumber='$find_zoneid';");
if (!$query5) {
die('Could not query:' . mysql_error());
}
$find_safey = mysql_result($query5, 0);
$query6 = mysql_query("SELECT safe_z FROM zone WHERE zoneidnumber='$find_zoneid';");
if (!$query6) {
die('Could not query:' . mysql_error());
}
$find_safez = mysql_result($query6, 0);
if($accountname != $find_accountname)
{
echo ("Account name matched with this char ... <b> Failed! </b> \r\n <br> <b> Verify your Character's name and your's Account's name!");
mysql_close($link);
exit;
}
if($accountname = $find_accountname)
{
echo ("Account name matched with this char ... <b> Ok! </b> \r\n <br>");
$charmove = mysql_query("UPDATE character_ SET zonename='$find_zonename', zoneid='$find_zoneid', x='$find_safex', y='$find_safey', z='$find_safez' WHERE name='$charname';");
if (!$charmove) {
die('Could not query:' . mysql_error());
}
echo ("Character moved to his actual zone safe point. \r\n");
mysql_close($link);
}
?>
And a simple html form:
Code:
<HTML>
<BODY>
<FORM METHOD="post" ACTION="char.php">
Character Name : <INPUT TYPE="text" SIZE="30" NAME="charname"><BR>
Account Name : <INPUT TYPE="text" SIZE="20" NAME="accountname"><BR>
<INPUT TYPE="submit" VALUE="Envoyer" NAME="valider">
</FORM>
</BODY>
</HTML>
Installed on empire and working fine.
Mag