iZeal Posted August 1, 2014 Posted August 1, 2014 Hello Guys, I'm trying to modify a script for max level reward but I'm stuck on sql query. regarding checking if how many key entry are already inside acc_reg_num_db like for example it will check if there is already 50 entry of #99reward Thanks in advance. Quote
Euphy Posted August 1, 2014 Posted August 1, 2014 SQL has a 'COUNT()' function: http://www.w3schools.com/sql/sql_func_count.asp Though I suggest you just keep a global variable instead (and sync it with SQL if necessary once when the server starts), since there's no point running the query repeatedly--that'd be much slower than checking a global. Quote
iZeal Posted August 1, 2014 Author Posted August 1, 2014 I'm doing this for my race to lvl 99 reward because it's only for 1 claim per account., and it's only meant for 100 players else if 100 players already claimed the npc will hide. that's why I'm using #99reward because I restrict for account. Quote
Euphy Posted August 1, 2014 Posted August 1, 2014 So use a global variable ($var) to keep track of how many players have gotten the reward, i.e. increment it every time you give one. Much simpler than counting database entries. Quote
iZeal Posted August 2, 2014 Author Posted August 2, 2014 if i use that maybe it will not be 1 per account.? Quote
Cydh Posted August 2, 2014 Posted August 2, 2014 if i use that maybe it will not be 1 per account.? $ <- global var # <- account var Quote
Capuche Posted August 2, 2014 Posted August 2, 2014 sth like this if ( #reward_account ) { mes "already claimed"; close; } getitem ... $total_claimed++; if ( $total_claimed > 100 ) disablenpc Quote
Question
iZeal
Hello Guys, I'm trying to modify a script for max level reward
but I'm stuck on sql query.
regarding checking if how many key entry are already inside acc_reg_num_db
like for example it will check if there is already 50 entry of #99reward
Thanks in advance.
6 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.