Маленькая помощь по LUA!

Статус
В этой теме нельзя размещать новые ответы.

Флэмч

Участник
Автор темы
77
1
Привет, может кто сможет помочь, есть скриптик, чтобы при вводе команды игроку, при выдаче наказания, писался бы текст, но он то пишется, то не пишется (Текст о скриншоте), хде ошибка?
Код:
textpm = "В случае подачи жалобы обязательно сделайте ScreenShot(F8)."
function main()
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand("mute", mute)
    sampRegisterChatCommand("jail", jail)
    sampRegisterChatCommand("kick", kick)
    sampRegisterChatCommand("apunish", apunish)
    sampRegisterChatCommand("warn", warn)
    sampRegisterChatCommand("ban", ban)
    sampRegisterChatCommand("sban", sban)
    while true do wait(0)
    end
end

function mute(param)
    local id, time, reason = param:match("(.*) (.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/mute "..id.." "..time.." "..reason)
end

function jail(param)
    local id, time, reason = param:match("(.*) (.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/jail "..id.." "..time.." "..reason)
end

function kick(param)
    local id, reason = param:match("(.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/kick "..id.." "..reason)
end

function apunish(param)
    local id, time, reason = param:match("(.*) (.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/apunish "..id.." "..time.." "..reason)
end

function warn(param)
    local id, reason = param:match("(.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/warn "..id.." "..reason)
end

function ban(param)
    local id, time, reason = param:match("(.*) (.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/ban "..id.." "..time.." "..reason)
end

function sban(param)
    local id, time, reason = param:match("(.*) (.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/sban "..id.." "..time.." "..reason)
end
 
Решение
Lua:
textpm = "В случае подачи жалобы обязательно сделайте ScreenShot(F8)."
function main()
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand("mute", mute)
    sampRegisterChatCommand("jail", jail)
    sampRegisterChatCommand("kick", kick)
    sampRegisterChatCommand("apunish", apunish)
    sampRegisterChatCommand("warn", warn)
    sampRegisterChatCommand("ban", ban)
    sampRegisterChatCommand("sban", sban)
    while true do wait(0)
    end
end

function mute(param)
    local id, time, reason = param:match("(%d+) (%d+) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/mute "..id.." "..time.." "..reason)
end

function jail(param)
    local id, time, reason = param:match("(%d+) (%d+) (.*)")...

paulohardy

вы еще постите говно? тогда я иду к вам
Всефорумный модератор
1,891
1,254
Привет, может кто сможет помочь, есть скриптик, чтобы при вводе команды игроку, при выдаче наказания, писался бы текст, но он то пишется, то не пишется (Текст о скриншоте), хде ошибка?
Код:
textpm = "В случае подачи жалобы обязательно сделайте ScreenShot(F8)."
function main()
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand("mute", mute)
    sampRegisterChatCommand("jail", jail)
    sampRegisterChatCommand("kick", kick)
    sampRegisterChatCommand("apunish", apunish)
    sampRegisterChatCommand("warn", warn)
    sampRegisterChatCommand("ban", ban)
    sampRegisterChatCommand("sban", sban)
    while true do wait(0)
    end
end

function mute(param)
    local id, time, reason = param:match("(.*) (.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/mute "..id.." "..time.." "..reason)
end

function jail(param)
    local id, time, reason = param:match("(.*) (.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/jail "..id.." "..time.." "..reason)
end

function kick(param)
    local id, reason = param:match("(.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/kick "..id.." "..reason)
end

function apunish(param)
    local id, time, reason = param:match("(.*) (.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/apunish "..id.." "..time.." "..reason)
end

function warn(param)
    local id, reason = param:match("(.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/warn "..id.." "..reason)
end

function ban(param)
    local id, time, reason = param:match("(.*) (.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/ban "..id.." "..time.." "..reason)
end

function sban(param)
    local id, time, reason = param:match("(.*) (.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/sban "..id.." "..time.." "..reason)
end
где id и time замени на param:match("(%d+) (%d+) (.*)")
 

Флэмч

Участник
Автор темы
77
1
Привет. Тогда вот что мне пишет

Lua:
[20:27:07.779005] (error)    text.lua: C:\Games\Grand Theft Auto San Andreas\moonloader\text.lua:16: unexpected symbol near ':'
[20:27:07.779005] (error)    text.lua: Script died due to an error. (1059453C)

