DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • March 21, 2019, 08:36:50 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: How To Reset The Prefs Of ALL Players  (Read 474 times)
0 Members and 1 Guest are viewing this topic.
TGTarheel
Mod God
*****
Offline Offline

Posts: 516


View Profile
« 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.
« Last Edit: January 08, 2019, 11:58:08 AM by TGTarheel » Logged
Nightborn
Captain of the Guard
***
Offline Offline

Posts: 218


View Profile WWW
« Reply #1 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".
Logged
TGTarheel
Mod God
*****
Offline Offline

Posts: 516


View Profile
« Reply #2 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.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Play LoGD on Dragonprime

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
21 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search