![]() |
Home Community Mys-Script Creative Off-Topic |
|
![]() |
|
Thread Tools | Display Modes |
#1
|
||||
|
||||
![]()
Resolved
Apparently the moreless condition is not working for adoptables on my website. For several adoptables I have the limit set to 1 or 2, and yet users are able to adopt 10+ with no issue (and looking through old threads I see this has been an issue for a while now). Note; this is only happening for Promo and shop adoptables, the condition is working just fine for free adoptables not sold in shops. Looking through the files I believe this is because only adopt.php has the code that tells it to check the conditions before making the adoptable available. Shops and promocodes do not have this code, so they don't bother checking, which results in users being able to get as many of pets sold in shops and through promocodes as they like. Does anyone know how to fix this? It's kind of really messed up the values of pets on my website. I'm going to be playing with it a bit and see if I can get it to work, so if I find it before someone else does then I will post it. --- Here are the two snippets I found in adopt.php; PHP Code:
PHP Code:
---- Now looking at the file .../classes/class_adoptshop.php I think that the conditions snippet should be included in the display function (which I've snipped to show below), so that the code can check conditions, and if the user HAS met the moreless limit, then the adoptable is no longer displayed in the shop at all. I'm still not sure about this (as you all likely know I'm very uneducated with PHP), but I'm hoping that my speculations aren't too off. PHP Code:
__________________
My Mods Site (1.3.4, 2020 Mods) Last edited by Abronsyth; 02-18-2016 at 02:49 PM. |
#2
|
||||
|
||||
![]()
Well I understand what you are saying, but this is in fact an intended behavior, not an issue. The adoptable condition is for adoption, which means it only applies when you 'adopt' a pet. If you obtain it through other means such as promocode, shop or breeding, the limit is bypassed, since you are not actually 'adopting' a pet. There is a reason why I initially did not make the adoptable shop in Mys v1.3.0 and v1.3.1(it only appeared after v1.3.2), since it leads to conflicts and confusion about adoptable conditions.
Of course, there is a way to alter this behavior if you want to, and it wont be difficult to achieve.
__________________
![]() Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
#3
|
||||
|
||||
![]()
Oh, alright. Do you know how I'd be able to achieve it so that conditions are not bypassed?
Thank you, Abronsyth Is there at least a simplistic way to change it so that the availability feature for promocodes is per user, and not how many times in total the promocode can be redeemed (so if I set it to "1" then each user can only redeem it once)?
__________________
My Mods Site (1.3.4, 2020 Mods) |
#4
|
||||
|
||||
![]()
If anyone here is able to do this I'm very willing to pay, it's very necessary that I can have these features (limited number of each adopt available in stores that can be purchased, and making it so the admin can determine the number of times each individual can redeem a specific promocode) for some of my site activities (riddles and seasonal specials) to work.
__________________
My Mods Site (1.3.4, 2020 Mods) |
#5
|
||||
|
||||
![]()
The only way I can think of is to have a separate table in the database that will hold information about whether a user has ever activated a code before. It'd have users as rows (obviously), but must have all the promo codes as columns. Every time you make a new limited promocode you'd have to add another column to that table. The checks would be as simple as 'has the user activated this code more than 0 times?' - and any limit could work, if you wanted to limit some things to other amounts.
The users would be automatically be added to the table only after the first time they adopt a limited pet, so you needn't add any manually. Here's vaguely where my thoughts lead me. Create a table in the database (can run this SQL) - Code:
CREATE TABLE IF NOT EXISTS `adopts_limitedpromos` ( `pcid` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(30) NOT NULL, `examplecode1` int(11) NOT NULL DEFAULT '0', `examplecode2` int(11) NOT NULL DEFAULT '0', `examplecode3` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`pcid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; PHP Code:
![]()
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it. |
![]() |
|
|
What's New? |
What's Hot? |
What's Popular? |