summaryrefslogblamecommitdiff
path: root/npc/commands/kami.txt
blob: c21fb9bad063f44d4ba5ae05eb1fe3b5469eb80c (plain) (tree)
1
2
3
4
5
6
7

              
               
                                         
  

                                                                   




                               
                                     
                                                        



                                          


                                                        
                               



                                            
        


                                           
                                                    
 



















                                                         
// TMW2 Script
//
// @k <message>
// Broadcast, and broadcast to #world too
//
// @servmsg <message>
// Experimental, uses servicemessage() - requires up to date server

-	script	@k	32767,{
    end;

OnCall:
    .@request$ = strcharinfo(0)+": ";
	.@request$ += implode(.@atcmd_parameters$, " ");
    channelmes("#world", .@request$);
    announce l(.@request$), bc_all|bc_npc;
    end;

OnServMsg:
    .@request$ = strcharinfo(0)+": ";
	.@request$ += implode(.@atcmd_parameters$, " ");
    // This can be slow, beware
    .@c = getunits(BL_PC, .@players, 20);
    for (.@i = 0; .@i < .@c; .@i++) {
        message(.@players[.@i], .@request$);
    }
    end;

OnInit:
    bindatcmd "k", "@k::OnCall", 80, 80, 1;
    bindatcmd "servmsg", "@k::OnServMsg", 99, 99, 1;
}

// kamibroadcast( message{, sender} )
function	script	kamibroadcast	{
    .@msg$=getarg(0);
    .@snd$=getarg(1, "");

    // Send to #world
    if (.@snd$ == "")
        channelmes("#world", .@msg$);
    else
        channelmes("#world", "[ "+.@snd$+" ] : "+.@msg$);

    // Make an announce
    if (.@snd$ == "")
        announce .@msg$, bc_all|bc_npc;
    else
        announce .@snd$+": "+.@msg$, bc_all|bc_npc;

    return;
}