Integrations
Custom Integrations For mChat Resource
Integration For Me Do Script
local function displayText(ped, text, yOffset, source) -- I need to pass player source as an extra parameter to display in chat message
local playerPed = PlayerPedId()
local playerPos = GetEntityCoords(playerPed)
local targetPos = GetEntityCoords(ped)
local dist = #(playerPos - targetPos)
local los = HasEntityClearLosToEntity(playerPed, ped, 17)
if dist <= c.dist and los then
peds[ped] = {
time = GetGameTimer() + c.time,
text = text,
yOffset = yOffset
}
if not peds[ped].exists then
peds[ped].exists = true
local playerName = GetPlayerName(GetPlayerFromServerId(source))
local messageData = {
args = {playerName, text},
tags = {"me"},
playerId = source,
channel = 'me',
}
TriggerEvent('chat:addMessage', messageData)
Citizen.CreateThread(function()
while GetGameTimer() <= peds[ped].time do
local pos = GetOffsetFromEntityInWorldCoords(ped, 0.0, 0.0, peds[ped].yOffset)
draw3dText(pos, peds[ped].text)
Citizen.Wait(0)
end
peds[ped] = nil
end)
end
end
endIntegration For Twitter
Last updated