Hi does anyone know the code so I put in chat /showid first & last name [Player ID:]
then it shows your game ID?
Remade that script real quick. It will send the notification to anyone in proximity. You can configure the proximity in client.lua
.
Code
fxmanifest.lua
fx_version "cerulean"
game "gta5"
author "gegen#4674"
server_script "server.lua"
client_script "client.lua"
server.lua
RegisterCommand("showid", function (source, args)
local src = source
if args == nil or args[1] == nil then
TriggerClientEvent('chat:addMessage', src, {
color = { 255, 0, 0},
multiline = true,
args = {'Error', 'Please enter a name.'}
})
else
TriggerClientEvent('ShowId::PostMessage', -1, src, {GetPlayerName(src) .. ' (' .. src .. ') ' .. 'shows ID', args[1]})
end
end)
client.lua
local proximity = 10
TriggerEvent('chat:addSuggestion', '/showid', 'Show your name to nearby players', {
{ name="name", help="First and last name of your character" },
})
RegisterNetEvent('ShowId::PostMessage')
AddEventHandler('ShowId::PostMessage', function(player, args)
local playerCoords = GetEntityCoords(GetPlayerPed(GetPlayerFromServerId(player)))
local coords = GetEntityCoords(PlayerPedId())
if GetDistanceBetweenCoords(playerCoords, coords, false) < proximity then
TriggerEvent('chat:addMessage', {
color = { 255,255,0},
multiline = true,
args = args
})
end
end)
Thanks man really appreciate it.
Hi how do I make it so I can do first name and last name because when I type /showid John Doe it will only put John in chat and not let me put a last name?