Jump to content
  • 0

GM Online List


donkeyg

Question


  • Group:  Members
  • Topic Count:  344
  • Topics Per Day:  0.08
  • Content Count:  1060
  • Reputation:   1
  • Joined:  02/13/12
  • Last Seen:  

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?

Link to comment
Share on other sites

12 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  55
  • Topics Per Day:  0.01
  • Content Count:  206
  • Reputation:   13
  • Joined:  11/20/11
  • Last Seen:  

I think it will trigger all GM Level => 3

so you don't need to add /hmm

Edited by x13th
Link to comment
Share on other sites


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

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 ? /hmm

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

what's getmapxy( .Map$,.x,.y,0,.GM_Name$[.@i] ); doing there actually ? /hmm

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.

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

what's getmapxy( .Map$,.x,.y,0,.GM_Name$[.@i] ); doing there actually ? /hmm

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

Link to comment
Share on other sites


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

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..LOL

yeah yeah ... I'm agreeing this point

EDIT 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 by AnnieRuru
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

for example..server suddenly have 1 new "extra GM" ? which shouldnt exist ? then admin will know about this..LOL

lol. <.<"

Edited by Ryokem
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

for example..server suddenly have 1 new "extra GM" ? which shouldnt exist ? then admin will know about this..LOL

yeah 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 by Ryokem
Link to comment
Share on other sites


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

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 ... :ani_swt3:

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 .... :ani_swt3:

Edited by AnnieRuru
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  344
  • Topics Per Day:  0.08
  • Content Count:  1060
  • Reputation:   1
  • Joined:  02/13/12
  • Last Seen:  

so.. use which 1

Link to comment
Share on other sites


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

your posted script can do by itself already /oops

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 by AnnieRuru
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  71
  • Reputation:   25
  • Joined:  11/23/11
  • Last Seen:  

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...