Little Badge Script [PlusEMU]
This is just a simple thing which may help some people as it has myself
I was reading up on some stuff and managed to come together with this after compiling together some examples I found
This will auto give you the queries so you can just truncate your badge_definitions table and run this and it will make sure every badge works
If anyone wants to expand on this to make it search for if the badge already exists and skips that query from showing to stop duplicates so you dont have to truncate everytime It would be highly appreciated because its 5am for me right now and my mind isnt so fresh
Just replace DATABASENAME with your database name
PHP Code:
<?php
$target = "c_images/album1584/";
$weeds = array('.', '..');
$directories = array_diff(scandir($target), $weeds);
foreach($directories as $value)
{
$gifkill=str_replace('.gif', '', $value);
$gif2kill=str_replace('.GIF', '', $gifkill);
$uppercasewords=ucwords($gif2kill);
if(is_file($target.$value))
{
echo "INSERT INTO `DATABASENAME`.`badge_definitions` (`code`, `required_right`) VALUES ('".$uppercasewords."', '');<br />";
}
}
?>
Re: Little Badge Script [PlusEMU]
PHP Code:
$gifkill=str_replace('.gif', '', $value);
$gif2kill=str_replace('.GIF', '', $gifkill);
you can easily make
PHP Code:
$gif2kill = str_replace(['.gif', '.GIF'], '', $value);
Re: Little Badge Script [PlusEMU]
Quote:
Originally Posted by
iExit
PHP Code:
$gifkill=str_replace('.gif', '', $value);
$gif2kill=str_replace('.GIF', '', $gifkill);
you can easily make
PHP Code:
$gif2kill = str_replace(['.gif', '.GIF'], '', $value);
cheers dude, I was so tired last night I just left it as it was but thanks for that
Re: Little Badge Script [PlusEMU]
Ah an interesting tool,
I fixed it by changing the BadgeDefenition class in the emu, haven't even thought of this.
Good job
Re: Little Badge Script [PlusEMU]
Quote:
Originally Posted by
</Meap>
cheers dude, I was so tired last night I just left it as it was but thanks for that
what is the solution for remove to badgeclass
Re: Little Badge Script [PlusEMU]
Quote:
Originally Posted by
venezuelamix
what is the solution for remove to badgeclass
What do you mean solution to remove badge class?
This method is also possible:
PHP Code:
define('DATABASENAME', 'habbo'); // change this to your database name
$get = glob('c_images/album1584/*.{gif,GIF}', GLOB_BRACE);
foreach($get as $badge){
if(is_file($badge)){
echo "INSERT INTO `".DATABASENAME."`.`badge_definitions` (`code`, `required_right`) VALUES ('".basename($badge, '.gif')."', '');";
echo '<br />';
}
}