Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Credits to AnnieRuru
- - script IRC -1,{
- function IRC_Create;
- function IRC_Join;
- function IRC_Add;
- function IRC_Remove;
- function IRC_Broadcast;
- OnInit:
- // Max IRC Room
- .MaxRoom = 10;
- // Max Users in IRC
- .MaxUser = 100;
- // IRC Chat Colour
- .WARNING$ = "0xFF0000";
- .CHAT$ = "0xFFBBFF";
- .SYSTEM$ = "0x00EE55";
- // IRC Commands
- .irc_create$ = "create";
- .irc_join$ = "join";
- .irc_leave$ = "leave";
- // IRC Messages ( will add on future )
- // .message$[0] = "IRC Room reach limit.";
- // .message$[1] = "Please leave your current IRC Room.";
- // .message$[2] = "Didnt have any available IRC Room.";
- // .message$[3] = "You didnt join any IRC Room";
- // Delete Data during Test Mode
- for ( .@i = 2000000; .@i < 200003; .@i++ ) {
- if ( attachrid(.@i) )
- set @IRC, 0;
- end;
- OnWhisperGlobal:
- if( @whispervar0$ == .irc_create$ ){
- if( getarraysize( .IRC_Room$ ) >= .MaxRoom ){
- dispbottom "Max IRC Room Reach.";
- }else if( @IRC ){
- dispbottom "Please leave your current IRC Room";
- }else{
- for( .@i = 0; .@i < .MaxRoom; .@i++ )
- if( .IRC_Room$[.@i] == "" ){
- .IRC_Room$[.@i] = IRC_Create();
- @IRC = ( .@i + 1 );
- IRC_Add( ( @IRC - 1 ),strcharinfo(0) );
- end;
- }
- }
- }else if( @whispervar0$ == .irc_join$ ){
- if( getarraysize( .IRC_Room$ ) <= 0 ){
- dispbottom "Didnt have any available IRC Room.";
- }else if( @IRC ){
- dispbottom "Please leave your current IRC Room";
- }else{
- @IRC = IRC_Join();
- IRC_Add( ( @IRC - 1 ),strcharinfo(0) );
- }
- }else if( @whispervar0$ == .irc_leave$ ){
- if( !@IRC ){
- dispbottom "You didnt join any IRC Room.";
- }else{
- IRC_Remove( ( @IRC - 1 ),strcharinfo(0) );
- }
- }else if( @IRC <= 0 ){
- dispbottom "You didnt join any IRC Room.";
- }else{
- set .@MSG$, strcharinfo(0) +" : "+ @whispervar0$;
- IRC_Broadcast( ( @IRC - 1 ),.@MSG$,.CHAT$ );
- }
- close;
- // getarg(0) = Room
- // getarg(1) = Player Name
- function IRC_Add {
- .@size = getarraysize( getd( ".IRC_Room_"+getarg(0)+"$" ) );
- setd( ".IRC_Room_"+getarg(0)+"$["+.@size+"]" ),getarg(1);
- if( strcharinfo(0) != getarg(1) ){
- .@AID = getcharid(3);
- if( attachrid( getcharid(3,getarg(1) ) ) ){
- @IRC = ( getarg(0) + 1 );
- attachrid( .@AID );
- }
- }else{
- @IRC = ( getarg(0) + 1 );
- }
- IRC_Broadcast( getarg(0),"( IRC ) : '"+getarg(1)+"' joined this room",.SYSTEM$ );
- return;
- }
- // getarg(0) = Room
- // getarg(1) = Player Name
- function IRC_Remove {
- .@size = getarraysize( getd( ".IRC_Room_"+getarg(0)+"$" ) );
- for( .@i = 0; .@i < .@size; .@i++ )
- if( getd( ".IRC_Room_"+getarg(0)+"$["+.@i+"]" ) == getarg(1) ){
- deletearray getd( ".IRC_Room_"+getarg(0)+"$["+.@i+"]" ),1;
- if( strcharinfo(0) != getarg(1) ){
- .@AID = getcharid(3);
- if( attachrid( getcharid(3,getarg(1) ) ) ){
- @IRC = 0;
- attachrid( .@AID );
- }
- }else{
- @IRC = 0;
- }
- }
- IRC_Broadcast( getarg(0),"( IRC ) : '"+getarg(1)+"' left this room",.SYSTEM$ );
- if( getarraysize( getd( ".IRC_Room_"+getarg(0)+"$" ) ) <= 0 )
- .IRC_Room$[ getarg(0) ] = "";
- return;
- }
- // getarg(0) = Room
- // getarg(1) = Message
- // getarg(2) = Color
- function IRC_Broadcast {
- freeloop(1);
- for( .@i = 0; .@i < getarraysize( getd( ".IRC_Room_"+getarg(0)+"$" ) ); .@i++ )
- if( attachrid( getcharid( 3,getd( ".IRC_Room_"+getarg(0)+"$["+.@i+"]" ) ) ) ){
- announce getarg(1),bc_self,getarg(2);
- }
- freeloop(0);
- return;
- }
- function IRC_Create {
- mes "Please enter a Name for this IRC Channel";
- do{
- input .@IRC_Name$;
- mes "IRC Name : ^0055FF"+.@IRC_Name$+"^000000";
- next;
- }while( select("Confirm:Change") == 2 );
- close2;
- return .@IRC_Name$;
- end;
- }
- function IRC_Join {
- for( .@i = 0; .@i < getarraysize( .IRC_Room$ ); .@i++ )
- set .@Menu$,.@Menu$ + "^FF0000[ "+( .@i+1 )+". ] ^0055FF"+.IRC_Room$[.@i]+" ^FF0000( "+getarraysize( getd( ".IRC_Room_"+.@i+"$") )+" / "+.MaxUser+" Users )^000000" +":";
- return select( .@Menu$ );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment