PDA

View Full Version : [RELEASE] Rank Hack - version 1.0 (think Galaga Hack)


06-24-2000, 12:45 AM
This is first release of the Rank Hack, which is intended to mimic the Galaga Hack of the UBB. It integrates into the vB much like the Avatar hack, where as you can add, modify, and upload new ranks from the administration.

Unlike the Galaga hack, it only displays 1 image, and not several. This can be changed if the request is high enough, otherwise it'll remain as it is.

Download it here - instructions included:
http://www.ffextreme.com/txt/rankhack.zip

For a demo, view:
http://4.3.235.30/forums/showthread.php?threadid=1

The demo is on my computer, so it might not always be available pending on whether or not my computer is on.

Enjoy.

[Edited by Krucifyx on 06-24-2000 at 09:46 AM]

06-24-2000, 11:18 AM
Thanks Krucifyx,

But since I have a bunch of user titles setup I could just add an image tag to them and when the title changes so will the image.

Here is the first request for a fully functional old school Galaga hack :)

06-24-2000, 11:56 AM
Hmm, ok. I really only made the hack to work on my PHP skills, since I only started a week ago or so.

So I'll go disect the original Galaga hack code and take a better look at it so I can figure it out.

Quick vote: The original Galaga hack had only 7 ranks. Should I change the code so that this hack only has 7, but that means you won't be able to add ranks via the admin panel.

I'll mane an alternative version anyway, just because.

06-24-2000, 12:08 PM
Ok, here is the ORIGINAL Galaga hack. It really is very simple. Once I took a look at it, kinda felt silly I spent so much time on the other one. But I still learned a great deal about the vB and PHP.

Anyway, for the instructions. Open showthread.php, search for "$userpostcount=$userinfo[posts];" and underneath it add:


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


Now in the template postbit, add $rank to wherever you want the images to be displayed.

You'll need to download the original zip for the 7 images, or make 7 of your own.

06-24-2000, 06:18 PM
Great. I'll be attempting me first vB hack shortly :)

I'll do the easy part and provide the icons

http://www.tekkenzaibatsu.com/forums/images/galaga/1.gif
http://www.tekkenzaibatsu.com/forums/images/galaga/5.gif
http://www.tekkenzaibatsu.com/forums/images/galaga/10.gif
http://www.tekkenzaibatsu.com/forums/images/galaga/50.gif
http://www.tekkenzaibatsu.com/forums/images/galaga/100.gif
http://www.tekkenzaibatsu.com/forums/images/galaga/500.gif
http://www.tekkenzaibatsu.com/forums/images/galaga/1000.gif

06-25-2000, 06:03 PM
I ran into a problem Krucifyx. The images are dispayed under each other instead of next to each other.

Also the original hack divided posts by 10. The way it is now generates to many images. How can you divided it by 10?

$RankNum = $userpostcount /10; maybe??

06-26-2000, 04:28 PM
Nice hack... i'm replacing my starts addon right now...

For anyone else using this, you'll need to add a { at the end of if ($showranks==1) (typo it seems).

Additionally, the TINYINT fields in the ranks table are limited to 127 (that means no number over 127 will properly save). If you plan to have any ranks go over 127 posts, change TINYINT to INT.

If anyone wants to see an example, check out http://www.scubaboard.com/showthread.php?postid=34 (note: I changed the ranking icons to stars for now).

[Edited by ExtremeFactor on 06-27-2000 at 02:09 AM]

06-26-2000, 06:50 PM
John
"
Rather than code hacking (I'm assuming that this is what you have done) why not just include HTML in the user titles?

eg.

Member<br><img="1star.gif" border=0>

etc.
"

bye

06-26-2000, 07:01 PM
Well, if you have more than 5 users and less than 5 hours of free time a day, you quickly find that not having to change people's profiles every 10 seconds is a rather nice way go to :)

06-26-2000, 08:14 PM
all you would have to do is make a few user title

so if the user has so many posts they go into another group.
when they go into that group say 1000 posts

they get 5 stars or something. so you dont have to edit there PROFILE's at all.
just make a new group and if that person has 1000 posts the person would get put into that group and have this under there name.

Super user<br><img="1star.gif" border=0><img="1star.gif" border=0><img="1star.gif" border=0><img="1star.gif" border=0><img="1star.gif" border=0>

kinda hard to explain. but i think you get the idea.

06-26-2000, 09:23 PM
Oops. Didn't take a few things into consideration when I wrote this. Find:

$RankNum = $userpostcount;

Replace with:

$RankNum = $userpostcount / 10;

Now find:

$rank = $rank . "<br>";

And move it to the line above // --- vB Galaga Hack by TommyBoy

07-04-2000, 09:34 PM
Would someone be so kind and post the totally corrected script to use here? I am somewhat confused when it comes to what to change in the code above and I do not wanna included something which does not work.

Thanks :)

Jan

