[Code Snippet - PHP] Private Server - Experience/Level Displays

11/12/2013 15:29 InstantBlood#1
Level Icon:
  • Without Premium
  • Level 101 not included
  • You must enter your own path
  • Link: [Only registered and activated users can see links. Click Here To Register...]

3D Level Icon:
  • With Premium
  • Level 101 not included
  • Platinum not included
  • You must enter your own path
  • Link: [Only registered and activated users can see links. Click Here To Register...]

Experience Percent:
Experience Display:

Finale Code:

Have fun and sorrry for my bad english ^^
11/12/2013 15:32 ~iToXiiC#2
Or easy

Quote:
function getLevelforExp($exp)
{
$level = 1;
$exp += 1;
$levelarr = array(1,2250,6750,11250,16650,24750,32850,41625,50 400,59175,
67950,76725,94725,112725,130725,148725,166725,1892 25,211725,234225,
256725,279225,306225,333225,360225,387225,414225,4 41225,497475,553725,
609975,666225,722475,778725,857475,936225,1014975, 1093725,1172475,1251225,
1363725,1476225,1588725,1701225,1813725,1926225,20 38725,2207475,2376225,2544975,
2713725,2882475,3051225,3219975,3444975,3669975,38 94975,4119975,4344975,4569975,
4794975,5132475,5469975,5807475,6144975,6482475,68 19975,7157475,7494975,7944975,
8394975,8844975,9294975,9744975,10194975,10644975, 11094975,11657475,12219975,12782475,
13344975,13907475,14469975,15032475,15932475,17282 475,18632475,19982475,21332475,22682475,
24032475,25382475,26732475,28307475,29882475,31457 475,33032475,34607475,36182475,37757475,
2147483647
);
for($i = 1; $i < 101; $i++)
if($exp > $levelarr[$i]) $level = $i;

return $level +1 ;
}
11/12/2013 17:00 +Yazzn#3
@InstantBlood Your code is simply inaccaptable.

@~iToXiiC Your code iterates from 1 to 100 even if $levelarr[$i] is equal or bigger than $exp -> Useless iterations (assuming the redundant statements aren't removed by optimization)
11/12/2013 17:01 ~iToXiiC#4
Quote:
Originally Posted by Yazzn (: View Post
@InstantBlood Your code is simply inaccaptable.

@~iToXiiC Your code iterates from 1 to 100 even if $levelarr[$i] is equal or bigger than $exp -> Useless iterations (assuming the redundant statements aren't removed by optimization)
Well its realy old like 1 year old i was learning PHP before ^^
11/12/2013 17:58 Raz9r#5
Holy f***ing shit.
11/12/2013 18:08 InstantBlood#6
Quote:
Originally Posted by Yazzn (: View Post
@InstantBlood Your code is simply inaccaptable.

@~iToXiiC Your code iterates from 1 to 100 even if $levelarr[$i] is equal or bigger than $exp -> Useless iterations (assuming the redundant statements aren't removed by optimization)
Ist ein alter Code der bei mir rumlag.
Natürlich hätte man es leichter machen können, aber wie sagt man so schön "Es führen 1000 Wege nach Rom".
11/12/2013 21:33 Omdi#7
Kann auch meiner Meinung nach [Only registered and activated users can see links. Click Here To Register...] rein :)

closed