View Full Version : simple level hack
Esdee
10-31-2002, 08:17 AM
Well, as I'm still very new to PHP, I have a little question.
I find many RPG hacks and such, but what I want is something very simple and yet, I can't find it anywhere.
I only want a new stat in the postbit: Level: and it has to give the amounth of posts divided by 50
Can anyone tell me how to make such 'hack' ?
Thanks ^_^
Esdee
11-01-2002, 11:51 AM
anybody ?
please ??
Bitsys
11-01-2002, 02:05 PM
I am sort of new at this stuff too, but I think the following should work:
In your admin directory in functions.php (back up functions.php before editing it) find:
// do posts from ignored users
if (($ignore[$post[userid]] and $post[userid] != 0)) {
eval("\$retval = \"".gettemplate("postbit_ignore")."\";");
} else {
eval("\$retval = \"".gettemplate("postbit")."\";");
}
return $retval;
It should be at the end of the getpostbit function.
Insert before it:
$level = $post[posts] / 50;
$level = floor ($level + 1);
Go to the postbit template (in the admin cp) and and use the following code to display the level of the person:
Level: $level<br>
I tested it on my boards and it worked so let me know if you have any questions or problems. As I said before, I am still kind of new at this stuff too. BTW, You can change the actual wording of the level display in postbit, just use $level wherever you want to insert that person's level.
Dean C
11-01-2002, 05:41 PM
Lol what an excellently simple hack :)
- miSt
Esdee
11-01-2002, 10:29 PM
Thanks man !
It works perfectly !
(I did have to leave out the +1 though ;) )
But I do have a question: Hwo do you know where you have to add such code in the functions.php file ?
And don't tease us, Mist ^_^
Everybody starts somewhere.
We might just be the future's great hackers :p
And besides, the little hacks can be most fun :D
Bitsys
11-02-2002, 04:01 AM
How did I know where to add it? Well, I first looked at showthread.php to find out how posts are displayed. Then, I saw a call to the getpostbit function. This function was called for each post in the thread, so I figured that is where all of the variables and calculations were done. So I went to functions.php and found the getpostbit function. As far as where to put it in the getpostbit function, I just decided to skim to the bottom since all of the other stuff didn't pertain to or affect what I was trying to do. However, it would have been pointless to put it at the very bottom of the getpostbit function, since the postbit template would have been evaluated before the $level variable was set. So I just put it above the place where the postbit template was evaluated. :)
Is that what you were asking? If not, then just PM me and I can give a more detailed answer. :)
BTW, I agree that the little hacks can be the most fun ;)
Dean C
11-02-2002, 08:25 AM
I wasn't teasing you - i was just happy at how simple things can be :)
- miSt
Esdee
11-02-2002, 02:21 PM
^_^
Thanks Bitsys
That was exactly what I wanted toi know :)
Bitsys
11-02-2002, 03:02 PM
^_^
Glad I was able to help :D
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.