mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 02:08:55 +00:00
chore(Upload Files)
Committed on behalf of AdrineX
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
@@ -1 +1,31 @@
|
||||
# esx_rpchat
|
||||
# esx_rpchat
|
||||
FXServer ESX RP Chat
|
||||
|
||||
|
||||
#### Description
|
||||
This is a proximity chat script. With a few commands such as Twitter, OOC, Local Me, and Local Do.
|
||||
|
||||
#### Requirements
|
||||
- [esx_identity](https://github.com/ESX-Org/esx_identity)
|
||||
|
||||
#### Download
|
||||
|
||||
**1) Using [fvm](https://github.com/qlaffont/fvm-installer)**
|
||||
```
|
||||
fvm install --save --folder=esx esx-org/esx_rpchat
|
||||
```
|
||||
|
||||
**2) Manually**
|
||||
- Download https://github.com/ESX-Org/esx_rpchat/releases/latest
|
||||
- Put it in resource/[esx] directory
|
||||
|
||||
**3) Using Git**
|
||||
|
||||
```
|
||||
cd resouces
|
||||
git clone https://github.com/ESX-Org/esx_rpchat
|
||||
```
|
||||
|
||||
#### Installation
|
||||
|
||||
1) Add `start esx_rpchat` to your server.cfg
|
||||
@@ -0,0 +1,20 @@
|
||||
--[[
|
||||
|
||||
ESX RP Chat
|
||||
|
||||
--]]
|
||||
|
||||
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
|
||||
|
||||
description 'ESX RP Chat'
|
||||
|
||||
version '1.0.0'
|
||||
|
||||
client_script 'client/main.lua'
|
||||
|
||||
server_scripts {
|
||||
|
||||
'@mysql-async/lib/MySQL.lua',
|
||||
'server/main.lua'
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
--[[
|
||||
|
||||
ESX RP Chat
|
||||
|
||||
--]]
|
||||
|
||||
RegisterNetEvent('sendProximityMessage')
|
||||
AddEventHandler('sendProximityMessage', function(id, name, message)
|
||||
local myId = PlayerId()
|
||||
local pid = GetPlayerFromServerId(id)
|
||||
if pid == myId then
|
||||
TriggerEvent('chatMessage', "^4" .. name .. "", {0, 153, 204}, "^7 " .. message)
|
||||
elseif GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(myId)), GetEntityCoords(GetPlayerPed(pid)), true) < 19.999 then
|
||||
TriggerEvent('chatMessage', "^4" .. name .. "", {0, 153, 204}, "^7 " .. message)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('sendProximityMessageMe')
|
||||
AddEventHandler('sendProximityMessageMe', function(id, name, message)
|
||||
local myId = PlayerId()
|
||||
local pid = GetPlayerFromServerId(id)
|
||||
if pid == myId then
|
||||
TriggerEvent('chatMessage', "", {255, 0, 0}, " ^6 " .. name .." ".."^6 " .. message)
|
||||
elseif GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(myId)), GetEntityCoords(GetPlayerPed(pid)), true) < 19.999 then
|
||||
TriggerEvent('chatMessage', "", {255, 0, 0}, " ^6 " .. name .." ".."^6 " .. message)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('sendProximityMessageDo')
|
||||
AddEventHandler('sendProximityMessageDo', function(id, name, message)
|
||||
local myId = PlayerId()
|
||||
local pid = GetPlayerFromServerId(id)
|
||||
if pid == myId then
|
||||
TriggerEvent('chatMessage', "", {255, 0, 0}, " ^0* " .. name .." ".."^0 " .. message)
|
||||
elseif GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(myId)), GetEntityCoords(GetPlayerPed(pid)), true) < 19.999 then
|
||||
TriggerEvent('chatMessage', "", {255, 0, 0}, " ^0* " .. name .." ".."^0 " .. message)
|
||||
end
|
||||
end)
|
||||
@@ -0,0 +1,78 @@
|
||||
--[[
|
||||
|
||||
ESX RP Chat
|
||||
|
||||
--]]
|
||||
|
||||
function getIdentity(source, callback)
|
||||
local identifier = GetPlayerIdentifiers(source)[1]
|
||||
MySQL.Async.fetchAll("SELECT * FROM `users` WHERE `identifier` = @identifier", {['@identifier'] = identifier},
|
||||
function(result)
|
||||
if result[1]['firstname'] ~= nil then
|
||||
local data = {
|
||||
identifier = result[1]['identifier'],
|
||||
firstname = result[1]['firstname'],
|
||||
lastname = result[1]['lastname'],
|
||||
dateofbirth = result[1]['dateofbirth'],
|
||||
sex = result[1]['sex'],
|
||||
height = result[1]['height']
|
||||
}
|
||||
callback(data)
|
||||
else
|
||||
local data = {
|
||||
identifier = '',
|
||||
firstname = '',
|
||||
lastname = '',
|
||||
dateofbirth = '',
|
||||
sex = '',
|
||||
height = ''
|
||||
}
|
||||
callback(data)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
AddEventHandler('chatMessage', function(source, name, message)
|
||||
getIdentity(source, function(data)
|
||||
if string.sub(message, 1, string.len("/")) ~= "/" then
|
||||
TriggerClientEvent("sendProximityMessage", -1, source, data.firstname, message)
|
||||
end
|
||||
end)
|
||||
CancelEvent()
|
||||
end)
|
||||
|
||||
TriggerEvent('es:addCommand', 'me', function(source, args, user)
|
||||
table.remove(args, 1)
|
||||
getIdentity(source, function(data)
|
||||
TriggerClientEvent("sendProximityMessageMe", -1, source, data.firstname, table.concat(args, " "))
|
||||
end)
|
||||
end)
|
||||
|
||||
TriggerEvent('es:addCommand', 'do', function(source, args, user)
|
||||
table.remove(args, 1)
|
||||
getIdentity(source, function(data)
|
||||
TriggerClientEvent("sendProximityMessageDo", -1, source, data.firstname, table.concat(args, " "))
|
||||
end)
|
||||
end)
|
||||
|
||||
TriggerEvent('es:addCommand', 'twt', function(source, args, user)
|
||||
table.remove(args, 1)
|
||||
TriggerClientEvent('chatMessage', -1, "^0[^4Twitter^0] (^5@" .. GetPlayerName(source) .. "^0)", {30, 144, 255}, table.concat(args, " "))
|
||||
end, {help = 'Send a tweet. [IC]'})
|
||||
|
||||
TriggerEvent('es:addCommand', 'ooc', function(source, args, user)
|
||||
table.remove(args, 1)
|
||||
TriggerClientEvent('chatMessage', -1, "OOC | " .. GetPlayerName(source), {128, 128, 128}, table.concat(args, " "))
|
||||
end, {help = 'Send an out of character message to the whole server.'})
|
||||
|
||||
function stringsplit(inputstr, sep)
|
||||
if sep == nil then
|
||||
sep = "%s"
|
||||
end
|
||||
local t={} ; i=1
|
||||
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
|
||||
t[i] = str
|
||||
i = i + 1
|
||||
end
|
||||
return t
|
||||
end
|
||||
Reference in New Issue
Block a user