Jump to content
  • 0

On online GM or Player


Question

6 answers to this question

Recommended Posts

Posted

I was confused by the topic title.

Do you want it to announce to GMs when another GM logs in/out?

or announce to GMs when any player logs in/out?

If you have trunk/conf/groups.conf,

	permissions: {
	receive_requests: true
}

then you can use @request to send the message to all online GMs:

-	script	a_gm_is_online	-1,{
OnPCLoginEvent:
if (getgmlevel() > 0)
	atcommand "@request "+strcharinfo(0)+" is ONLINE.";
end;
OnPCLogoutEvent:
if (getgmlevel() > 0)
	atcommand "@request "+strcharinfo(0)+" has logged out.";
end;
}

Posted

I was confused by the topic title.

Do you want it to announce to GMs when another GM logs in/out?

or announce to GMs when any player logs in/out?

If you have trunk/conf/groups.conf,

	permissions: {
	receive_requests: true
}

then you can use @request to send the message to all online GMs:

-	script	a_gm_is_online	-1,{
OnPCLoginEvent:
if (getgmlevel() > 0)
	atcommand "@request "+strcharinfo(0)+" is ONLINE.";
end;
OnPCLogoutEvent:
if (getgmlevel() > 0)
	atcommand "@request "+strcharinfo(0)+" has logged out.";
end;
}

sir i want both. gm and player online. it will be like a friend online..

A friend Brian is online

like that. hehe can ?

Posted

@request command spam my PM box <.<

I'll do another way

-	script	gm_build_array_online	-1,{
OnInit:
.gm_level = 60; // set min gm level here

if ( getusers(1) ) end;
deletearray $gm_online_aid;
$gm_online_count = 0;
end;

OnPCLoginEvent:
$gm_online_aid[ $gm_online_count ] = getcharid(3);
$gm_online_count++;
end;
OnPCLogoutEvent:
while ( $gm_online_aid[.@i] != getcharid(3) && .@i < $gm_online_count ) .@i++;
if ( .@i == $gm_online_count ) end; // prevent @loadnpc/@reloadscript bug becos not in the array
deletearray $gm_online_aid[.@i], 1;
$gm_online_count--;
end;
}

-	script	announce_every_player	-1,{
OnPCLoginEvent:
for ( .@i = 0; .@i < $gm_online_count; .@i++ )
	message rid2name( $gm_online_aid[.@i] ), strcharinfo(0) +" has online";
end;
OnPCLogoutEvent:
for ( .@i = 0; .@i < $gm_online_count; .@i++ )
	message rid2name( $gm_online_aid[.@i] ), strcharinfo(0) +" has offline";
end;
}

Posted

@request command spam my PM box <.<

I'll do another way

-	script	gm_build_array_online	-1,{
OnInit:
.gm_level = 60; // set min gm level here

if ( getusers(1) ) end;
deletearray $gm_online_aid;
$gm_online_count = 0;
end;

OnPCLoginEvent:
$gm_online_aid[ $gm_online_count ] = getcharid(3);
$gm_online_count++;
end;
OnPCLogoutEvent:
while ( $gm_online_aid[.@i] != getcharid(3) && .@i < $gm_online_count ) .@i++;
if ( .@i == $gm_online_count ) end; // prevent @loadnpc/@reloadscript bug becos not in the array
deletearray $gm_online_aid[.@i], 1;
$gm_online_count--;
end;
}

-	script	announce_every_player	-1,{
OnPCLoginEvent:
for ( .@i = 0; .@i < $gm_online_count; .@i++ )
	message rid2name( $gm_online_aid[.@i] ), strcharinfo(0) +" has online";
end;
OnPCLogoutEvent:
for ( .@i = 0; .@i < $gm_online_count; .@i++ )
	message rid2name( $gm_online_aid[.@i] ), strcharinfo(0) +" has offline";
end;
}

thanks @annie. i works like charm.. butt...............

the logs also appear on player. i dont want like that. i just want all gm only can see the player who online..

I was confused by the topic title.

Do you want it to announce to GMs when another GM logs in/out?

or announce to GMs when any player logs in/out?

If you have trunk/conf/groups.conf,

	permissions: {
	receive_requests: true
}

then you can use @request to send the message to all online GMs:

-	script	a_gm_is_online	-1,{
OnPCLoginEvent:
if (getgmlevel() > 0)
	atcommand "@request "+strcharinfo(0)+" is ONLINE.";
end;
OnPCLogoutEvent:
if (getgmlevel() > 0)
	atcommand "@request "+strcharinfo(0)+" has logged out.";
end;
}

nothing happen bro. why ea ?

Posted

ROFL !!

-	script	gm_build_array_online	-1,{
OnInit:
.gm_level = 60; // set min gm level here

if ( getusers(1) ) end;
deletearray $gm_online_aid;
$gm_online_count = 0;
end;

OnPCLoginEvent:
if ( getgmlevel() < .gm_level ) end; // WAHAHAHAHHA
$gm_online_aid[ $gm_online_count ] = getcharid(3);
$gm_online_count++;
end;
OnPCLogoutEvent:
if ( getgmlevel() < .gm_level ) end; // totally forgot x.x
while ( $gm_online_aid[.@i] != getcharid(3) && .@i < $gm_online_count ) .@i++;
if ( .@i == $gm_online_count ) end; // prevent @loadnpc/@reloadscript bug becos not in the array
deletearray $gm_online_aid[.@i], 1;
$gm_online_count--;
end;
}

-	script	announce_every_player	-1,{
OnPCLoginEvent:
for ( .@i = 0; .@i < $gm_online_count; .@i++ )
	message rid2name( $gm_online_aid[.@i] ), strcharinfo(0) +" has online";
end;
OnPCLogoutEvent:
for ( .@i = 0; .@i < $gm_online_count; .@i++ )
	message rid2name( $gm_online_aid[.@i] ), strcharinfo(0) +" has offline";
end;
}

  • Upvote 2

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...