Advertisement
Emistry

[RO] Auto Left Channel System

Nov 22nd, 2018
1,450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.01 KB | None | 0 0
  1. // https://rathena.org/board/topic/117458-channel-controller/#comment-353969
  2.  
  3. prontera,155,181,5  script  Sample  4_F_KAFRA1,{
  4.     doevent "channel_setting_main::OnTalk";
  5. }
  6.  
  7. -   script  channel_setting_main    -1,{
  8.    
  9.     OnInit:
  10.         setarray .channel_list_name$, "#main", "#support";
  11.         setarray .channel_list$, "#main", "#support";
  12.        
  13.         .channel_size = getarraysize(.channel_list$);
  14.         end;
  15.    
  16.     OnTalk:
  17.         mes "Hello "+strcharinfo(0);
  18.         mes "Select the Chat Channel you wish to be in.";
  19.         for (.@i = 0; .@i < .channel_size; .@i++)
  20.             .@menu$ = .@menu$ + .channel_list_name$[.@i] + (#CHANNEL_SETTINGS & (1 << .@i) ? "[On]":"[Off]")  + (1 >> .@i) + ":";
  21.         .@i = select(.@menu$) - 1;
  22.         if (#CHANNEL_SETTINGS & (1 << .@i))
  23.             #CHANNEL_SETTINGS -= (1 << .@i);
  24.         else
  25.             #CHANNEL_SETTINGS |= (1 << .@i);
  26.         mes "Setting updated.";
  27.         close;
  28.    
  29.     OnPCLoginEvent:
  30.         // sleep2 1000;
  31.         while (.@i < .channel_size) {
  32.             if (#CHANNEL_SETTINGS & (1 >> .@i))
  33.                 atcommand "@channel leave "+.channel_list$[.@i];
  34.             .@i++;
  35.         }
  36.         end;
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement