DragonPrime - LoGD Resource Community

Coding Support => Coding Support Desk => Topic started by: TGTarheel on January 07, 2019, 06:10:19 PM



Title: How To Reset The Prefs Of ALL Players
Post by: TGTarheel on January 07, 2019, 06:10:19 PM
OK, so there is a module out there that creates Disasters in villages.

There's even notes in the coding that says it is to reset the prefs, but it does not seem to reset them.

The problem is...after a Disaster is cleared, everyone who helped, is paid gold per turn they helped.  But the prefs don't reset...so you end up being paid for every turn you helped on every disaster.

I need coding that, when a Disaster is cleared...it will pay everyone...and THEN...reset the prefs on the module for ALL players - so that each time you are paid ONLY for the turns you worked on the current Disaster...and not on every Disaster you ever worked.

I could easily reset the prefs of the player that ends the Disasyer, but how to reset them for ALL players?

In hunting around some I mighta found something...I found something generic which I would need to change...

db_query("DELETE FROM ".db_prefix("module_userprefs")." WHERE modulename = 'YOUR_MODULE' AND setting = 'blah_blah_blah'");

I'd replace YOUR_MODULE with the name of the module
and
Setting with the actual name of the setting...right?

Just want to know for sure before I do this and screw something up.


Title: Re: How To Reset The Prefs Of ALL Players
Post by: Nightborn on January 13, 2019, 12:30:36 PM
I highly suggest copying your database + testing such things there =) if you don't have a test server.

On another note: Yes, your query looks sound, but you could drop "AND setting", if you want to reset ALL prefs. Else you just reset the setting "blah_blah_blah".


Title: Re: How To Reset The Prefs Of ALL Players
Post by: TGTarheel on January 14, 2019, 01:21:15 AM
I highly suggest copying your database + testing such things there =) if you don't have a test server.

On another note: Yes, your query looks sound, but you could drop "AND setting", if you want to reset ALL prefs. Else you just reset the setting "blah_blah_blah".

I have a test server.  I just wanted to know about this because of the setting thing.  The only value I want to reset is how many turns all players worked...that way they are not paid for turns helped on previous disasters again.

© 2019 DragonPrime - LoGD Resource Community
Email Talisman: talisman -at- gmail.com
&oeXs)2U7=V BmܲV.U e=;p\}eG )Jj} C5EH7ˤH=j } mo|*Ŋw{drV_@IV>/- TFQJ׀̀Ve}l1,V O iNYx͘$e$;
Forums: Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines