Solved help with command

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.
Code:
function codeGen(len: integer):: text:
    set {_options::*} to 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y and Z
    loop {_len} times:
        set {_code} to "%{_code}%%random element out of {_options::*}%"
    return {_code}

I'm 100 % that there is a better way on how to generate a code, not even sure if it works.. just try it out
 
Code:
function codeGen(len: integer):: text:
    set {_options::*} to 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y and Z
    loop {_len} times:
        set {_code} to "%{_code}%%random element out of {_options::*}%"
    return {_code}

I'm 100 % that there is a better way on how to generate a code, not even sure if it works.. just try it out
to call this function you have to do
Code:
command /test <integer>: #if integer does not work try number
    trigger:
        set {_code} to genCode(arg 1)
Code:
#or
command /test:
    trigger:
        set {_code} to genCode(10)#generate a 10 character code
        message "%{_code}%"
 
/
 

Attachments

  • upload_2022-4-22_14-34-14.png
    upload_2022-4-22_14-34-14.png
    12.3 KB · Views: 90
Last edited:
Status
Not open for further replies.