PDA

View Full Version : Ranking System


DeadMan384AD
08-31-2002, 08:11 AM
After looking thru just about every hack the only hack that I found that was close to what I wanted was the Galaga hack by TommyBoy.... and its obvious even to me that the code is pretty old...
What I want it to do, is display a picture according to how many posts the person has... But I dont think I'm calling the right data or something...

I have this after the global things in "buildpostbit"


// --- vB Galaga Hack by TommyBoy Modified by DeadMan384AD
$RankNum = $bbuserinfo[posts];
$rank = "";
while ($RankNum > 1) {

if ($RankNum > 5) {
$rank = "<img src=\"images/ranks/2.jpg\" border=0>";
$RankNum -= 5;
}
elseif ($RankNum > 10) {
$rank = "<img src=\"images/ranks/3.jpg\" border=0>";
$RankNum -= 10;
}
elseif ($RankNum > 50) {
$rank = "<img src=\"images/ranks/4.jpg\" border=0>";
$RankNum -= 50;
}
elseif ($RankNum > 100) {
$rank = "<img src=\"images/ranks/5.jpg\" border=0>";
$RankNum -= 100;
}
elseif ($RankNum > 500) {
$rank = "<img src=\"images/ranks/6.jpg\" border=0>";
$RankNum -= 500;
}
elseif ($RankNum > 1000) {
$rank = "<img src=\"images/ranks/7.jpg\" border=0>";
$RankNum -= 1000;
}
else {
$rank = $RankNum;
$RankNum--;
}
}
$rank = $rank;
// --- vB Galaga Hack by TommyBoy Modified by DeadMan384AD


Right now in the else statement I have it showing $RankNum for debug... cause it just shows the image for else, when I should be seeing image 6 in my posts... but for the debug, all I get is "2" for any user....
I've tried it taking $RankNum from $post[posts] as well, same output...

And in the final version, I want this to be using 34 different ranking levels...

g-force2k2
08-31-2002, 03:50 PM
hmm... i was actually working on my own Galaga system ;) i'll let you know how things go if you like :) i have made good progress with it too... regards..

g-force2k

DeadMan384AD
08-31-2002, 07:16 PM
:paranoid: Thanks for the help? :ermm:

uh.. Ok, well hopefully if I dont figure my own script out, yours is out soon, I'm hoping to get this done(plus a million other things, go figure for a SA) before I go back to school. :D

g-force2k2
08-31-2002, 07:19 PM
oh :p lol i didn't even see that you modified that my bad... :p didn't connect the names i guess... sorry about that ;) regards... i know that this was a custom feature for ubbs...

g-force2k2

N9ne
08-31-2002, 07:36 PM
Deadman, I think you're looking for what i've requested [g-force is working on it], having an image under your title/custom title like stars or a bar in different colours etc. Just like in UBB. I'm sure you want this for mods, supermods, admins aswell ;)

DeadMan384AD
08-31-2002, 08:02 PM
Yah, cept its not going under the avatar.... :D elsewhere on the postbit... This should be a very easy hack to install... nothing fancy, it should only refer to the users post, and show the image relevant to the persons post count... I'm not even sure what "$RankNum -= 50 " does... but that might be the problem...

otherwise I think I can get most of it figured out, I just dont know how to get the users post into $RankNum....

If you wanna have fun, take the second line out of the if statements in my code, if it doesnt give you an error, it slows down the showthread really, really bad... :D yay for infinite loops! (found that out the hard way, its been a long time since I coded anything)

N9ne
08-31-2002, 08:08 PM
Yeah well the one i requested, I just want a variable available so I can insert the image anywhere in the postbit :)

DeadMan384AD
09-02-2002, 01:47 AM
Yah the galaga hack works anywhere on the postbit...

I've got it to show up, and I've gotten it to display images, but its not working properly.
When I make output $RankNum all I get is "2" when I have it set the way it should be, I get the wrong image according to the amount of posts I have...

DeadMan384AD
09-02-2002, 03:33 AM
Ok after a lot of editing, trial and error I've got it to this:

// --- vB Galaga Hack by TommyBoy Modified by DeadMan384AD
if ($bbuserinfo[posts] >= 2000) {
$post[rank] = "<img src=\"images/ranks/34.gif\" border=0>";
}
elseif ($bbuserinfo[posts] >= 100) {
$post[rank] = "<img src=\"images/ranks/7.gif\" border=0>";
}
elseif ($bbuserinfo[posts] >= 75) {
$post[rank] = "<img src=\"images/ranks/6.gif\" border=0>";
}
elseif ($bbuserinfo[posts] >= 50) {
$post[rank] = "<img src=\"images/ranks/5.gif\" border=0>";
}
elseif ($bbuserinfo[posts] >= 25) {
$post[rank] = "<img src=\"images/ranks/4.gif\" border=0>";
}
elseif ($bbuserinfo[posts] >= 10) {
$post[rank] = "<img src=\"images/ranks/3.gif\" border=0>";
}

elseif ($bbuserinfo[posts] >= 5) {
$post[rank] = "<img src=\"images/ranks/2.gif\" border=0>";
}
else {
$post[rank] = "<img src=\"images/ranks/1.gif\" border=0>";
}

// --- vB Galaga Hack by TommyBoy Modified by DeadMan384AD

note- I cut out a huge portion, simply cause I've got a LOT of images...

Everything works fine, it posts, pulls up the proper image according to the post count.... Unfortunatly, its not using the post count of the person who made the post, its using the post count of the user browsing the page! What am I doing wrong?

DeadMan384AD
09-05-2002, 12:20 AM
B - bulletin
U - user
M - Mip-Mapping
P - phorum

g-force2k2
09-05-2002, 05:30 PM
DeadMan384AD try using

$post

not $bbuserinfo ;) regards...

g-force2k2

DeadMan384AD
09-05-2002, 07:37 PM
Excellent! Thank you! :D

Now, should I post this as a completed hack?
Thing is it no longer looks anything like the galaga hack, and you helped a lot... so its not mine so much...

g-force2k2
09-05-2002, 07:41 PM
thats not really my call :p but if its like ubb's galaga hack then cool :) thats one of the features i've seen on ubb's that i've liked... its a cool ranking system... regards...

g-force2k2