elitepvpers

elitepvpers (https://www.elitepvpers.com/forum/)
-   CO2 PServer Guides & Releases (https://www.elitepvpers.com/forum/co2-pserver-guides-releases/)
-   -   [Release]Unstick Character (PHP) (https://www.elitepvpers.com/forum/co2-pserver-guides-releases/1460963-release-unstick-character-php.html)

xBlackPlagu3x 09/29/2011 18:15

[Release]Unstick Character (PHP)
 
Add this HTML code in a website
Code:

<form method="post" action="unstick.php">
<table>
<tr>
<td height="43">
Username: </td><td width="30px"></td><td><center><input type="text" name="username" value="" /></center></td>
</tr>
</table>
<input type="submit" name="submit" value="Unstick!" />
</form>

Create a file called "unstick.php"
Code:

<?php
        // MySQL Connection
        // Enter your MySQL information here
        $con = mysql_connect("localhost","root","password");
        if (!$con)
        {
                die('Could not connect: ' . mysql_error());
        }
        mysql_select_db("*YourDatabase", $con);
   
        // The lines below checks to see if the character even exists
        $obj1=mysql_query("SELECT COUNT(*ColumnForNameOfCharacter*) FROM *CharacterTable* WHERE Name='$_POST[username]'");
       
        $row = mysql_fetch_assoc($obj1);
       
        if(mysql_num_rows($obj1) > 0)
        {
                // The line below, set accounts to whatever table holds the info of where your character is in the world. Also change MapID, MapX and MapY to whatever is in your table.
               
                mysql_query("UPDATE *ChangeToCharactersTable* SET MapID = '1002', X = '250', Y = '250' WHERE *ChangeToColumnForNameOfCharacter* = '" . $_POST['username'] . "'");
        }
        else
        {
                die("Character doesn't even exist.");
        }

        mysql_close($con);
        header("location:*Change to whatever page you want to go to after the script is run. Ex: http://127.0.0.1*");
?>

What this does is that the user visits the html page right? They then enter in their in-game name. If it exists, good for them, it teleports them to a location in TC. If it doesn't, it'll tell 'em so. If you want to edit things around that's cool, but this is just a basic layout. What you MIGHT wanna do, is add some security in there because if you just add what I gave you, anyone could enter ANY accound name and have them "unstuck".

F i n c h i 09/29/2011 20:07

Useful post.
Keep up the good work mate.

xBlackPlagu3x 09/29/2011 20:31

Quote:

Originally Posted by F i n c h i (Post 13115917)
Useful post.
Keep up the good work mate.

Thanks Finchi!

BaussHacker 09/29/2011 21:13

Maybe a password check or you can teleport other players ^^

NotEnoughForYou 09/29/2011 21:14

sql injection is possibel, also you can unstuck other charakters

devilsmum 09/29/2011 21:40

Its a good basis. The ideal way to do it is to have a login system on the website and have the unstuck option in the user page. So only people with the user and password could unstuck a char. Then ofc you would want to do map checks to check if the user is in botjail etc.

xBlackPlagu3x 09/30/2011 06:06

Quote:

Originally Posted by xBlackPlagu3x
What this does is that the user visits the html page right? They then enter in their in-game name. If it exists, good for them, it teleports them to a location in TC. If it doesn't, it'll tell 'em so. If you want to edit things around that's cool, but this is just a basic layout. What you MIGHT wanna do, is add some security in there because if you just add what I gave you, anyone could enter ANY accound name and have them "unstuck".

I believe I said something like that. Also as I said this is just a basic layout of what you could do. I personally implemented my idea into a character login panel, it's up to the people who use this to figure it out.

pwerty 09/30/2011 11:55

code server w/o characters be able to stuck.

xBlackPlagu3x 09/30/2011 21:38

Quote:

Originally Posted by pwerty (Post 13121468)
code server w/o characters be able to stuck.

That would be a really good idea lol but some people just don't have that kind of talent. Luckily, I've never had that problem but I know a lot of people (Especially when using TQ binaries) who have.

BaussHacker 09/30/2011 22:13

I don't even get how you can get stuck in the first place.

F i n c h i 09/30/2011 22:17

Quote:

Originally Posted by BaussHacker (Post 13131329)
I don't even get how you can get stuck in the first place.

You would get stuck if you'd try to swim in bird island.
:mofo:

BaussHacker 09/30/2011 22:23

Quote:

Originally Posted by F i n c h i (Post 13131389)
You would get stuck if you'd try to swim in bird island.
:mofo:

Oh stuck like that. I thought it was like others. Pfft, if people can't avoid that in a source, then they shouldn't even run a server. :D

xBlackPlagu3x 10/03/2011 03:12

Quote:

Originally Posted by BaussHacker (Post 13131483)
Oh stuck like that. I thought it was like others. Pfft, if people can't avoid that in a source, then they shouldn't even run a server. :D

Seriously, right? Of if you at least have it in your source, you could at least make an attempt to fix it. Ferserious.


All times are GMT +2. The time now is 16:49.

Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.