daily pastebin goal
54%
SHARE
TWEET

Untitled

a guest Dec 15th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ACMD(do_create_security)
  2. {
  3.     char arg1[256];
  4.     one_argument(argument, arg1, sizeof(arg1));
  5.     if (!*arg1)
  6.         return;
  7.    
  8.     int iFloodResult = ch->GetQuestFlag("input_security.last_input");
  9.     if (iFloodResult){
  10.         if (get_global_time() < iFloodResult + 1 /* limit */) {
  11.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("HIZLI_YAPAMAZSIN1"));
  12.             return;
  13.         }
  14.     }  
  15.  
  16.    
  17.     if (ch->GetSecurityPassword())
  18.     {
  19.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You have already a security password"));
  20.         return;
  21.     }
  22.    
  23.     if (strlen(arg1) < 4 || strlen(arg1) > 6)
  24.     {
  25.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only 4 - 6 character numbers"));
  26.         return;
  27.     }
  28.    
  29.     if (!is_digits(arg1))
  30.     {
  31.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only number"));
  32.         return;
  33.     }
  34.    
  35.     ch->SetSecurityPassword(arg1);
  36.     ch->DeactivateSecurity();
  37.     ch->PrepareSecurityGui(false);
  38.     ch->UpdatePacket();
  39.     //ch->UpdateSecurityPacket();
  40.     ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key successfully created"));
  41.     ch->ChatPacket(CHAT_TYPE_COMMAND, "CloseSecurityCreate");
  42. }
  43.  
  44. ACMD(do_input_security)
  45. {
  46.     char arg1[256];
  47.     one_argument(argument, arg1, sizeof(arg1));
  48.     if (!*arg1)
  49.         return;
  50.    
  51.     int iFloodResult = ch->GetQuestFlag("input_security.last_input");
  52.     if (iFloodResult){
  53.         if (get_global_time() < iFloodResult + 1 /* limit */) {
  54.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("HIZLI_YAPAMAZSIN1"));
  55.             return;
  56.         }
  57.     }  
  58.  
  59.     if (strlen(arg1) < 4 || strlen(arg1) > 6)
  60.     {
  61.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only 4 - 6 character numbers"));
  62.         return;
  63.     }
  64.    
  65.     if (!is_digits(arg1))
  66.     {
  67.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only number"));
  68.         return;
  69.     }
  70.    
  71.     if (!ch->GetSecurityPassword()) {
  72.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("GUVENLIK_SIFRESI_MEVCUT_DEGIL"));
  73.         return;
  74.     }
  75.    
  76.     if (strcmp(ch->GetSecurityPassword(), arg1) == 0)
  77.     {
  78.         ch->DeactivateSecurity();
  79.         ch->PrepareSecurityGui(false);
  80.         ch->UpdatePacket();
  81.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security has been closed"));
  82.         ch->ChatPacket(CHAT_TYPE_COMMAND, "CloseSecurityDialog");
  83.         ch->SetQuestFlag("input_security.last_input", get_global_time() + 2);
  84.     }
  85.     else
  86.     {
  87.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key is incorrect"));
  88.         ch->SetQuestFlag("input_security.last_input", get_global_time() + 2);
  89.     }
  90. }
  91.  
  92. ACMD(do_change_security)
  93. {
  94.     char arg1[256];
  95.     char arg2[256];
  96.     char arg3[256];
  97.     three_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2), arg3, sizeof(arg3));
  98.    
  99.     int iFloodResult = ch->GetQuestFlag("input_security.last_input");
  100.     if (iFloodResult){
  101.         if (get_global_time() < iFloodResult + 1 /* limit */) {
  102.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("HIZLI_YAPAMAZSIN1"));
  103.             return;
  104.         }
  105.     }  
  106.  
  107.     if (strlen(arg1) < 4 || strlen(arg1) > 6)
  108.     {
  109.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only 4 - 6 character numbers"));
  110.         return;
  111.     }
  112.  
  113.     if (strlen(arg2) < 4 || strlen(arg2) > 6)
  114.     {
  115.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only 4 - 6 character numbers"));
  116.         return;
  117.     }
  118.    
  119.     if (strlen(arg3) < 4 || strlen(arg3) > 6)
  120.     {
  121.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only 4 - 6 character numbers"));
  122.         return;
  123.     }
  124.    
  125.     if (!is_digits(arg1))
  126.     {
  127.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only number"));
  128.         return;
  129.     }
  130.    
  131.     if (!is_digits(arg2))
  132.     {
  133.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only number"));
  134.         return;
  135.     }
  136.    
  137.     if (!is_digits(arg3))
  138.     {
  139.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only number"));
  140.         return;
  141.     }
  142.    
  143.     if (ch->GetSecurityPassword() && strcmp(ch->GetSecurityPassword(), arg1) == 0)
  144.     {
  145.         if (strcmp(arg2, arg3) == 0)
  146.         {
  147.             ch->SetSecurityPassword(arg2);
  148.             ch->UpdatePacket();
  149.             //ch->UpdateSecurityPacket();
  150.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has been successfully changed"));
  151.             //ch->ChatPacket(CHAT_TYPE_COMMAND, "CloseSecurityChange");
  152.             ch->SetQuestFlag("input_security.last_input", get_global_time() + 2);
  153.         }
  154.         else
  155.         {
  156.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("First New Password And Second Password Not Match"));
  157.             ch->SetQuestFlag("input_security.last_input", get_global_time() + 2);
  158.         }
  159.     }
  160.     else
  161.     {
  162.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Old security key not match"));
  163.         ch->SetQuestFlag("input_security.last_input", get_global_time() + 2);
  164.     }
  165. }
  166.  
  167. ACMD(do_open_security)
  168. {
  169.     ch->ActivateSecurity();
  170.     ch->PrepareSecurityGui(true);
  171.     if (ch->GetSecurityPassword())
  172.         ch->ChatPacket(CHAT_TYPE_COMMAND, "OpenSecurityDialog");
  173.     else
  174.         ch->ChatPacket(CHAT_TYPE_COMMAND, "OpenSecurityCreate");
  175. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top