ID:139965
 
Code:
mob
Stat()
statpanel("Stats")
stat(usr)
stat("--- --- --- --- --- --- --- --- --- --- --- --- ---")
stat(" Info")
stat("--- --- --- --- --- --- --- --- --- --- --- --- ---")
stat("Name: [usr]")
if(usr.NarutoRace)
stat("Bloodline: [Clan]")
stat("Rank: [rank]")
stat("Home Village: [Village]")
if(usr.BleachRace)
stat("Race: [Clan]")
stat("Seat: [rank]")
stat("Home: [Village]")
if(usr.DBZRace)
stat("Race: [Clan]")
stat("Home: [Village]")
if(usr.KHRRace)
stat("Guardian: [Clan]/[SubClan]")
stat("Hometown: [Village]")
stat("Rank: [rank]")
stat("Yen: [Yen]¥")
stat("Kills: [kills] Missing Kills [missingkills]")
stat("Deaths: [deaths]")
stat("Location: [usr.x],[usr.y],[usr.z]")
stat("--- --- --- --- --- --- --- --- --- --- --- --- ---")
stat(" Status")
stat("--- --- --- --- --- --- --- --- --- --- --- --- ---")
var/ttexp=round(src.taiexp*100/src.mtaiexp)
var/nnexp=round(src.ninexp*100/src.mninexp)
var/ggexp=round(src.genexp*100/src.mgenexp)
stat("Level: [level]")
stat("Health: [health]/[maxhealth]")
if(usr.NarutoRace)
stat("Chakra: [chakra]/[Mchakra]")
stat("Taijutsu: [tai] ([ttexp]%)")
stat("Ninjutsu: [nin] ([nnexp]%)")
stat("Genjutsu: [gen] ([ggexp]%)")
if(usr.Village == "Star")
stat("Star Skill: [MStarSL]")
stat("Seals: [seals]% Accuracy")
stat("--- --- --- --- --- --- --- --- --- --- --- --- ---")
stat("Shuriken Skill: [shurikenskill]")
stat("Kunai Skill: [kunaiskill]")
stat("Trap Skill: [trapskill]")
stat("--- --- --- --- --- --- --- --- --- --- --- --- ---")
stat("Missions:")
stat("D: [dmission]")
stat("C: [cmission]")
stat("B: [bmission]")
stat("A: [amission]")
stat("S: [smission]")
stat("--- --- --- --- --- --- --- --- --- --- --- --- ---")
if(src.Aburame)
stat("Konchuu: [Konchuu]")
if(src.Akimichi)
stat("Calories: [calories]")
if(src.Uchiha)
stat("Sharingan uses: [Suses]")
stat("--- --- --- --- --- --- --- --- --- --- --- --- ---")
stat("Base Uses:")
stat("Bunshin No Jutsu uses - [BunshinN]")
stat("Henge No Jutsu uses - [hengeN]")
stat("Kawarimi no jutsu uses - [KawaN]")
if(usr.BleachRace)
stat("Spiritual Energy: [chakra]/[Mchakra]")
stat("Strength: [tai] ([ttexp]%)")
stat("Reiatsu: [nin] ([nnexp]%)")
stat("--- --- --- --- --- --- --- --- --- --- --- --- ---")
stat("Missions:")
stat("D: [dmission]")
stat("C: [cmission]")
stat("B: [bmission]")
stat("A: [amission]")
stat("S: [smission]")
stat("--- --- --- --- --- --- --- --- --- --- --- --- ---")
stat("Base Uses:")
stat("Shikai Uses - [shikaiN]")
stat("Bankai Uses - [bankaiN]")
if(src.Clan == "Vaizard")
stat("Hollow Mask Uses - [HMask]")
if(usr.DBZRace)
stat("Ki: [chakra]/[Mchakra]")
stat("Strength: [tai] ([ttexp]%)")
stat("Ki Power: [nin] ([nnexp]%)")
stat("--- --- --- --- --- --- --- --- --- --- --- --- ---")
stat("Missions:")
stat("D: [dmission]")
stat("C: [cmission]")
stat("B: [bmission]")
stat("A: [amission]")
stat("S: [smission]")
if(usr.KHRRace)
stat("Dying Will: [chakra]/[Mchakra]")
stat("Strength: [tai] ([ttexp]%)")
stat("Dying Will Power: [nin] ([nnexp]%)")
stat("--- --- --- --- --- --- --- --- --- --- --- --- ---")
stat("Missions:")
stat("D: [dmission]")
stat("C: [cmission]")
stat("B: [bmission]")
stat("A: [amission]")
stat("S: [smission]")
stat("--- --- --- --- --- --- --- --- --- --- --- --- ---")
stat("Base Uses:")
stat("Dying Will Bullet Uses - [dwbN]")
stat("Rebuke Dying Will Bullet Uses - [rdwbN]")
if(src.SubClan == "Sky")
stat("X-Gloves Uses - [xgN]")
stat("--- --- --- --- --- --- --- --- --- --- --- --- ---")
statpanel("Inventory")
stat("",contents)
..()


Problem description:
Hey guys,
I'm having problems with this code part. It's the basic statpanel which I found in the 'Demo' part of BYOND. I modified it for my game a little but as soon as about 1 hour passes while playing the server crashes. The profiling shows me that the self cpu is constantly rising and I think this is the reason why my server keeps crashing. In what way should I change it so it doesn't crash the server
Sinus wrote:
Problem description:
Hey guys,
I'm having problems with this code part. It's the basic statpanel which I found in the 'Demo' part of BYOND. I modified it for my game a little but as soon as about 1 hour passes while playing the server crashes. The profiling shows me that the self cpu is constantly rising and I think this is the reason why my server keeps crashing. In what way should I change it so it doesn't crash the server

I'm going to ignore the massively large chunk of code.
statpanel("Stats")

Makes it tick every second, even if the user isn't looking at it. Perhaps making it run only when they look at it is a more preferable solution:
if(statpanel("Stats"))

In addition, you might want to use a switch statement for your races, and make one race variable, a text string, like:
switch(myRace)
if("cake") //the cake does this
if("pie") // the pie does this

Instead of having ten variables, each representing a race.
In response to DivineTraveller
Thank you :) worked quite well ^^ the self cpu is at 0.045 all the time and doesnt change (at least just with me on the server :D) thx again ^^