fix update utf-8 support

master
rubin 1 year ago
parent 938d753dab
commit 6324b85ded
  1. 24
      WheelFortune.lua

@ -191,10 +191,11 @@ function main()
end
function sampev.onServerMessage(color, message)
message = AnsiToUtf8(message)
if message:find(' Вы поставили (%d+) вирт на x(%d+)') then
bet, stavka = message:match(' Вы поставили (%d+) вирт на x(%d+)')
stavka_me = stavka
return { color, message }
return { color, Utf8ToAnsi(message) }
end
if message:find(' Поздравляем! Вы выиграли (%d+) вирт') then
vin = message:match(' Поздравляем! Вы выиграли (%d+) вирт')
@ -202,7 +203,7 @@ function sampev.onServerMessage(color, message)
inicfg.save(ini, thisScript().name)
local S2 = mode1
mode1 = 0
return { color, message }
return { color, Utf8ToAnsi(message) }
end
if message:find(' К сожалению, вы проиграли, выпал множитель: x(%d+)') then
stavka = message:match(' К сожалению, вы проиграли, выпал множитель: x(%d+)')
@ -222,14 +223,16 @@ function sampev.onServerMessage(color, message)
sendKey(16)
end
end
return { color, message }
return { color, Utf8ToAnsi(message) }
end
end
function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
if gamer == 1 and title:find('Выбор множителя') then
title = AnsiToUtf8(title)
text = AnsiToUtf8(text)
if gamer == 1 and string.find(title, 'Выбор множителя') then
lua_thread.create(function(dialogId)
wait(100)
wait(300)
local sendList = { [2] = 0, [4] = 1, [8] = 2, [16] = 3, [32] = 4 }
sampSendDialogResponse(dialogId, 1, sendList[multiplier], string.format('[%d] x%d', sendList[multiplier], multiplier))
gamer = 2
@ -238,7 +241,7 @@ function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
end
if gamer == 2 and title:find('Ввод параметра') and text:find('Укажите ставку') then
lua_thread.create(function(dialogId)
wait(100)
wait(300)
sampSendDialogResponse(dialogId, 1, 0, math.ceil(cost))
gamer = 0
end, dialogId)
@ -522,6 +525,15 @@ function utf8(...)
end
utf8({ "sampShowDialog" }, "Utf8ToAnsi")
utf8({ "sampSendChat" }, "Utf8ToAnsi")
utf8({ "sampAddChatMessage" }, "Utf8ToAnsi")
utf8({ "print" }, "Utf8ToAnsi")
utf8({ "renderGetFontDrawTextLength" }, "Utf8ToAnsi")
utf8({ "renderFontDrawText" }, "Utf8ToAnsi")
utf8({ "sampSetCurrentDialogEditboxText" }, "Utf8ToAnsi")
utf8({ "sampCreate3dTextEx" }, "Utf8ToAnsi")
utf8({ "sampCreate3dText" }, "Utf8ToAnsi")
utf8({ "sampSet3dTextString" }, "Utf8ToAnsi")
utf8({ "sampGetDialogText" }, nil, "AnsiToUtf8")
utf8({ "sampGetDialogCaption" }, nil, "AnsiToUtf8")
utf8({ "sampHasDialogRespond" }, nil, "AnsiToUtf8")
Loading…
Cancel
Save