donkeyg Posted December 4, 2012 Group: Members Topic Count: 344 Topics Per Day: 0.07 Content Count: 1060 Reputation: 1 Joined: 02/13/12 Last Seen: November 14, 2016 Share Posted December 4, 2012 izlude,136,126,4 script GM Online Lists 871,{ mes "Staffs Online Lists : ^FF0000"+getarraysize( .GM_Name$ )+"^000000 Staffs"; mes "^0000FF_________________^000000"; for( set .@i,0; .@i < getarraysize( .GM_Name$ ) ; set .@i,.@i + 1 ){ getmapxy( .Map$,.x,.y,0,.GM_Name$[.@i] ); mes "[ Lv ^63D1F4"+.GM_Level[.@i]+"^000000 ] ^FF0000@ ^0000FF"+.GM_Name$[.@i]+"^000000"; mes "^0000FF_____________________________^000000"; } close; OnInit: set .MinGMLevel,3; // Min. GM Level to Show in Online Lists end; OnPCLoginEvent: if( getgmlevel() < .MinGMLevel ) end; set .GM_Name$[ getarraysize( .GM_Name$ ) ],strcharinfo(0); set .GM_Level[ getarraysize( .GM_Level ) ],getgmlevel(); end; OnPCLogoutEvent: if( getgmlevel() < .MinGMLevel ) end; for( set .@i,0; .@i < getarraysize( .GM_Name$ ) ; set .@i,.@i + 1 ){ if( strcharinfo(0) != .GM_Name$[.@i] ) continue; deletearray .GM_Name$[.@i],1; deletearray .GM_Level[.@i],1; end; } end; } how to add More GMs? Quote Link to comment Share on other sites More sharing options...
x13th Posted December 4, 2012 Group: Members Topic Count: 55 Topics Per Day: 0.01 Content Count: 206 Reputation: 14 Joined: 11/20/11 Last Seen: April 9, 2024 Share Posted December 4, 2012 (edited) I think it will trigger all GM Level => 3 so you don't need to add Edited December 4, 2012 by x13th Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted December 7, 2012 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 December 7, 2012 the data might get manipulate by @loadnpc or @reloadscript ... but its kinda a rare bug though ... nvm prontera,154,178,5 script kjhfksdjf 100,{ .@min_gm_level = 3; .@nb = query_sql( "select name, group_id from `char` left join login on `char`.account_id = login.account_id where online = 1 and group_id >= "+ .@min_gm_level, .@name$, .@level ); mes "Staffs Online Lists : ^FF0000"+ .@nb +"^000000 Staffs"; mes "^0000FF_________________^000000"; for ( .@i = 0; .@i < .@nb; .@i++ ) { mes "[ Lv ^63D1F4"+ .@level[.@i] +"^000000 ] ^FF0000@ ^0000FF"+ .@name$[.@i] +"^000000"; mes "^0000FF_____________________________^000000"; } close; } what's getmapxy( .Map$,.x,.y,0,.GM_Name$[.@i] ); doing there actually ? Quote Link to comment Share on other sites More sharing options...
Ryokem Posted December 7, 2012 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 205 Reputation: 19 Joined: 10/12/12 Last Seen: November 7, 2013 Share Posted December 7, 2012 what's getmapxy( .Map$,.x,.y,0,.GM_Name$[.@i] ); doing there actually ? Haha nice question! xD prontera,154,178,5 script kjhfksdjf 100,{ .@min_gm_level = 3; .@nb = query_sql( "select name, group_id from `char` left join login on `char`.account_id = login.account_id where online = 1 and group_id >= "+ .@min_gm_level, .@name$, .@level ); mes "Staffs Online Lists : ^FF0000"+ .@nb +"^000000 Staffs"; mes "^0000FF_________________^000000"; for ( .@i = 0; .@i < .@nb; .@i++ ) { mes "[ Lv ^63D1F4"+ .@level[.@i] +"^000000 ] ^FF0000@ ^0000FF"+ .@name$[.@i] +"^000000"; mes "^0000FF_____________________________^000000"; } close; } Dropping into sql queries is somehow slow if there is not the need.Also, I don't really see the need of using OnPCLogin event as well. Just build an array and check if all GMs in that array are online or not, with Isloggedin function. I don't really think that you hire GM staff every day, so just modify it whenever you will hire someone else. Quote Link to comment Share on other sites More sharing options...
Emistry Posted December 7, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted December 7, 2012 what's getmapxy( .Map$,.x,.y,0,.GM_Name$[.@i] ); doing there actually ? actually...the script the originally will show the location of the gm ... but he removed it.. the reason i didnt update it with group_id ...because...in rAthena...certain group_id doesnt belong to GM ... i know sql can add a condition clause to check for specific range of group_id ...but sometime...newbie just cant figure out how.... for array .... i didnt use it because...i am lazy to edit the array from time to time... just set a gm level at the initial load...then when ever there is new gm or etc...it will be displayed... beside...there are some benefit for using auto check instead of array.... for example..server suddenly have 1 new "extra GM" ? which shouldnt exist ? then admin will know about this..LOL Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted December 7, 2012 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 December 7, 2012 (edited) Dropping into sql queries is somehow slow if there is not the need.only this one makes sense ...the rest ... have to disagree prontera,154,178,5 script kjhfksdjf 100,{ mes "Staffs Online Lists : ^FF0000"+ .total_gm +"^000000 Staffs"; mes "^0000FF_________________^000000"; for ( .@i = 0; .@i < .total_gm; .@i++ ) { mes "[ Lv ^63D1F4"+ .level[.@i] +"^000000 ] ^FF0000@ ^0000FF"+ .name$[.@i] +"^000000"; mes "^0000FF_____________________________^000000"; } close; OnInit: OnPCLoginEvent: OnPCLogoutEvent: .@min_gm_level = 3; // minimum GM level if ( playerattached() ) if ( getgmlevel() < .@min_gm_level ) end; .total_gm = query_sql( "select name, group_id from `char` left join login on `char`.account_id = login.account_id where online = 1 and group_id >= "+ .@min_gm_level, .name$, .level ); end; } maybe something like this ? for example..server suddenly have 1 new "extra GM" ? which shouldnt exist ? then admin will know about this..LOLyeah yeah ... I'm agreeing this pointEDIT for below :-- .... no words to say about that <.< there are certain experience can only gain from working in live private server ... like making bug-less event script.... Edited December 7, 2012 by AnnieRuru Quote Link to comment Share on other sites More sharing options...
Ryokem Posted December 7, 2012 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 205 Reputation: 19 Joined: 10/12/12 Last Seen: November 7, 2013 Share Posted December 7, 2012 (edited) for example..server suddenly have 1 new "extra GM" ? which shouldnt exist ? then admin will know about this..LOL lol. <.<" Edited December 7, 2012 by Ryokem Quote Link to comment Share on other sites More sharing options...
Emistry Posted December 7, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted December 7, 2012 erm.....annie's method is post#6 somehow..i feel like....it's now the same like how my script work..but i think my script would be more resource friendly... because..annie script will keep run the SQL Query everytime player login or logout....and return the same result....unless i missed something from the script ? ^^ btw...for checking group_id in rAthena....personally i would like to using th IN() Operator instead of checking the value is Greater / Lower... just in case the admin didnt organize the group_id in such an order....xD actually i did like this... haha normal player..but group_id 98.. gm..but group_id 3... LOL Quote Link to comment Share on other sites More sharing options...
Ryokem Posted December 7, 2012 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 205 Reputation: 19 Joined: 10/12/12 Last Seen: November 7, 2013 Share Posted December 7, 2012 (edited) for example..server suddenly have 1 new "extra GM" ? which shouldnt exist ? then admin will know about this..LOLyeah yeah ... I'm agreeing this point Seriously, how can you agree on this point? There are 1000 ways to check it, with simple debug messages, not needed in an "online check GM"... real. That's disappointing from a great scripter like you... Hope you were sarcastic... Also, abusing of database queries is bad, running query_sql each time a person log in or out is more than a pain... the heap will explode, really. And even if it's a solution, I still believe that it is completely not necessary even to use OnPCLoginEvent for those kind of script. Is really a server going to hire new GMs every day? Edited December 7, 2012 by Ryokem Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted December 7, 2012 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 December 7, 2012 (edited) because..annie script will keep run the SQL Query everytime player login or logout....and return the same result....unless i missed something from the script ? ^^ my script has if ( playerattached() ) if ( getgmlevel() < .@min_gm_level ) end; which practically runs query_sql (updating the list) ONLY when the gm level condition is met btw...for checking group_id in rAthena....personally i would like to using th IN() Operator instead of checking the value is Greater / Lower... just in case the admin didnt organize the group_id in such an order....xD actually i did like this... haha normal player..but group_id 98.. gm..but group_id 3... you just reminded me about this topic ... updated script type 1 prontera,158,187,5 script asdasd2 100,{ input .@str$; dispbottom ( callfunc( "int_range__", .@str$, getgmlevel() )? "True":"False" )+" "+ .@str$ +" "+ getgmlevel(); } function script int_range__ { if ( compare( getarg(0), "," ) ) explode .@range$, getarg(0), ","; else .@range$ = getarg(0); .@size = getarraysize( .@range$ ); while ( .@i < .@size ) { if ( compare( .@range$[.@i], "~" ) ) { explode .@condition$, .@range$[.@i], "~"; if ( getarg(1) >= atoi( .@condition$[0] ) && getarg(1) <= atoi( .@condition$[1] ) ) return 1; } else if ( atoi( .@range$[.@i] ) == getarg(1) ) return 1; .@i++; } return 0; } buildin sql check prontera,160,187,5 script asdasd3 100,{ input .@str$; .@tmp$ = callfunc("build_int_range_sql", .@str$, "group_id"); // dispbottom .@tmp$; .@nb = query_sql( "select account_id from login where "+ .@tmp$, .@aid ); for ( .@i = 0; .@i < .@nb; .@i++ ) dispbottom .@aid[.@i] +""; end; } function script build_int_range_sql { if ( compare( getarg(0), "," ) ) explode .@range$, getarg(0), ","; else .@range$ = getarg(0); .@size = getarraysize( .@range$ ); while ( .@i < .@size ) { if ( compare( .@range$[.@i], "~" ) ) { explode .@condition$, .@range$[.@i], "~"; .@result$ = .@result$ + getarg(1) +" between "+ atoi( .@condition$[0] ) +" and "+ atoi( .@condition$[1] ); } else .@result$ = .@result$ + getarg(1) +" = "+ atoi( .@range$[.@i] ); if ( .@i != .@size -1 ) .@result$ = .@result$ +" or "; .@i++; } return .@result$; } and ... the script ... prontera,154,178,5 script kjhfksdjf 100,{ mes "Staffs Online Lists : ^FF0000"+ .total_gm +"^000000 Staffs"; mes "^0000FF_________________^000000"; for ( .@i = 0; .@i < .total_gm; .@i++ ) { mes "[ Lv ^63D1F4"+ .level[.@i] +"^000000 ] ^FF0000@ ^0000FF"+ .name$[.@i] +"^000000"; mes "^0000FF_____________________________^000000"; } close; OnInit: OnPCLoginEvent: OnPCLogoutEvent: .@str$ = "60~99"; // set the conditions here if ( playerattached() ) if ( callfunc( "int_range__", .@str$, getgmlevel() ) ) end; .total_gm = query_sql( "select name, group_id from `char` left join login on `char`.account_id = login.account_id where online = 1 and "+ callfunc( "build_int_range_sql", .@str$, "group_id" ), .name$, .level ); end; } function script int_range__ { if ( compare( getarg(0), "," ) ) explode .@range$, getarg(0), ","; else .@range$ = getarg(0); .@size = getarraysize( .@range$ ); while ( .@i < .@size ) { if ( compare( .@range$[.@i], "~" ) ) { explode .@condition$, .@range$[.@i], "~"; if ( getarg(1) >= atoi( .@condition$[0] ) && getarg(1) <= atoi( .@condition$[1] ) ) return 1; } else if ( atoi( .@range$[.@i] ) == getarg(1) ) return 1; .@i++; } return 0; } function script build_int_range_sql { if ( compare( getarg(0), "," ) ) explode .@range$, getarg(0), ","; else .@range$ = getarg(0); .@size = getarraysize( .@range$ ); while ( .@i < .@size ) { if ( compare( .@range$[.@i], "~" ) ) { explode .@condition$, .@range$[.@i], "~"; .@result$ = .@result$ + getarg(1) +" between "+ atoi( .@condition$[0] ) +" and "+ atoi( .@condition$[1] ); } else .@result$ = .@result$ + getarg(1) +" = "+ atoi( .@range$[.@i] ); if ( .@i != .@size -1 ) .@result$ = .@result$ +" or "; .@i++; } return .@result$; } hmm ... I have complicated this topic .... Edited December 8, 2012 by AnnieRuru Quote Link to comment Share on other sites More sharing options...
donkeyg Posted December 8, 2012 Group: Members Topic Count: 344 Topics Per Day: 0.07 Content Count: 1060 Reputation: 1 Joined: 02/13/12 Last Seen: November 14, 2016 Author Share Posted December 8, 2012 so.. use which 1 Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted December 8, 2012 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 December 8, 2012 (edited) your posted script can do by itself already or ... post#3 also can ... the rest just getting the topic complicated XD ( PS: we are just exploring other kinds of method to max its efficiency ) Edited December 8, 2012 by AnnieRuru Quote Link to comment Share on other sites More sharing options...
Omnipotent Posted December 8, 2012 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 71 Reputation: 25 Joined: 11/23/11 Last Seen: May 16, 2024 Share Posted December 8, 2012 The old and ugly script: http://3ceam-ex.googlecode.com/svn/trunk/Radiant/npc/judas/Online_GMs_Detector.txt Quote Link to comment Share on other sites More sharing options...
Question
donkeyg
how to add More GMs?
Link to comment
Share on other sites
12 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.