Limestone Posted January 31, 2013 Group: Members Topic Count: 155 Topics Per Day: 0.03 Content Count: 647 Reputation: 16 Joined: 11/21/11 Last Seen: December 28, 2022 Share 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 Link to comment Share on other sites More sharing options...
goddameit Posted February 1, 2013 Group: Members Topic Count: 60 Topics Per Day: 0.01 Content Count: 562 Reputation: 219 Joined: 11/22/11 Last Seen: August 3, 2024 Share 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 Link to comment Share on other sites More sharing options...
Limestone Posted February 1, 2013 Group: Members Topic Count: 155 Topics Per Day: 0.03 Content Count: 647 Reputation: 16 Joined: 11/21/11 Last Seen: December 28, 2022 Author Share 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 Link to comment Share on other sites More sharing options...
Emistry Posted February 2, 2013 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Yesterday at 05:32 PM Share Posted February 2, 2013 like this ? http://pastebin.com/raw.php?i=qxsTXmqB Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted February 2, 2013 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share 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 Link to comment Share on other sites More sharing options...
Limestone Posted February 3, 2013 Group: Members Topic Count: 155 Topics Per Day: 0.03 Content Count: 647 Reputation: 16 Joined: 11/21/11 Last Seen: December 28, 2022 Author Share Posted February 3, 2013 Thank you Annie. Working Great, but im confused with this? can you explain what is this? Quote Link to comment Share on other sites More sharing options...
Capuche Posted February 3, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share 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 Link to comment Share on other sites More sharing options...
AnnieRuru Posted February 3, 2013 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share 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 Link to comment Share on other sites More sharing options...
Limestone Posted February 6, 2013 Group: Members Topic Count: 155 Topics Per Day: 0.03 Content Count: 647 Reputation: 16 Joined: 11/21/11 Last Seen: December 28, 2022 Author Share Posted February 6, 2013 thank you annie :3 Quote Link to comment Share on other sites More sharing options...
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!
Link to comment
Share on other sites
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.