Home Community Mys-Script Creative Off-Topic |
|
|
Thread Tools | Display Modes |
#1
|
||||
|
||||
Abron's Background Mod
Hey all!
So I got this feature fully functional on my website and figured I would share it with you all! This is loosely inspired by Hwona's BG Mod for 1.3.3, but this version is strictly for 1.3.4. What This Mod Does Lets admins create backgrounds as items for users to purchase/get/etc The item image is the background (the script uses the image URL) Users can assign background to a pet, only one at a time Users can remove an assigned background, and have it readded to their inventory Users cannot assign a background to a pet that already has a background They cannot remove a background if the pet doesn't have a background Now let's get started! The first thing we're going to do is make a new item function. Go into your database and run the following SQL: PHP Code:
Now let's open up the file functions/functions_items, scroll all the way to the bottom and paste this just before the closing ?> tag. PHP Code:
Lastly for the item function go into classes/class_privateitem and paste this bit before the default case, under public function apply: PHP Code:
Time for another database edit. Go to phpmyadmin and go to adopts_owned_adoptables. Go to structure and click to add one (1) column to the end of the table. Enter these details: Name: adoptbackground Type: varchar(500) Collation: latin1_swedish_ci Null: YES Default: AS DEFINED: http://YOURSITE.COM/backgrounds/default.png That done, let's head on to the remove function. Open up your myadopts.php file and paste this after the closing } of the freeze function: PHP Code:
Now for the "fun" part (that gave me a headache for three days). Go into your view/myadoptsview file and add this after the closing } of the freeze function: PHP Code:
Code:
<a href='../../myadopts/removebg/{$aid}'>Remove Background</a> Now to put the background into use! Overall it is really easy, you can simply call it through this: $this->adopt->adoptbackground OR $adopt->adoptbackground I set it up in my pet profiles this way: PHP Code:
Finally, to add a background! Upload your background image wherever (doesn't really matter), and go into your AdminCP to add a new item. Make the background item consumable and obviously set the function type to background. The Item Image is what the background itself will appear as. IMPORTANT NOTE ABOUT BACKGROUND SIZES I HIGHLY advise you make all backgrounds the same size, and base that size off of the largest pet image used on your website. It'll look wonky otherwise. Alright, that should be everything! If anyone has any questions/comments/concerns, please let me know!
__________________
My Mods Site (1.3.4, 2020 Mods) |
|
|
What's New? |
What's Hot? |
What's Popular? |