Limestone Posted January 31, 2013 Posted January 31, 2013 guys! can you help me fix my script? urgent. need help here's my script http://pastebin.com/raw.php?i=egyMJJpS @problem: how can i add a npc that checks all registered premium users. and what day/hour/minute/seconds their premium will be expired. only gm 99 can check all registered premium users. thank you so much! Quote
goddameit Posted February 1, 2013 Posted February 1, 2013 (edited) #PremiumUser all kind of this variable will be recorded in to table `global_reg_value`, you just need to use query_sql to pick up them where `str` is '#PremiumUser' and `value` bigger than zero . Edited February 1, 2013 by goddameit Quote
Limestone Posted February 1, 2013 Author Posted February 1, 2013 (edited) can you give me a sample (too noob in scripting) :3 Edited February 2, 2013 by AnnieRuru move to script request Quote
Emistry Posted February 2, 2013 Posted February 2, 2013 like this ? http://pastebin.com/raw.php?i=qxsTXmqB Quote
AnnieRuru Posted February 2, 2013 Posted February 2, 2013 (edited) query_sql "UPDATE login SET `group_id`=0 WHERE account_id="+getcharid(3); I don't think this is the correct way to change a gm group unless ask the player to relog after using the item like atcommand "@kick "+ strcharinfo(0) or something to refresh the group db perhaps use @adjgroup - script lasdlkasdla -1,{ OnInit: .page = 2; bindatcmd "list_premium", strnpcinfo(0)+"::Onaaa", 99, 100; end; Onaaa: query_sql "select count(1) from global_reg_value where str = '#PremiumUser'", .@total; while (1) { .@nb = query_sql( "select account_id as a, ( select name from `char` where account_id = a limit 1 ), value from global_reg_value where str = '#PremiumUser' limit "+ .page +" offset "+ .@currentpage * .page, .@aid, .@name$, .@value ); mes "current page no."+( .@currentpage +1 )+". total "+ ( .@total / .page +1 ) +" pages"; for ( .@i = 0; .@i < .@nb; .@i++ ) mes ( .@currentpage * .page + .@i +1 ) +". "+ .@name$[.@i] +" ["+ .@aid[.@i] +"] -> "+ .@value[.@i]; next; if ( select( "next", "previous" ) == 1 ) { if ( .page * ( .@currentpage +1 ) < .@total ) .@currentpage++; else { mes "end of page"; close; } } else { if ( .@currentpage ) .@currentpage--; else { mes "start of the page"; close; } } } close; // doesn't reach } just make for fun ... EDIT: lol ... post up the wrong script Edited February 2, 2013 by AnnieRuru Quote
Limestone Posted February 3, 2013 Author Posted February 3, 2013 Thank you Annie. Working Great, but im confused with this? can you explain what is this? Quote
Capuche Posted February 3, 2013 Posted February 3, 2013 (edited) It's the time in seconds of #PremiumUser variable. Use callfunc("Time2Str",<your value>); to display in days/hour/min/secs Edited February 3, 2013 by Capuche Quote
AnnieRuru Posted February 3, 2013 Posted February 3, 2013 // ~~~~~ show time left in days, hours, minutes and seconds ~~~~~ function script timeleft__ { if ( ( .@left = getarg(0) ) <= 0 ) return getarg(0); .@day = .@left / 86400; .@hour = .@left % 86400 / 3600; .@min = .@left % 3600 / 60; .@sec = .@left % 60; if ( .@day ) return .@day +" day "+ .@hour +" hour"; else if ( .@hour ) return .@hour +" hour "+ .@min +" min"; else if ( .@min ) return .@min +" min "+ .@sec +" sec"; else return .@sec +" sec"; } - script lasdlkasdla -1,{ OnInit: .page = 2; bindatcmd "list_premium", strnpcinfo(0)+"::Onaaa", 99, 100; end; Onaaa: query_sql "select count(1) from global_reg_value where str = '#PremiumUser'", .@total; while (1) { .@nb = query_sql( "select account_id as a, ( select name from `char` where account_id = a limit 1 ), value from global_reg_value where str = '#PremiumUser' limit "+ .page +" offset "+ .@currentpage * .page, .@aid, .@name$, .@value ); mes "current page no."+( .@currentpage +1 )+". total "+ ( .@total / .page +1 ) +" pages"; for ( .@i = 0; .@i < .@nb; .@i++ ) mes ( .@currentpage * .page + .@i +1 ) +". "+ .@name$[.@i] +" ["+ .@aid[.@i] +"] -> "+ callfunc( "timeleft__", .@value[.@i] - gettimetick(2) ) ; next; if ( select( "next", "previous" ) == 1 ) { if ( .page * ( .@currentpage +1 ) < .@total ) .@currentpage++; else { mes "end of page"; close; } } else { if ( .@currentpage ) .@currentpage--; else { mes "start of the page"; close; } } } close; // doesn't reach } to be honest ... that Time2Str is made after my timeleft__ function ... my timeleft__ function made together with itemlist function made 4 years ago but Time2Str function only added 2 years ago and its display method doesn't suit my taste ( I think it display according to official ? ) if the .@Time_Left is at 86402 my timeleft__ function display "1 day 0 hour" Time2Str display "1 day, 2 seconds", without telling anything about hour or minute Quote
Question
Limestone
guys! can you help me fix my script? urgent. need help
here's my script
http://pastebin.com/raw.php?i=egyMJJpS
@problem:
how can i add a npc that checks all registered premium users. and what day/hour/minute/seconds their premium will be expired.
only gm 99 can check all registered premium users.
thank you so much!
8 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.