Cyanide Posted February 2, 2008 Posted February 2, 2008 I wasn't sure where to post this, move if needed. Ok, I have been asked alot about how to convert a v1 mod to a v2 mod so I decided to post this, hope it helps out. This is much easier than most think. Ok, first, open the v1 mod you wish to convert and find: require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm); $h->menuarea(); and replace it with this: include "globals.php"; and you're done. most of you know that the sql querys in v2 are written differently than in v1, but that doesnt matter, the usual mysql_query will work just the same, there is no need to change it. Quote
Krafty Posted February 2, 2008 Posted February 2, 2008 Re: Tutorial: v1 - v2 Conversion Not being mean..just putting up a simpler thing.. Convert V1 to V2 To convert from v1 to v2 you will need to 4 things. This is best done in Notepad. Pressing Ctrl + H WILL help you a lot! In the v1 version of the code find: session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); And change it to include "globals.php"; Then find all the places where it says: mysql_query And change to: $db->query Then you're done! Feel free to contact me.. [email protected] Quote
Cyanide Posted February 2, 2008 Author Posted February 2, 2008 Re: Tutorial: v1 - v2 Conversion You dont need to change the querys for a v1 mod to work with v2, thats a needless step Quote
Magictallguy Posted February 3, 2008 Posted February 3, 2008 Re: Tutorial: v1 - v2 Conversion You dont need to change the querys for a v1 mod to work with v2, thats a needless step As true as this is, what many coder/programmers don't realise is that it's actually *much* safer to use the $db->query string instead of the mysql_query.. So.. v1 session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); v2 include "globals.php"; ----------- v1 mysql_ v2 $db-> ------------ v1 fetch_array v2 fetch_row Much safer to use it that way. Quote
shrek1609 Posted February 28, 2008 Posted February 28, 2008 Re: Tutorial: v1 - v2 Conversion Thank you just finished my first V1 - V2 conversion !!! and it works :-o thanks again :-D Quote
tittlemouse Posted March 2, 2008 Posted March 2, 2008 Re: Tutorial: v1 - v2 Conversion thanks very much for posting this it has been very usefull as i can now convert mods. Quote
Godhand Posted March 3, 2008 Posted March 3, 2008 Re: Tutorial: v1 - v2 Conversion I think its good to keep bumping this so it is easier to find for new coders. :wink:. But a db query is supposed to be more secure but thats only what I've heard. Quote
Floydian Posted March 4, 2008 Posted March 4, 2008 Re: Tutorial: v1 - v2 Conversion um what about using the class method is safer than the using the built in msyql_query function? function query($query) { $this->last_query=$query; $this->num_queries++; $this->result=mysql_query($this->last_query, $this->connection_id) or $this->query_error(); return $this->result; } as you can see, it's just doing a mysql_query inside a class. Nothing, absolutely nothing safer about that bro man. :mrgreen: Quote
Magictallguy Posted March 20, 2008 Posted March 20, 2008 Re: Tutorial: v1 - v2 Conversion Ok, you know what you're doing...But we don't xD But I have 2 questions.. 1. Where would you put that? 2. Where would the query go inside of that? Quote
Raid Posted March 31, 2008 Posted March 31, 2008 Re: Tutorial: v1 - v2 Conversion Explain how it is safer :roll: Quote
HITMAN 17 Posted April 12, 2008 Posted April 12, 2008 Re: Tutorial: v1 - v2 Conversion how do u convert a register page for v1 to v2? Quote
Nickson Posted April 12, 2008 Posted April 12, 2008 Re: Tutorial: v1 - v2 Conversion how do u convert a register page for v1 to v2? Quit posing that everywhere and do what there is described ... Quote
HITMAN 17 Posted April 12, 2008 Posted April 12, 2008 Re: Tutorial: v1 - v2 Conversion can someone help me please as it is a lot harder than the mod converting Quote
Knuckles25 Posted April 13, 2008 Posted April 13, 2008 Re: Tutorial: v1 - v2 Conversion can someone help me please as it is a lot harder than the mod converting I Convert Register Pages And I Cant Code Very Good Quote
KDawg08 Posted April 28, 2008 Posted April 28, 2008 Re: Tutorial: v1 - v2 Conversion How can you not convert v1 to v2 and vice versa? It is probably the SIMPLEST thing to do with mccodes scripts... Quote
Magictallguy Posted May 9, 2008 Posted May 9, 2008 Re: Tutorial: v1 - v2 Conversion I would say adding an href would be the easiest thing - Having said that, I know 2 people who can't even do that yet they have 3 sites on the run - one of which is a .com! Quote
iR00T Posted May 12, 2008 Posted May 12, 2008 Re: Tutorial: v1 - v2 Conversion I would say adding an href would be the easiest thing - Having said that, I know 2 people who can't even do that yet they have 3 sites on the run - one of which is a .com! umm..magic i do know how to do href links lol that was like a week ago that i didnt no Quote
Magictallguy Posted May 12, 2008 Posted May 12, 2008 Re: Tutorial: v1 - v2 Conversion I wasn't talking about you! xD I have a friend in the UK who now actually runs a 4th site and is a worse scripter than you! Quote
iR00T Posted May 12, 2008 Posted May 12, 2008 Re: Tutorial: v1 - v2 Conversion ohh..damn ha send me his game links i gotta see how n00b they are lmaoXD Quote
Haunted Dawg Posted May 12, 2008 Posted May 12, 2008 Re: Tutorial: v1 - v2 Conversion TheJoker, do you always have to put your stuff in highlighted? Quote
iR00T Posted May 12, 2008 Posted May 12, 2008 Re: Tutorial: v1 - v2 Conversion TheJoker, do you always have to put your stuff in highlighted? no i just felt like spicing things up a bit XD Quote
danger boy Posted May 24, 2008 Posted May 24, 2008 Re: Tutorial: v1 - v2 Conversion there is no need jus type wat u want to say no one is lookin at the coulor or how fancy it is Quote
Delete ! Posted May 24, 2008 Posted May 24, 2008 Re: Tutorial: v1 - v2 Conversion That just sucks the fun out of the forums then dosnt it if everyone was as plain as that i dont think anyone would have any fun let the guy have is higlights Cos Its Cool Quote
endo Posted June 9, 2008 Posted June 9, 2008 Re: Tutorial: v1 - v2 Conversion i dunno if i should be posting this in here but i have a major problem with mccodes v2 when you commit a crim your exp bar doesnt move but it does when you attack can anyone help? Quote
iR00T Posted June 9, 2008 Posted June 9, 2008 Re: Tutorial: v1 - v2 Conversion i dunno if i should be posting this in here but i have a major problem with mccodes v2 when you commit a crim your exp bar doesnt move but it does when you attack can anyone help? i had v2 and i dont have that prob its best now days if people code ther own engine idk why but its just best cause mccode lite sucks v1 sucks v2 decent lol Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.