Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ACMD(do_create_security)
- {
- char arg1[256];
- one_argument(argument, arg1, sizeof(arg1));
- if (!*arg1)
- return;
- int iFloodResult = ch->GetQuestFlag("input_security.last_input");
- if (iFloodResult){
- if (get_global_time() < iFloodResult + 1 /* limit */) {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("HIZLI_YAPAMAZSIN1"));
- return;
- }
- }
- if (ch->GetSecurityPassword())
- {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You have already a security password"));
- return;
- }
- if (strlen(arg1) < 4 || strlen(arg1) > 6)
- {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only 4 - 6 character numbers"));
- return;
- }
- if (!is_digits(arg1))
- {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only number"));
- return;
- }
- ch->SetSecurityPassword(arg1);
- ch->DeactivateSecurity();
- ch->PrepareSecurityGui(false);
- ch->UpdatePacket();
- //ch->UpdateSecurityPacket();
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key successfully created"));
- ch->ChatPacket(CHAT_TYPE_COMMAND, "CloseSecurityCreate");
- }
- ACMD(do_input_security)
- {
- char arg1[256];
- one_argument(argument, arg1, sizeof(arg1));
- if (!*arg1)
- return;
- int iFloodResult = ch->GetQuestFlag("input_security.last_input");
- if (iFloodResult){
- if (get_global_time() < iFloodResult + 1 /* limit */) {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("HIZLI_YAPAMAZSIN1"));
- return;
- }
- }
- if (strlen(arg1) < 4 || strlen(arg1) > 6)
- {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only 4 - 6 character numbers"));
- return;
- }
- if (!is_digits(arg1))
- {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only number"));
- return;
- }
- if (!ch->GetSecurityPassword()) {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("GUVENLIK_SIFRESI_MEVCUT_DEGIL"));
- return;
- }
- if (strcmp(ch->GetSecurityPassword(), arg1) == 0)
- {
- ch->DeactivateSecurity();
- ch->PrepareSecurityGui(false);
- ch->UpdatePacket();
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security has been closed"));
- ch->ChatPacket(CHAT_TYPE_COMMAND, "CloseSecurityDialog");
- ch->SetQuestFlag("input_security.last_input", get_global_time() + 2);
- }
- else
- {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key is incorrect"));
- ch->SetQuestFlag("input_security.last_input", get_global_time() + 2);
- }
- }
- ACMD(do_change_security)
- {
- char arg1[256];
- char arg2[256];
- char arg3[256];
- three_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2), arg3, sizeof(arg3));
- int iFloodResult = ch->GetQuestFlag("input_security.last_input");
- if (iFloodResult){
- if (get_global_time() < iFloodResult + 1 /* limit */) {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("HIZLI_YAPAMAZSIN1"));
- return;
- }
- }
- if (strlen(arg1) < 4 || strlen(arg1) > 6)
- {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only 4 - 6 character numbers"));
- return;
- }
- if (strlen(arg2) < 4 || strlen(arg2) > 6)
- {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only 4 - 6 character numbers"));
- return;
- }
- if (strlen(arg3) < 4 || strlen(arg3) > 6)
- {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only 4 - 6 character numbers"));
- return;
- }
- if (!is_digits(arg1))
- {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only number"));
- return;
- }
- if (!is_digits(arg2))
- {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only number"));
- return;
- }
- if (!is_digits(arg3))
- {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has only number"));
- return;
- }
- if (ch->GetSecurityPassword() && strcmp(ch->GetSecurityPassword(), arg1) == 0)
- {
- if (strcmp(arg2, arg3) == 0)
- {
- ch->SetSecurityPassword(arg2);
- ch->UpdatePacket();
- //ch->UpdateSecurityPacket();
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Security key has been successfully changed"));
- //ch->ChatPacket(CHAT_TYPE_COMMAND, "CloseSecurityChange");
- ch->SetQuestFlag("input_security.last_input", get_global_time() + 2);
- }
- else
- {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("First New Password And Second Password Not Match"));
- ch->SetQuestFlag("input_security.last_input", get_global_time() + 2);
- }
- }
- else
- {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Old security key not match"));
- ch->SetQuestFlag("input_security.last_input", get_global_time() + 2);
- }
- }
- ACMD(do_open_security)
- {
- ch->ActivateSecurity();
- ch->PrepareSecurityGui(true);
- if (ch->GetSecurityPassword())
- ch->ChatPacket(CHAT_TYPE_COMMAND, "OpenSecurityDialog");
- else
- ch->ChatPacket(CHAT_TYPE_COMMAND, "OpenSecurityCreate");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement