- Версия MoonLoader
- .026-beta
Написал скрипт, который сам курит, но временной промежуток, когда именно должна прописываться команда "/smoke", нужен рандомный. Попытался это сделать, однако почему-то идет флуд функциями, хотя вроде все верно. Прошу объяснить, в чем ошибочка. Вот код:
Lua:
act = false
local str_rand = {'1244, 1343, 1588, 1797, 2135'}
function main()
repeat
wait(0)
until isSampAvailable()
sampAddChatMessage('Autosmoking is {FF0000}started', -1)
sampRegisterChatCommand("asg",function() act = not act sampAddChatMessage(act and "Autosmoking: {00FF00}ON" or "Autosmoking: {FF0000}OFF", 0xFFFFFF) end)
function test_random(arg)
math.randomseed(os.time())
rand = math.random(1, #str_rand)
end
while true do
wait(rand)
health = getCharHealth(PLAYER_PED)
if act and health < 80 then
sampSendChat("/smoke")
end
end
end