Jump to content
  • 0

Question

10 answers to this question

Recommended Posts

Posted


- script Sample -1,{

OnInit:

bindatcmd "order",strnpcinfo(3)+"::OnAtCommand";

end;

OnAtCommand:

.@guild_id = getcharid(2);

if( .@guild_id && getcharid(0) == getguildmasterid( .@guild_id ) ){

.@name$ = strcharinfo(0);

.@message$ = implode( .@atcmd_parameters$," " );

.@size = query_sql( "SELECT `account_id`,`char_id` FROM `guild_member` WHERE `guild_id` = "+.@guild_id+" AND `online` = 1 ORDER BY `position` ASC",.@aid,.@cid );

while( .@i < .@size ){

if( isloggedin( .@aid[.@i],.@cid[.@i] ) )

if( attachrid( .@aid[.@i] ) ){

announce .@name$+": "+.@message$,bc_self;

.@received++;

}

.@i++;

}

attachrid( .@aid[0] );

dispbottom "Message sent.."+.@received+" received";

}

end;

}


@order <messages>

  • 1
Posted

There was a mistake in this version, I forgot to re-attach the aid of the leader in the loop (@variable is attached to the character, so @variable of the member attached was null)

-    script    guild_announce    -1,{
OnWhisperGlobal:
    .@guild_id = getcharid(2);
    if ( getguildmasterid( .@guild_id ) != getcharid(0) ) end;
    if ( @accountid_member == 0 )
        @total_guild_member = query_sql( "select `account_id`, `char_id` from `guild_member` where `guild_id` = "+ .@guild_id, @accountid_member, @charid_member );
    .@mes$ = @whispervar0$;
    .@name$ = strcharinfo(0);
	.@myaid = getcharid(3);
    while( .@i < @total_guild_member ) {
        if ( isloggedin( @accountid_member[.@i], @charid_member[.@i] ) ) {
            attachrid @accountid_member[.@i];
            announce "[ "+ .@name$ +" ]: "+ .@mes$, bc_self;
			attachrid .@myaid;
        }
        .@i++;
    }
}
  • Upvote 1
Posted

Honestly, the first time I have heard of the command. A player asked me if I can do it, I believe it's a custom command where a Guild Leader can broadcast to his guild members via the @order command, and the only people that can read the broadcasted message are the guild members.

 

Thanks.

Posted

This have been made by @Capuche recently : 

-    script    guild_announce    -1,{
OnWhisperGlobal:
    .@guild_id = getcharid(2);
    if ( getguildmasterid( .@guild_id ) != getcharid(0) ) end;
    if ( @accountid_member == 0 )
        @total_guild_member = query_sql( "select `account_id`, `char_id` from `guild_member` where `guild_id` = "+ .@guild_id, @accountid_member, @charid_member );
    .@mes$ = @whispervar0$;
    .@name$ = strcharinfo(0);
    while( .@i < @total_guild_member ) {
        if ( isloggedin( @accountid_member[.@i], @charid_member[.@i] ) ) {
            attachrid @accountid_member[.@i];
            announce "[ "+ .@name$ +" ]: "+ .@mes$, bc_self;
        }
        .@i++;
    }
}

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