PHP Code for checking weapon images.
Soooo I got bored and wrote up a tiny bit of php that checks the servers for the weapon icons (the images with the green backgrounds you get on the clan page). Thought I'd be nice and share it!
Here's a test of it in action: http://rory.modhub.org/test/ (please note I do not plan to keep this up for very long so if it's not what this thread states then I've changed or removed it). The code does not include the styling/menus/layout of the website.
Here's the code:
If you want to know what this does/how this works I can explain below if asked!
Enjoy!
Here's a test of it in action: http://rory.modhub.org/test/ (please note I do not plan to keep this up for very long so if it's not what this thread states then I've changed or removed it). The code does not include the styling/menus/layout of the website.
Here's the code:
<?php
$num=0;
while($num<=600)
//Change above # to change # of image checks.
{
$num=str_pad(num,4,"0",STR_PAD_LEFT);
echo "<img src='http://clan.z8games.com/images/weaponimages/C$i.jpg'> ";
$num++;
}
?>
This code requires a web server to run, it will not work on a local machine.If you want to know what this does/how this works I can explain below if asked!
Enjoy!
Comments
-
I'll assume you know what PHP is.
The most important line is the line that begins with "echo". The echo command prints the rest of the line(in this case onto a web page). The rest of the line is how you print an image in regular html that is located at http://clan.z8games.com/images/weaponimages/C$num.jpg where $num is a variable.
This num is cycled through 0-600 so that 600 different weapons images can be printed with this one loop. The line above the echo formats the $num by putting leading 0s in front.
That any clearer? -
I'll assume you know what PHP is.
The most important line is the line that begins with "echo". The echo command prints the rest of the line(in this case onto a web page). The rest of the line is how you print an image in regular html that is located at http://clan.z8games.com/images/weaponimages/C$num.jpg where $num is a variable.
This num is cycled through 0-600 so that 600 different weapons images can be printed with this one loop. The line above the echo formats the $num by putting leading 0s in front.
That any clearer?
Of course not. Go slower. I'm a complete beginner here.
Categories
- All Categories
- Z8Games
- Off-Topic - Go To Game OT Forums
- 1 Z8 Forum Discussion & Suggestions
- 16 Z8Games Announcements
- Rules & Conduct
- 5.2K CrossFire
- 955 CrossFire Announcements
- 945 Previous Announcements
- 2 Previous Patch Notes
- 1.4K Community
- 122 Modes
- 602 Suggestions
- 85 Clan Discussion and Recruitment
- 274 CF Competitive Forum
- 19 CFCL
- 26 Looking for a Team?
- 705 CrossFire Support
- 52 Suggestion
- 116 Bugs
- 29 CrossFire Guides
- 166 Technical Issues
- 47 CrossFire Off Topic