Advertisement
johnlol

Guild Storage Restriction

May 19th, 2019
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. ________________     ______            ________      
  3. ___    |_____  /________  /______      ___  __ \_____
  4. __  /| |  __  /_  __ \_  __ \  _ \     __  /_/ /  __ \
  5. _  ___ / /_/ / / /_/ /  /_/ /  __/     _  _, _// /_/ /
  6. /_/  |_\__,_/  \____//_.___/\___/      /_/ |_| \____/
  7.  
  8. */
  9.  
  10. // ALTER TABLE  `guild` ADD  `storage_restriction` INT( 11 ) NOT NULL DEFAULT  '0'
  11.  
  12. prontera.gat,154,198,5  script  Gstorage Restriction    1341,{
  13. .@char_id = getcharid(0);
  14. .@guild_id = getcharid(2);
  15.  
  16. if( !.@guild_id ){
  17.     mes "You dont have any guild.";
  18. }else{
  19.     query_sql( "SELECT `storage_restriction` FROM `guild` WHERE `guild_id` = '"+.@guild_id+"'",.@restriction );
  20.     query_sql( "SELECT `position` FROM `guild_member` WHERE `char_id` = '"+.@char_id+"'",.@position );
  21.  
  22.     switch( select( "Access Guild Storage",( .@position )?"":"Edit Restriction" ) ){
  23.         Case 1:
  24.             if( .@restriction && .@restriction & ( 2 << .@position ) ){
  25.                 mes "Your position cant access this Storage..";
  26.             }else{
  27.                 mes "Storage opened.";
  28.                 guildopenstorage();
  29.             }
  30.             break;
  31.         Case 2:
  32.             query_sql( "SELECT `position`,`name` FROM `guild_position` WHERE `guild_id` = '"+.@guild_id+"'",.@guild_position,.@guild_position_name$ );
  33.             do{
  34.                 .@menu$ = "";
  35.                 .@i = 1;
  36.                 while( .@i < .guild_max_position ){
  37.                     .@menu$ = .@menu$ + (( .@restriction & ( 2 << .@i) )?"^FF0000[Disabled]":"^EE55FF[Enabled]" )+" "+.@guild_position_name$[.@i] +"^000000" +":";
  38.                     .@i++;
  39.                 }
  40.                 mes "Select a Position";
  41.                 mes "^FF0000RED - Disable Access^000000";
  42.                 .@i = select( .@menu$+":Done" );
  43.                 if( .@i <= .guild_max_position ){
  44.                     .@bitvalue = ( 2 << .@i );
  45.                     if( .@restriction & .@bitvalue ){
  46.                         .@restriction -= .@bitvalue;
  47.                         mes "Position : ^0055FF"+.@guild_position_name$[.@i]+"^000000 granted Storage Access.";
  48.                     }else{
  49.                         mes "Position : ^0055FF"+.@guild_position_name$[.@i]+"^000000 disabled Storage Access.";
  50.                         .@restriction += .@bitvalue;
  51.                     }
  52.                     next;
  53.                 }
  54.             }while( select( "Continue Edit","Finished Edit" ) == 1 );
  55.             query_sql( "UPDATE `guild` SET `storage_restriction` = '"+.@restriction+"' WHERE `guild_id` = '"+.@guild_id+"'" );
  56.             mes "Guild Storage Restriction updated.";
  57.         default: break;
  58.     }
  59. }
  60. close;
  61.  
  62. OnInit:
  63. .guild_max_position = 20;
  64. end;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement