Advertisement
Innos

Auto Jailer (Beta)

Sep 29th, 2011
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.33 KB | None | 0 0
  1. //Autojailer 1.0 (www.exro-online.com)
  2.  
  3. /*
  4. DROP TABLE IF EXISTS `autojail`;
  5. CREATE TABLE `autojail` (
  6.   `account_id` int(11) NOT NULL,
  7.   `reason` text NOT NULL,
  8.   `last_login` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  9.   PRIMARY KEY (`account_id`)
  10. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  11. */
  12.  
  13. -   script  AutoJail    -1,{
  14. OnPCLoginEvent:
  15.     if( Query_SQL( "SELECT `reason` FROM `autojail` WHERE `account_id` = " + GetCharID( 3 ), .@reason$ ) == 0 )
  16.         end;
  17.  
  18.     Query_SQL( "UPDATE `autojail` SET `last_login` = NOW() WHERE `account_id` = " + GetCharID( 3 ) );
  19.  
  20.     mes "[^FF0000ExRO AutoJail^000000]";
  21.     mes "Bitte melde dich umgehend bei einem GM oder dem Admin!";
  22.     mes "^FF0000------ Grund ------^000000";
  23.     mes .@reason$[ 0 ];
  24.     close2;
  25.  
  26.     GetMapXY( .@map$, .@x, .@y, 0 );
  27.     if( .@map$ != "sec_pri" )
  28.         AtCommand( "!jail " + StrCharInfo( 0 ) );
  29.  
  30.     end;
  31.  
  32.  
  33.  
  34.  
  35. // Admin Panel
  36. OnWhisperGlobal:
  37.     if( GetGMLevel() < 80 )
  38.         end;
  39.  
  40.     set .@npcname$, "[^FF0000Admin Panel^000000]";
  41.     mes .@npcname$;
  42.     mes "Was möchtest du tun?";
  43.     if( Select( "Account ^008800eintragen^000000", "Account ^FF0000entfernen^000000", "Alle Spieler einsehen", "Beenden" ) == 4 )
  44.         close;
  45.  
  46.     // alle Auflisten
  47.     if( @menu == 3 ) {
  48.         next;
  49.         set .@c, Query_SQL( "SELECT `account_id`, `reason`, DATE_FORMAT(`last_login`, '%d.%m.%Y' ) FROM `autojail`", .@aid, .@reason$, .@date$ );
  50.         if( .@c == 0 ) {
  51.             mes .@npcname$;
  52.             mes "^FF0000Derzeit sind keine Accounts im Autojail eingetragen^000000";
  53.             close;
  54.         }
  55.  
  56.         mes "[^FF0000Autojail Liste - " + .@c + " Accounts^000000]";
  57.         mes "[Nr] <AID> (<letzter Login>)";
  58.         for( set .@i, 0; .@i < .@c; set .@i, .@i + 1 )
  59.             mes "[" + ( .@i + 1 ) + "] " + .@aid[ .@i ] + " (" + .@date$[ .@i ] + ")";
  60.         close;
  61.     }
  62.  
  63.     // Account hinzufügen/entfernen
  64.     mes "Spieler Name?";
  65.     do {
  66.         Input( .@name$ );
  67.         set .@c, Query_Sql( "SELECT `account_id` FROM `char` WHERE `name` = '" + .@name$ + "'", .@AccountID );
  68.         if( .@c == 0 ) {
  69.             mes "^ff0000'" + .@name$ + "' wurde nicht gefunden!^000000";
  70.             if( Select( "nochmal eingeben", "Beenden" ) == 2 )
  71.                 close;
  72.         }
  73.     } while( .@c < 1 );
  74.  
  75.     set .@jCount, Query_SQL( "SELECT `account_id`, `reason`, DATE_FORMAT(`last_login`, '%d.%m.%Y' ) FROM `autojail` WHERE `account_id` = " + .@AccountID, .@aid, .@reason$, .@date$ );
  76.  
  77.     mes "^0000FFAccount^000000: " + .@name$ + " [" + .@AccountID + "]";
  78.     if( .@jCount > 0 ) {
  79.         mes "^0000FFJail Grund^000000: " + .@reason$;
  80.         mes "^0000FFJail Login^000000: " + .@date$;
  81.     }
  82.  
  83.     // hinzufügen
  84.     if( @menu == 1 ) {
  85.         if( Select( "Okay, eintragen!", "Abbrechen!" ) == 2 ){
  86.             mes "^ff0000Abbruch...^000000";
  87.             close;
  88.         }
  89.  
  90.         mes "Bitte den Grund eingeben!";
  91.         Input( .@reason$ );
  92.  
  93.         if( .@jCount == 0 ) // nicht in Table
  94.             Query_SQL( "INSERT INTO `autojail` VALUES ( " + .@AccountID + ", '" + .@reason$ + "', '0000-00-00 00:00:00' );" );
  95.         else
  96.             Query_SQL( "UPDATE `autojail` SET `reason` = '" + .@reason$ + "' WHERE `account_id` = " + .@AccountID );
  97.         mes "^008800Erfolgreich eingetragen!^000000";
  98.         close;
  99.     }
  100.  
  101.     // enfernen
  102.     if( .@jCount == 0 ) {
  103.         mes "^FF0000Der Account steht nicht im AutoJail!^000000";
  104.         close;
  105.     }
  106.  
  107.     if( Select( "Okay, entfernen!", "Abbrechen!" ) == 2 ){
  108.         mes "^ff0000Abbruch...^000000";
  109.         close;
  110.     }
  111.  
  112.     Query_SQL( "DELETE FROM `autojail` WHERE account_id = " + .@AccountID );
  113.     mes "^008800Erfolgreich entfernt!^000000";
  114.     close;
  115. }
  116.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement