Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Dekaron > Dekaron Private Server
You last visited: Today at 23:39

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release] PHP Reborn Script

Discussion on [Release] PHP Reborn Script within the Dekaron Private Server forum part of the Dekaron category.

Reply
 
Old   #1
 
janvier123's Avatar
 
elite*gold: 20
Join Date: Nov 2007
Posts: 2,854
Received Thanks: 1,891
[Release] PHP Reborn Script

Hi,

zombe and me where working on a reborn script for player to have there own reborn without the help of GM's
this allows them to reborn them when they want

just go to the page fill in your character name, and follow the steps

Here is the code:

reborn.php (FILE MUST BE REBORN.PHP !!!!)

[php]

and the mssql code:
RemoteReborn (MUST BE CALLED "RemoteReborn" OR IT WILL NOT WORK !)
1) Open/start: "Query Analyzer"
2) Login with your Login Name and password
3) Select "Character" db at the top !!!!!!!!!!!
4) Copy and paste the following line:


and again thx to zombe for helping me

PS:
PHP Code:
            // WARNING YOU NEED TO CHANGE "/50000000/" IF YOU CHANGED YOUR REQUIREMENTS             
//             } elseif(!preg_match("/50000000/", $_POST['new_dwMoney'])) { 
//            echo "<br><center>The dill does not match the requirements.<br><a href='javascript:history.back()'>Go Back</a></center>"; 
It does not work YET
cuz i dont know how to pergmatch for 50 mill or higher so ....
janvier123 is offline  
Thanks
4 Users
Old 10/08/2009, 18:59   #2
 
elite*gold: 0
Join Date: Sep 2009
Posts: 25
Received Thanks: 1
gonna try it! thnx
PacoPG is offline  
Old 10/09/2009, 04:53   #3
 
*JayKay*'s Avatar
 
elite*gold: 0
Join Date: Jun 2008
Posts: 472
Received Thanks: 276
janvier123 congratulations for the post but I have doubts whether I was for my server max lvl 200 and put my character to reset lv 170 if it passes it to lvl 171 + resets could not say as I do to put the reset lvl 170 to 200 and that if the player does not want to reset lvl 170 he can reset 180 or 190 ... can tell how to do?
*JayKay* is offline  
Old 10/09/2009, 09:20   #4
 
janvier123's Avatar
 
elite*gold: 20
Join Date: Nov 2007
Posts: 2,854
Received Thanks: 1,891
Change in "RemoteReborn"