Сам код новый уже:
Lua:
textpm = "В случае подачи жалобы обязательно сделайте ScreenShot(F8)."
function main()
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand("mute", mute)
    sampRegisterChatCommand("jail", jail)
    sampRegisterChatCommand("kick", kick)
    sampRegisterChatCommand("apunish", apunish)
    sampRegisterChatCommand("warn", warn)
    sampRegisterChatCommand("ban", ban)
    sampRegisterChatCommand("sban", sban)
    while true do wait(0)
    end
end

function mute(param)
    local param:match("(%d+) (%d+) (.*)") reason = param:match("(.*) (.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/mute "..id.." "..time.." "..reason)
end

function jail(param)
    local param:match("(%d+) (%d+) (.*)") reason = param:match("(.*) (.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/jail "..id.." "..time.." "..reason)
end

function kick(param)
    local id, reason = param:match("(.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/kick "..id.." "..reason)
end

function apunish(param)
    local param:match("(%d+) (%d+) (.*)") reason = param:match("(.*) (.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/apunish "..id.." "..time.." "..reason)
end

function warn(param)
    local id, reason = param:match("(.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/warn "..id.." "..reason)
end

function ban(param)
    local param:match("(%d+) (%d+) (.*)") reason = param:match("(.*) (.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/ban "..id.." "..time.." "..reason)
end

function sban(param)
    local param:match("(%d+) (%d+) (.*)") reason = param:match("(.*) (.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/sban "..id.." "..time.." "..reason)
end
 
Последнее редактирование:

paulohardy

вы еще постите говно? тогда я иду к вам
Всефорумный модератор
1,891
1,254
Lua:
textpm = "В случае подачи жалобы обязательно сделайте ScreenShot(F8)."
function main()
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand("mute", mute)
    sampRegisterChatCommand("jail", jail)
    sampRegisterChatCommand("kick", kick)
    sampRegisterChatCommand("apunish", apunish)
    sampRegisterChatCommand("warn", warn)
    sampRegisterChatCommand("ban", ban)
    sampRegisterChatCommand("sban", sban)
    while true do wait(0)
    end
end

function mute(param)
    local id, time, reason = param:match("(%d+) (%d+) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/mute "..id.." "..time.." "..reason)
end

function jail(param)
    local id, time, reason = param:match("(%d+) (%d+) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/jail "..id.." "..time.." "..reason)
end

function kick(param)
    local id, reason = param:match("(.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/kick "..id.." "..reason)
end

function apunish(param)
    local id, time, reason = param:match("(%d+) (%d+) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/apunish "..id.." "..time.." "..reason)
end

function warn(param)
    local id, reason = param:match("(.*) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/warn "..id.." "..reason)
end

function ban(param)
    local id, time, reason = param:match("(%d+) (%d+) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/ban "..id.." "..time.." "..reason)
end

function sban(param)
    local id, time, reason = param:match("(%d+) (%d+) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/sban "..id.." "..time.." "..reason)
end
 

paulohardy

вы еще постите говно? тогда я иду к вам
Всефорумный модератор
1,891
1,254
Lua:
textpm = "В случае подачи жалобы обязательно сделайте ScreenShot(F8)."
function main()
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand("mute", mute)
    sampRegisterChatCommand("jail", jail)
    sampRegisterChatCommand("kick", kick)
    sampRegisterChatCommand("apunish", apunish)
    sampRegisterChatCommand("warn", warn)
    sampRegisterChatCommand("ban", ban)
    sampRegisterChatCommand("sban", sban)
    while true do wait(0)
    end
end

function mute(param)
    local id, time, reason = param:match("(%d+) (%d+) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/mute "..id.." "..time.." "..reason)
end

function jail(param)
    local id, time, reason = param:match("(%d+) (%d+) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/jail "..id.." "..time.." "..reason)
end

function kick(param)
    local id, reason = param:match("(%d+) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/kick "..id.." "..reason)
end

function apunish(param)
    local id, time, reason = param:match("(%d+) (%d+) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/apunish "..id.." "..time.." "..reason)
end

function warn(param)
    local id, reason = param:match("(%d+) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/warn "..id.." "..reason)
end

function ban(param)
    local id, time, reason = param:match("(%d+) (%d+) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/ban "..id.." "..time.." "..reason)
end

function sban(param)
    local id, time, reason = param:match("(%d+) (%d+) (.*)")
    sampSendChat("/pm "..id.." 0 "..textpm)
    sampSendChat("/sban "..id.." "..time.." "..reason)
end
 
Статус
В этой теме нельзя размещать новые ответы.