Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- CREATE TABLE IF NOT EXISTS `security_gm_protection` (
- `aid` INT(11) UNSIGNED NOT NULL DEFAULT '0',
- `password` VARCHAR(50) NOT NULL DEFAULT '',
- PRIMARY KEY (`aid`)
- ) ENGINE=MyISAM;
- */
- prontera,155,181,5 script GM Security 757,{
- doevent "security_gm_main::OnTalk";
- }
- - script security_gm_main -1,{
- OnInit:
- .md5 = 0;
- .min_gm_level = 10;
- end;
- OnTalk:
- .@aid = getcharid(3);
- .@password$ = callsub( L_GetPassword,.@aid );
- if ( getgmlevel() < .min_gm_level || !.min_gm_level ) {
- mes "Not available.";
- }
- else {
- mes "How can I help ?";
- next;
- switch ( select(
- ( .@password$ == "" ) ? "Setup New Password":"",
- ( .@password$ != "" ) ? "Change Password":"",
- "Cancel"
- ) ) {
- case 2:
- mes "Enter Your current secondary Password";
- input .@pass1$;
- if ( .@pass1$ != .@password$ ) {
- mes "Password not match.";
- break;
- }
- case 1:
- mes "Enter your New secondary Password";
- input .@pass1$;
- mes "Please re-input your secondary password.";
- input .@pass2$;
- if ( .@pass1$ != .@pass2$ ) {
- mes "Password not match.";
- }
- else {
- .@pass1$ = escape_sql( .@pass1$ );
- .@sql$ = (( .md5 ) ? "MD5( '"+.@pass1$+"' )":.@pass1$ );
- query_sql( "INSERT INTO `security_gm_protection` ( `aid`,`password` ) VALUES ( "+.@aid+",'"+escape_sql( .@pass1$ )+"' ) ON DUPLICATE KEY UPDATE `password` = '"+.@sql$+"'" );
- mes "Password updated.";
- }
- default: break:
- }
- }
- close;
- OnPCLoginEvent:
- if ( getgmlevel() >= .min_gm_level && .min_gm_level > 0 ) {
- .@password$ = callsub( L_GetPassword,getcharid(3) );
- if ( .@password$ != "" ) {
- Manner = -2147483647;
- mes "Please enter your secondary Password:";
- input .@pass$;
- .@is_correct = ( .@pass$ == .@password$ );
- mes "Verification"+( .@is_correct ? "":" NOT" )+" success.";
- Manner = 0;
- if ( !.@is_correct ) {
- atcommand "@kick "+strcharinfo(0);
- }
- close;
- }
- }
- end;
- L_GetPassword:
- query_sql( "SELECT `password` FROM `security_gm_protection` WHERE `aid` = "+getarg( 0,0 )+" LIMIT 1",.@password$ );
- return .@password$;
- }
Advertisement