On / Off through the dialog

halfastrc

Участник
Автор темы
40
4
Версия MoonLoader
.026-beta
I want Activate/Deactivate my script through the dialog, but the script just stay in ON, what i'm doing wrong?

Lua:
local sampev = require 'lib.samp.events'

function main()
    while not isSampAvailable() do wait(0) end

    dialog()
end

function dialog()
    sampShowDialog(0, "Settings","Options\tStatus\t\nActivate/Deactivate Script\t"..activation(status),"Select", "Cancel", 5)
end

function activation()
    status = not status

    if status then
        return "{2ecc71}[ON]"
    else
        return "{e74c3c}[OFF]"
    end
end