PHP Code:
(wlevel >= 170
to your needs

and change in reborn.php

PHP Code:
$req = array(  
'level' => "170"
); 
and disable this you can put // at the beginning or remove it
i still havend found out to to set it to 170+

PHP Code:
            // WARNING YOU NEED TO CHANGE "/170/" IF YOU CHANGED YOUR REQUIREMENTS
             
} elseif(!preg_match("/170/"$_POST['new_wLevel'])) {
            echo 
"<br><center>The level does not match the requirements.<br><a href='javascript:history.back()'>Go Back</a></center>"
janvier123 is offline  
Thanks
1 User
Old 10/09/2009, 20:40   #5
 
elite*gold: 0
Join Date: Feb 2008
Posts: 185
Received Thanks: 57
Quote:
Originally Posted by janvier123 View Post
Change in "RemoteReborn"

PHP Code:
(wlevel >= 170
to your needs

and change in reborn.php

PHP Code:
$req = array(  
'level' => "170"
); 
and disable this you can put // at the beginning or remove it
i still havend found out to to set it to 170+

PHP Code:
            // WARNING YOU NEED TO CHANGE "/170/" IF YOU CHANGED YOUR REQUIREMENTS
             
} elseif(!preg_match("/170/"$_POST['new_wLevel'])) {
            echo 
"<br><center>The level does not match the requirements.<br><a href='javascript:history.back()'>Go Back</a></center>"
I'm scratching my head on a few things here. Seems the
PHP Code:
$req = array(  
'level' => "170"
); 
should be
PHP Code:
$req = array(  
'level' >= "170"
); 
to do a greater than or equal comparison and why are you using preg_match?


What I would do since you are already pulling info from the db is:

-ask for the character name
-pull the data from db based on the name (as you already are)
-do the level comparison right from the data pulled, something like ($row4[2] >= '170') assuming $row4[2] is wlevel, instead of using the preg_match

Doing it like that should allow any level over 170 to be true, instead of the literal match preg_match is giving you.
caper is offline  
Old 10/14/2009, 03:43   #6
 
*JayKay*'s Avatar
 
elite*gold: 0
Join Date: Jun 2008
Posts: 472
Received Thanks: 276
so how can i replace the preg_match for another function to compare $row4[2]>='170'?
is there a way? thats my main problem here now. as i changed the
$req = array(
'level' >= "190",
);
when someone try to do a reborn at lvl 180(for exemple) it will complete(only on the website) the step2 and go to step 3 but the char will not be reborned.

how can i change it in favor to keep the
echo "<br><center>The level does not match the requirements.<br><a href='javascript:history.back()'>Go Back</a></center>";
*JayKay* is offline  
Old 10/14/2009, 03:54   #7
 
*JayKay*'s Avatar
 
elite*gold: 0
Join Date: Jun 2008
Posts: 472
Received Thanks: 276
i tried
} elseif($row2[3] >= '190') {
echo "<br><center>The level does not match the requirements.<br><a href='javascript:history.back()'>Go Back</a></center>";

but it keeps passing to step 3 but not reboring the char. i would like instead it go to step3 it send the msg its supossed to sends. "The level does not match the requirements."
*JayKay* is offline  
Old 10/14/2009, 03:56   #8
 
Decima's Avatar
 
elite*gold: 0
Join Date: Aug 2009
Posts: 1,297
Received Thanks: 928
Quote:
$req = array(
'level' >= "170",
);
last time i checked u cannot set and array variable this way *rolls eyes*

the '=>" does not mean 'greater than or equal to' in this case, its actually setting the $req['level'] variable to 170

u can then check

if ($req['level'] >= 170) {
*put some code here;*
} else {
*put some statement to the effect that they cannot here*
}

sometimes i feel as if only jan and zombe know php, altho cape seems to know his ****, php apparently is not part of his expertise . . . .
Decima is offline  
Old 10/14/2009, 04:35   #9
 
*JayKay*'s Avatar
 
elite*gold: 0
Join Date: Jun 2008
Posts: 472
Received Thanks: 276
if ($req['level'] >= 170) {
*put some code here;*
} else {
*put some statement to the effect that they cannot here*
}


what code should i put there so it can go to step3?
*JayKay* is offline  
Old 10/14/2009, 04:57   #10
 
Decima's Avatar
 
elite*gold: 0
Join Date: Aug 2009
Posts: 1,297
Received Thanks: 928
Quote:
Originally Posted by arthurvalenca View Post
if ($req['level'] >= 170) {
*put some code here;*
} else {
*put some statement to the effect that they cannot here*
}


what code should i put there so it can go to step3?
sorry man, im the kind of guy that wants you to figure that out for urself, that way u learn, and know what to do next time . . . give a man a fish . . . .
Decima is offline  
Old 10/14/2009, 05:03   #11
 
*JayKay*'s Avatar
 
elite*gold: 0
Join Date: Jun 2008
Posts: 472
Received Thanks: 276
oh.. oks man.. great help.. if i knew anything about php i wouldnt be here asking for help would i?
can someone else try to help me?
if ($req['level'] >= 170) {
*put some code here;*
} else {
*put some statement to the effect that they cannot here*
}

what code should i put there so it go to step3?
*JayKay* is offline  
Old 10/14/2009, 05:17   #12
 
elite*gold: 0
Join Date: Feb 2008
Posts: 185
Received Thanks: 57
Quote:
Originally Posted by Decima View Post
last time i checked u cannot set and array variable this way *rolls eyes*

the '=>" does not mean 'greater than or equal to' in this case, its actually setting the $req['level'] variable to 170

u can then check

if ($req['level'] >= 170) {
*put some code here;*
} else {
*put some statement to the effect that they cannot here*
}

sometimes i feel as if only jan and zombe know php, altho cape seems to know his ****, php apparently is not part of his expertise . . . .


You are right I am a perl man and have been learning php in leisure time, but like you I was just trying to offer a quick hint that there would be a better way to do the comparison and not so much a working example. I based that off of a quick glance of the code he was already using.

I agree the syntax should be better written and should be based from the data he was already querying, instead of using preg_match.

I never claim to be an expert because someone will always prove you wrong.
caper is offline  
Old 10/14/2009, 06:08   #13

 
saweet's Avatar
 
elite*gold: 20
Join Date: Sep 2007
Posts: 1,406
Received Thanks: 2,091
Sorry for intruding, just poking my head in here. If you plan on having other people access this script other than yourself, you really need to validate and escape the user input. As this script has 4 queries that are potentially vulnerable to SQL injection. These days people normally use PDO or prepared statements. However, with MSSQL you only need to escape single quotes. In MSSQL this is done by using ''. Such as: str_replace("'", "''", $string);

Also, there's several integer comparisons where the operand is a string. This causes PHP to cast the string back into an integer. ie: if ($count1 < '1') should be just 1 not '1'. Just pointing it out as it is littered throughout the script, even though PHP will correct it and you'll never notice. However, if $count1 in the example happened to be a string that didn't contain a number, it would not behave as expected.

If new_wLevel is only a number, there's no reason to preg_match.
PHP Code:
} elseif (!preg_match("/170/"$_POST['new_wLevel'])) { 
You could effectively just do the following:
PHP Code:
if (intval($_POST['new_wLevel']) != 170) { 
The reason you use intval here is that it will strip any non-numerical characters in the comparison. ie: 170abc will turn into just 170

PHP Code:
$result3 mssql_query(
            USE character; 
            EXEC RemoteReborn '"
.$_POST['new_name']."' 
        "
,$ms_con); 
Multiple statements with mssql_query() is not allowed.

You can also use or die('Error here'); at the end of mssql_connect, mssql_query, etc so that it if the function fails, it will halt execution of the script. ie: mssql_connect(...) or die('Could not connect to database.');

I hope my criticizing helps with your script and to write better PHP. Good luck!
saweet is offline  
Thanks
1 User
Old 10/14/2009, 06:29   #14
 
Decima's Avatar
 
elite*gold: 0
Join Date: Aug 2009
Posts: 1,297
Received Thanks: 928
Quote:
Originally Posted by caper View Post
You are right I am a perl man and have been learning php in leisure time, but like you I was just trying to offer a quick hint that there would be a better way to do the comparison and not so much a working example. I based that off of a quick glance of the code he was already using.

I agree the syntax should be better written and should be based from the data he was already querying, instead of using preg_match.

I never claim to be an expert because someone will always prove you wrong.
agreed

preg_match is prolly not the best way to go, i like to use IF statements and switches myself, keep the code easily understood, and preg_match has been known to make a bad day worse
Decima is offline  
Old 10/14/2009, 08:54   #15
 
elite*gold: 0
Join Date: Nov 2007
Posts: 604
Received Thanks: 21
Could you do a reborn script for coins instead of stats?
bengals is offline  
Reply


Similar Threads Similar Threads
Revised Perfect Reborn Script
12/30/2010 - CO2 PServer Guides & Releases - 47 Replies
Well as well all know there were some bugs in my "perfect" reborn script, so I'm going to release the revised edition. First in character.cs define this public int Top = 0; Then search for: public void RebornCharacter(byte ToJob) Replace that entire void with this public void RebornCharacter(byte ToJob) { try {
[Release] Second Reborn (CoEmu v2)
09/07/2009 - CO2 PServer Guides & Releases - 17 Replies
Hello!! It can have some bugs yet because it's on development! but here we go!! Obs.: 1º: Don't flame.... 2º if you wanna help... feel free to post!! First at all you need to have the first rb maded by samehvan!! and them you can make this... now Lets begin!
[Release]3rd Reborn Script
06/28/2009 - CO2 PServer Guides & Releases - 8 Replies
public void ReBorn3(byte ToJob) { try { { if (Level == 121) StatP += 40; else if (Level == 122) StatP += 50; else if (Level == 123)
[Release] Reborn Script (Pro Edition)
04/17/2009 - CO2 PServer Guides & Releases - 23 Replies
This is everything you need to setup Reborn in your LOTF based server source. This code doesn't have the MyClient.Drop(); since it is pointless and lame, and has extra Stats for all Jobs including Water Tao. Why Release it? - Already been released, this one is just better. What will I need? - Brain w/ common sense - LOTF source http://www.elitepvpers.com/forum/co2-main-discussio ns-questions/150327-lotf-source-guide.html]
[release]2ND reborn
03/03/2009 - CO2 PServer Guides & Releases - 4 Replies
REMOVED



All times are GMT +1. The time now is 23:39.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.