Integration For Me Do Script
To integrate this you need knowledge on development otherwise we don't advise you to try this.
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
end
In this example I'll show you how to implement for gcphone you can adjust it for your script
To integrate this you need knowledge on development otherwise we don't advise you to try this
function TwitterPostTweet (username, password, message, sourcePlayer, realUser, cb)
getUser(username, password, function (user)
if user == nil then
if sourcePlayer ~= nil then
TwitterShowError(sourcePlayer, 'Twitter Info', 'APP_TWITTER_NOTIF_LOGIN_ERROR')
end
return
end
MySQL.Async.insert("INSERT INTO twitter_tweets (`authorId`, `message`, `realUser`) VALUES(@authorId, @message, @realUser);", {
['@authorId'] = user.id,
['@message'] = message,
['@realUser'] = realUser
}, function (id)
MySQL.Async.fetchAll('SELECT * from twitter_tweets WHERE id = @id', {
['@id'] = id
}, function (tweets)
tweet = tweets[1]
tweet['author'] = user.author
tweet['authorIcon'] = user.authorIcon
local messageData = {
args = {'@'..username, message},
tags = {"twitter"},
channel = 'all',
}
TriggerClientEvent('chat:addMessage', -1, messageData)
TriggerClientEvent('gcPhone:twitter_newTweets', -1, tweet)
TriggerEvent('gcPhone:twitter_newTweets', tweet)
end)
end)
end)
end