[Src]->Auto resets

Codes already submitted by people of the forums.
Post Reply
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

ok i dont know if this code is any use to you all but iv found it very nice for when i cant be assed, or just plain cant fix a bug like being able to go over max level/exp or stats.

it is also a nice failsafe in case you missed something and a bug like this still exists

in InitPlayerData
look for

Code: Select all

	if (m_pClientList[iClientH] == NULL) {
  wsprintf(cTxt, "<%d> InitPlayerData error - Socket error! Disconnected.", iClientH);
  PutLogList(cTxt);
  return;
	}
right after it paste this

Code: Select all

if (m_pClientList[iClientH]->m_iStr > m_sCharStatLimit) { //XenX restore if you go above max stats
  m_pClientList[iClientH]->m_iStr = m_sCharStatLimit;
	}
	if (m_pClientList[iClientH]->m_iVit > m_sCharStatLimit) { //XenX restore if you go above max stats
  m_pClientList[iClientH]->m_iVit = m_sCharStatLimit;
	}
	if (m_pClientList[iClientH]->m_iDex > m_sCharStatLimit) { //XenX restore if you go above max stats
  m_pClientList[iClientH]->m_iDex = m_sCharStatLimit;
	}
	if (m_pClientList[iClientH]->m_iMag > m_sCharStatLimit) { //XenX restore if you go above max stats
  m_pClientList[iClientH]->m_iMag = m_sCharStatLimit;
	}	
	if (m_pClientList[iClientH]->m_iInt > m_sCharStatLimit) { //XenX restore if you go above max stats
  m_pClientList[iClientH]->m_iInt = m_sCharStatLimit;
	}
	if (m_pClientList[iClientH]->m_iCharisma >m_sCharStatLimit) { //XenX restore if you go above max stats
  m_pClientList[iClientH]->m_iCharisma = m_sCharStatLimit;
	}
	if (m_pClientList[iClientH]->m_iAdminUserLevel < 1){   //added by XenX code to restore character after going over max level
	if (m_pClientList[iClientH]->m_iLevel > m_iPlayerMaxLevel) {
	m_pClientList[iClientH]->m_iLevel = m_iPlayerMaxLevel;
	}
  }
	if (m_pClientList[iClientH]->m_iAdminUserLevel < 1){
	if (m_pClientList[iClientH]->m_iExp > m_iLevelExpTable[m_iPlayerMaxLevel+1]) {
	m_pClientList[iClientH]->m_iExp = m_iLevelExpTable[m_iPlayerMaxLevel];
	}
  }
and thats it now if for ANY reason people manage to somehow go over your max stats/max level or max exp, after they are disconnected it will be automatically reset.

nice huh :) thanks to bone-you i think is was for some help getting it to work hehe.

oh PS. this will not affect getting magestic points per level above max, however it will mean that instead of getting the next level exp you just need max level +1 exp for each majestic, i dont think i can fix that but if u want u dont need the max exp one.
Maxis
Regular
Posts: 51
Joined: Tue Apr 04, 2006 4:47 pm

Post by Maxis »

nice i go train this :)
Crossfade
Loyal fan
Posts: 354
Joined: Sun Mar 20, 2005 5:55 pm

Post by Crossfade »

stop with the

Code: Select all

m_iAdminUserLevel < 1)
lol

you should do it like

Code: Select all

m_iAdminUserLevel == 0)
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

what difference does it make ?
Jensen
Loyal fan
Posts: 300
Joined: Tue Aug 02, 2005 7:40 am
Location: Illinois, USA
Contact:

Post by Jensen »

what if negative admins == ban?
-><-
Treax2
Loyal fan
Posts: 281
Joined: Fri Mar 04, 2005 5:05 pm
Location: Estonia
Contact:

Post by Treax2 »

year ago i made that too.

but it putted lu pool to - :) and lvl too :D
xmukox
Member
Posts: 175
Joined: Sun Sep 11, 2005 9:53 am

Post by xmukox »

nice work. But i must first test it ;p but thenks. ^^
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

if (m_pClientList[iClientH]->m_iCharisma >m_sCharStatLimit) { //XenX restore if you go above max stats
  m_pClientList[iClientH]->m_iStr = m_sCharStatLimit;
}
Buggy :)
QUOTE (ADDKiD @ Dec 1 2006, 4:01 PM) <br>You guys make me laugh alot, half the shit I say, is bullshit...<br><br><img src='http://img485.imageshack.us/img485/492/banssig1ng.gif' border='0' alt='user posted image' /><br><br><b>I see no changes at all, wake up in the morning and ask myself...<br>Is life worth living? Should I blast myself?</b><br><br><b><a href='http://2paclegacy.com' target='_blank'>2PacLegacy.com</a></b>
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

why is that buggy it works perfectly for me?

also, iv just noticed something, feel free to say DUH! :P

instead of

Code: Select all

if (m_pClientList[iClientH]->m_iAdminUserLevel < 1){   //added by XenX code to restore character after going over max level
if (m_pClientList[iClientH]->m_iLevel > m_iPlayerMaxLevel) {
m_pClientList[iClientH]->m_iLevel = m_iPlayerMaxLevel;
}
 }
