Jump to content
  • 0

R> delete on char_reg_num on a specific time


Leic

Question


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  48
  • Reputation:   0
  • Joined:  02/27/18
  • Last Seen:  

requesting for all "dailysupply" in char_reg_num to be deleted on all characters every 00:00 server time

Edited by Leic
Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

HAHAHA I just answer this question on the discord yesterday

I just copy paste the chat log then

 

Question : (Hyperion)

how to reset the #BOSSNIAPOINTS using sql?

i want to reset all players

 

Answer : (me)

actually there's a misconception that "I want to reset the variable" so I attachrid everyone and remove the variable from sql

this method is wrong, or should I say this method consume a lot of server resources on your server

the correct method is give it an ID, if the player doesn't match the ID, only remove that player

 

http://upaste.me/4b0f495947cad8c0f

the test1 example will tries to execute the SQL table, and because the key column isn't indexed (check main.sql file)

it will perform a full table search and, if you run this query in a live server, with over 500,000 rows ... this can lag on your server

also, addrid is evil, hercules doesn't even has this script command, it also promote bad scripting habit

2nd thing, there's also a catch, as you can see, it runs on OnClock0000: , which means if somehow your live server is under maintenance or shut down at the time

that label isn't run at all

its better to use another ID like in my example, since it reset daily, I hack it with gettime


Question : (Hyperion)

UPDATE acc_reg_num SET value=0 WHERE 'key'="#BOSSNIAPOINTS"

Answer : (me)

nope, com'on ... in *athena script language ... 0 = null

setting a variable into 0 means delete that variable, but SQL isn't like that,

SQL 0 != null


.

.

.

why pajodex today can do exactly like what I have predicted yesterday ?

maybe I have super power /ok

check the upaste date, it was yesterday

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  436
  • Reputation:   167
  • Joined:  12/12/17
  • Last Seen:  

41 minutes ago, Leic said:

requesting for all "dailysupply" in char_reg_num to be deleted on all characters every 00:00 server time

OnClock0000:
	query_sql("UPDATE `char_reg_num` SET `value` = '0' WHERE `key` ='dailysupply'");
		addrid(0);
		dailysupply = 0;
	end;

 

Edited by pajodex
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  48
  • Reputation:   0
  • Joined:  02/27/18
  • Last Seen:  

20 minutes ago, pajodex said:

OnClock0000:
	addrid(0);
		dailysupply = 0;
	end;

 

just for clarification, will this be repeatable every set time?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  48
  • Reputation:   0
  • Joined:  02/27/18
  • Last Seen:  

odd

 

tested it, still has dailysupply on char_reg_num

 

(edit) nvm forgot 1 curly

Edited by Leic
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  436
  • Reputation:   167
  • Joined:  12/12/17
  • Last Seen:  

22 minutes ago, Leic said:

just for clarification, will this be repeatable every set time?

yup depends on your wanting

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  48
  • Reputation:   0
  • Joined:  02/27/18
  • Last Seen:  

i hope i could join your discord too :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...