• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] 4 digit code with leads
#2
Code:
main() {
    EnterPassword(6, 5, 9, 3,      1, 5, 6, 3);
}

EnterPassword(pass_0, pass_1, pass_2, pass_3, password_0, password_1, password_2, password_3) {
    new correct, pass[4], password[4], string[5] = "XXXX", number[4];
    pass[0] = pass_0, pass[1] = pass_1, pass[2] = pass_2, pass[3] = pass_3;
    password[0] = password_0, password[1] = password_1, password[2] = password_2, password[3] = password_3;
    for(new i; i < 4; i) {
        if(password[i] == pass[i]) {
            strdel(string, i, i);
            format(number, sizeof number, "%d", pass[i]);
            strins(string, number, i);
            correct;
        }
    }
    printf("Output: %s (Correct: %i)\n", string, correct);
    return correct;
}
  Reply


Messages In This Thread
4 digit code with leads - by McZulian - 2021-04-25, 12:12 AM
RE: 4 digit code with leads - by Radical - 2021-04-25, 12:32 AM

Forum Jump: