function main()
sampRegisterChatCommand('craft', function(arg)
argz, args = arg:match('(%d+) (%d+)')
tonumber(argz) = tonumber(argz) - 1
w = true
end)
while true do wait(0)
if w then
if sampIsDialogActive() then
sampSendDialogResponse(sampGetCurrentDialogId(), 1, argz, args)
w = false
else sampSendChat('/makegun')
end
end
end