DragonPrime - LoGD Resource Community
Welcome Guest
  • Good afternoon, Guest.
    Please log in, or register.
  • July 15, 2018, 04:06:15 PM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: Changing a players title  (Read 2357 times)
0 Members and 1 Guest are viewing this topic.
Jukebox
Guest
« on: June 30, 2004, 02:59:34 AM »

I've made a mod where you can fight a demon. When you have killed the demon I want there to be a small chance to get a new title.. all code is done and works except for the title code..

This is where I run into problems.. as far as I can tell the title is both in [title] and [name].. so first I have to remove the old title from [name], then change [title] and finally adding [title] to [name]. Any ideas how this can be done?

I looked at dragon.php but that code was confusing to say the least Smiley
Logged
robert
Old Dog
Mod God
*****
Offline Offline

Posts: 1047


LoGD Buff!


View Profile WWW
« Reply #1 on: June 30, 2004, 03:32:01 AM »

Already done and has been in file sharing area for months: File Share>Robert>fountain097

a snippet from the file itself:

$newtitle="`9Soaked";
                if ($session['user']['ctitle'] == "")
                {
                if ($session['user']['title']!="")
                {

                        $n = $session['user']['name'];
                        $x = strpos($n,$session['user']['title']);
                        if ($x!==false){
                                $regname=substr($n,$x+strlen($session['user']['title']));
                                $session['user']['name'] = substr($n,0,$x).$newtitle.$regname;
                                $session['user']['title'] = $newtitle;
                        }else{
                                $regname = $session['user']['name'];
                                $session['user']['name'] = $newtitle." ".$session['user']['name'];
                                $session['user']['title'] = $newtitle;
                        }
                }else{
                        $regname = $session['user']['name'];
                        $session[user][name] = $newtitle." ".$session[user][name];
                        $session[user][title] = $newtitle;
                        $session[user][turns]--;
                }
                }else{
                $regname = substr($session['user']['name'], strlen($session['user']['title']));
                $session[user][title] = $newtitle;
                }

This snippet has been used in this and numerous other files without error or flaw for months as oppossed to others I have seen and tried. The title gets changed and remains with player until next title change or DK.
Logged

Jukebox
Guest
« Reply #2 on: June 30, 2004, 04:23:51 AM »

Thanks! I will try this now.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Version 1.1.2 is the current supported version and is available for download.

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
44 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search