if (m_pClientList[iClientH]->m_iAdminUserLevel < 1){
if (m_pClientList[iClientH]->m_iExp > m_iLevelExpTable[m_iPlayerMaxLevel+1]) {
m_pClientList[iClientH]->m_iExp = m_iLevelExpTable[m_iPlayerMaxLevel];
}
 }
you can just do this

Code: Select all

if (m_pClientList[iClientH]->m_iAdminUserLevel < 1){   //added by XenX code to restore character after going over max level and exp
if (m_pClientList[iClientH]->m_iLevel > m_iPlayerMaxLevel) {
m_pClientList[iClientH]->m_iLevel = m_iPlayerMaxLevel;
m_pClientList[iClientH]->m_iExp = m_iLevelExpTable[m_iPlayerMaxLevel];
}
 }
just have the one for exp AND level, cause ur never gonna go over max exp unless u go over max level

HAHA i just noticed what ur talking about.. rofl correcting in first post...
Dax
&lt;3 bd long time
Posts: 785
Joined: Mon Apr 18, 2005 3:19 pm

Post by Dax »

Or fix the loop in the check level up function. It's very very wrong as it is now. If you add the MJ check propperly into the loop it can be made much more efficient and without any over-level bugs or glitches. Also if you code the loop right you can add multi-mj support if you over exp on say abaddon with mass exp.

This code is no fix. It's a bandaid. Fix the feel issue.
Reppin' 127.0.0.1!!!<br><br><img src='http://img502.imageshack.us/img502/1348/sig4daxbn2.jpg' border='0' alt='user posted image' /><br><br>I contend that we are both atheists. I just believe in one fewer god than you do. <br>When you understand why you dismiss all the other possible gods, you will <br>understand why I dismiss yours.<br>~ <b>Stephen Roberts</b>
juggalo2
Spamtastic
Posts: 1144
Joined: Sun Jul 17, 2005 5:28 pm

Post by juggalo2 »

Try this

Code: Select all

if (m_pClientList[iClientH]->m_iStr + m_pClientList[iClientH]->m_iAngelicStr) > m_sCharStatLimit) { //XenX restore if you go above max stats
 m_pClientList[iClientH]->m_iStr = m_sCharStatLimit;
}
if (m_pClientList[iClientH]->m_iDex + m_pClientList[iClientH]->m_iAngelicDex) > m_sCharStatLimit) { //XenX restore if you go above max stats
 m_pClientList[iClientH]->m_iDex = m_sCharStatLimit;
}
if (m_pClientList[iClientH]->m_iMag + m_pClientList[iClientH]->m_iAngelicMag) > m_sCharStatLimit) { //XenX restore if you go above max stats
 m_pClientList[iClientH]->m_iMag = m_sCharStatLimit;
} 
if (m_pClientList[iClientH]->m_iInt + m_pClientList[iClientH]->m_iAngelicInt) > m_sCharStatLimit)) { //XenX restore if you go above max stats
 m_pClientList[iClientH]->m_iInt = m_sCharStatLimit;
}
if (m_pClientList[iClientH]->m_iCharisma >m_sCharStatLimit) { //XenX restore if you go above max stats
 m_pClientList[iClientH]->m_iCharisma = m_sCharStatLimit;
}
if (m_pClientList[iClientH]->m_iVit > m_sCharStatLimit) { //XenX restore if you go above max stats
 m_pClientList[iClientH]->m_iVit = m_sCharStatLimit;
}
if (m_pClientList[iClientH]->m_iAdminUserLevel == 0){   //added by XenX code to restore character after going over max level
if (m_pClientList[iClientH]->m_iLevel > m_iPlayerMaxLevel) {
m_pClientList[iClientH]->m_iLevel = m_iPlayerMaxLevel;
}
 }

<img src='http://lifeplaysu420.com/unknow/nightsign.png' border='0' alt='user posted image' /><br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>Wanna make money for surfing the net sing up at <br><a href='http://www.cashfiesta.com/php/join.php? ... yprivitera' target='_blank'>cash fiesta</a><br>its all free hey why ntot make money while fucking around on the computer<br><br><br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kiruku
Loyal fan
Posts: 268
Joined: Wed Feb 22, 2006 12:00 pm
Contact:

Post by Kiruku »

nice i tried to do something like this already but didnt know where to put. i putted there where Auto Contri by reax was and the server crashed all the time... now i know it thanks.
<img src='http://lichtdrache.lima-city.de/helbrea ... aramba.gif' border='0' alt='user posted image' />
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

Err juggalo that will set you to 190 stats everytime you equip an angel O.o

current stat + angel = cant equal more than max stat
therefore,
200 stat and a +10 angel = u get set to 190 stat and a +10 angel

Dax im quite new at this man, i can code simple stuff but fixing problems that are already there is difficuilt for me cause i dont understand a lot of what is going on in the original code, but im getting there, for now this is a helpfull and difinitive way to solve the problem for me and a lot of other people here, its as good as its gonna get without help from the better coders like you..

im just trying to solve the problems i come across as i go along in the best way i know how :)
Post Reply