- 54
- 6
- Версия MoonLoader
- Другое
Здравствуйте, я хочу задать радиус для перевода текста с исходного языка, но проблема в том, что полученное значение может быть неверным?
*Пояснение
Если игрок находится в позиции, близкой к 3dtext или в пределах 10 метров, он выполнит перевод, если 3dtext будет найден в пределах указанного расстояния.
Спасибо за помощь.
UP
*Пояснение
Если игрок находится в позиции, близкой к 3dtext или в пределах 10 метров, он выполнит перевод, если 3dtext будет найден в пределах указанного расстояния.
Спасибо за помощь.
Lua:
function sampev.onCreate3DText(id, color, position, dist, testLOS, attachedPlayerId, attachedVehicleId, text)
if itdtext.v then
local X, Y, Z = getCharCoordinates(PLAYER_PED)
local px, py, pz = position.x, position.y, position.z
local radius = 50.0
local distes = getDistanceBetweenCoords3d(X, Y, Z, px, py, pz)
if dist < radius then
sampAddChatMessage(string.format("Found 3D text \"%s\" at coordinates %.2f %.2f %.2f, distance %.2f, player id %d, vehicle id %d", text, px, py, pz, dist, attachedPlayerId, attachedVehicleId), color)
if translatedCache[text] then
text = translatedCache[text]
else
local originalText = text
loadCache()
if translatedCache[originalText] then
text = translatedCache[originalText]
else
enqueueTranslation(originalText, false, function(otext)
if otext then
translatedCache[originalText] = otext
saveCache()
text = otext
if sampIs3dTextDefined(id) then
local info = {sampGet3dTextInfoById(id)}
if #info >= 9 then
local bs = raknetNewBitStream()
raknetBitStreamWriteInt16(bs, id)
raknetBitStreamWriteInt32(bs, color)
raknetBitStreamWriteFloat(bs, info[3])
raknetBitStreamWriteFloat(bs, info[4])
raknetBitStreamWriteFloat(bs, info[5])
raknetBitStreamWriteFloat(bs, info[6])
raknetBitStreamWriteInt8(bs, info[7])
raknetBitStreamWriteInt16(bs, info[8])
raknetBitStreamWriteInt16(bs, info[9])
raknetBitStreamEncodeString(bs, text)
raknetEmulRpcReceiveBitStream(36, bs)
raknetDeleteBitStream(bs)
end
end
end
end)
end
end
end
end
return {id, color, position, dist, testLOS, attachedPlayerId, attachedVehicleId, text}
end
UP
Последнее редактирование: