Nicholas Posted September 18, 2009 Posted September 18, 2009 hi im wondering... does anyone know how to make it so it costs say $1,000,000 to change the players name? } function name_change() { global $ir,$c,$userid,$h; print "<h3><font color=white>Name Change</h3> <font color=white>Please note that you still use the same name to login, this procedure simply changes the name that is displayed. <form action='preferences.php?action=namechange2' method='post'> New Name: <input type='text' name='newname' /> <input type='submit' value='Change Name' /></form>"; } function do_name_change() { global $db,$ir,$c,$userid,$h; if($_POST['newname'] == "") { print "<font color=white>You did not enter a new name. [url='preferences.php?action=namechange']> <font color=white>Back[/url]"; } else { $_POST['newname']=str_replace(array("<", ">", "\\\'"), array("<", ">", "'"), $_POST['newname']); $db->query("UPDATE users SET username='{$_POST['newname']}' WHERE userid=$userid"); print "<font color=white>Username changed!"; } thats the function for the change username, can anyone edit it so it costs you 1,000,000 to change your name please? it be very greatful. i have acturally tried searching to see if its already been posted but i cant find it. Quote
Danny696 Posted September 18, 2009 Posted September 18, 2009 Try this, Also remember to close your colour tags ;) basic HTML and in the next version of HTML youll need to end your tags <?php //pwitty colours come alive function name_change() { global $ir,$c,$userid,$h; $cost1 ='1000000'; // 1 million $cost = money_formatter($cost); print "<h3><font color=white>Name Change</h3> Please note that you still use the same name to login, this procedure simply changes the name that is displayed. It will cost you ".$cost." to change your name.</font> <form action='preferences.php?action=namechange2' method='post'> font color=whiteNew Name</font>: <input type='text' name='newname' /> <input type='submit' value='Change Name' /></form>"; } function do_name_change() { global $db,$ir,$c,$userid,$h; $cost1 ='1000000'; // 1 million $cost = money_formatter($cost); if($_POST['newname'] == "") { print "<font color=white>You did not enter a new name.</font> [url='preferences.php?action=namechange']> <font color=white>Back</font>[/url]"; } if($ir['money'] < $cost1) { echo'<font color=white>You do not have enough money to change your name, you need '.$cost.' to change it </font> '; } else { $_POST['newname']=str_replace(array("<", ">", "\\\'"), array("<", ">", "'"), $_POST['newname']); $db->query("UPDATE users SET username='{$_POST['newname']}', money=money-$cost1 WHERE userid=$userid"); print "<font color=white>Username changed!</font>"; } Quote
Nicholas Posted September 18, 2009 Author Posted September 18, 2009 cheers, it works. i was just getting tired of players changing their names every like 30 minutes lol. i lost track who was who lol. Quote
Djkanna Posted May 12, 2010 Posted May 12, 2010 -.- I'm still wondering why it's done in Two functions (waste much?) Quote
Danny696 Posted May 12, 2010 Posted May 12, 2010 i would have done them both, but i only fixed the HTML etc... Quote
Zero-Affect Posted May 13, 2010 Posted May 13, 2010 That's one aspect of MC i hated with preferences having the main function then the submit function, Horrific looking and tacky IMO. 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.