07-05-2000, 07:30 PM
// --- vB Galaga Hack by TommyBoy
$RankNum = $userpostcount / 10;
$rank = "";
while ($RankNum > 1) {
if ($RankNum > 1000) {
$rank = $rank . "<img src=\"images/ranks/7.gif\" border=0>";
$RankNum -= 1000;
}
elseif ($RankNum > 500) {
$rank = $rank . "<img src=\"images/ranks/6.gif\" border=0>";
$RankNum -= 500;
}
elseif ($RankNum > 100) {
$rank = $rank . "<img src=\"images/ranks/5.gif\" border=0>";
$RankNum -= 100;
}
elseif ($RankNum > 50) {
$rank = $rank ."<img src=\"images/ranks/4.gif\" border=0>";
$RankNum -= 50;
}
elseif ($RankNum > 10) {
$rank = $rank ."<img src=\"images/ranks/3.gif\" border=0>";
$RankNum -= 10;
}
elseif ($RankNum > 5) {
$rank = $rank ."<img src=\"$images/ranks/2.gif\" border=0>";
$RankNum -= 5;
}
else {
$rank = $rank ."<img src=\"images/ranks/1.gif\" border=0>";
$RankNum--;
}
}
$rank = $rank . "<br>";
// --- vB Galaga Hack by TommyBoy

07-05-2000, 11:12 PM
I'm not sure anyone has tried or understands Mafukie's post.
You should be able to do this without any hacking. Simply go to your control panel, and where you create new titles, create each title with some HTML that refers to the ranking images. Each time your user gains a new rank (or is assigned one, such as administrators & moderators) the HTML will automatically show the image. This has the added bonus that mods and admins can have seperate images regardless of how many posts there are. I see no reason why it won't work. Another way in which this app rocks!
Nothing more depressing than an administrator with only one star ;)

07-06-2000, 12:15 AM
Jonny - that is great but it doesn't work for those admins who want all users, including mods, to have the same stars. As soon as you assign someone to be a mod, they get a defined title and you would then have to watch their posts to give them the correct stars. That is where the hack would come in. I don't find it 'depressing' to only have two stars beside my name on my board,.

07-06-2000, 01:01 AM
Ahhh. I understand. This hack is really just to only provide a graphical version of what is currently displayed by the "Posts: ##" text.

07-07-2000, 02:06 PM
I am going nuts cause this just wont work for me :(

This is what I tried pasting in as suggested and all it does when I call the $rank in the postbit template is add another <br> which I guess is the one after images should have been shown...

// --- vB Galaga Hack by TommyBoy
$RankNum = $userpostcount/10;
$rank = "";
while ($RankNum > 1) {
if ($RankNum > 5000) {
$rank = $rank . "<img src=\"$images/star.gif\" border=0> <img src=\"$images/star.gif\" border=0> <img src=\"$images/star.gif\" border=0> <img src=\"$images/star.gif\" border=0> <img src=\"$images/star.gif\" border=0> <img src=\"$images/star.gif\" border=0>";
$RankNum -= 5000;
}
elseif ($RankNum > 2500) {
$rank = $rank . "<img src=\"$images/star.gif\" border=0> <img src=\"$images/star.gif\" border=0> <img src=\"$images/star.gif\" border=0> <img src=\"$images/star.gif\" border=0> <img src=\"$images/star.gif\" border=0>";
$RankNum -= 2500;
}
elseif ($RankNum > 2000) {
$rank = $rank . "<img src=\"images/star.gif\" border=0> <img src=\"images/star.gif\" border=0> <img src=\"images/star.gif\" border=0> <img src=\"images/star.gif\" border=0>";
$RankNum -= 2000;
}
elseif ($RankNum > 1500) {
$rank = $rank ."<img src=\"images/star.gif\" border=0> <img src=\"images/star.gif\" border=0> <img src=\"images/star.gif\" border=0>";
$RankNum -= 1500;
}
elseif ($RankNum > 1000) {
$rank = $rank ."<img src=\"images/star.gif\" border=0> <img src=\"images/star.gif\" border=0>";
$RankNum -= 1000;
}
elseif ($RankNum > 500) {
$rank = $rank ."<img src=\"images/star.gif\" border=0> ";
$RankNum -= 500;
}
else {
$rank = $rank ." ";
$RankNum--;
}
}
$rank = $rank . "<br>";
// --- vB Galaga Hack by TommyBoy

Please tell me what I am missing?

Jan

[Edited by Jan on 07-07-2000 at 11:07 AM]

07-07-2000, 02:16 PM
In some places you have '$images/star.gif' and in others you have 'images/star.gif' - remove the '$' from the '$images/star.gif' and did you upload a 'star.gif' to your images directory?

It also appears you are just trying to use it as a stars hack? Look at mine as it more concise than what you have

http://www.vbulletin.com/forum/showthread.php?threadid=1368

[Edited by rangersfan on 07-07-2000 at 11:18 AM]

07-07-2000, 02:19 PM
I found and corrected the $images problem which also was in the hack as it was posted above. Yes the images is there... If it wasn't would I just get a broken one, no?

Its like it ignores the various options and simply put what the same for all of them namely the <br> tag...

07-07-2000, 04:13 PM
You are getting just a <br> as you probably don't have any users with >5000 posts. Well let's take a look at what the code does:

You won't see any stars until you have over 5000 posts as your lowest count is 500 and you are dividing posts by 10 to get your count. You really need to adjust your totals or just not divide posts by 10 at all as it still appears you are trying to use this as a stars hack and not a rank hack. The two are not the same as the rank hack changes the graphics around to a 'higher' rank while the stars hack just keeps adding stars.

Are you wanting this:

>500 Posts 1 Star
>1000 Posts 2 Stars
>1500 Posts 3 Stars
>2000 Posts 4 Stars
>2500 Posts 5 Stars
>5000 Posts 6 Stars

If you take out the divide by ten part you will still have anamolies by using this code as you are. Say a user has 3500 Posts - They would end up with 7 stars because of that while loop! 3600 Posts and they get 7 stars and 100 spaces after the stars. Do you really want that sort of behaviour?