Works fine on my end.
Did you add them to a __resource.lua?
Well, i’m a scrub. i forgot the resource file… Thanks man! I appreciate you!
So i tried to change your script a little and make an ID checker aswell.
this is what i got
CLIENT:
RegisterNetEvent("CheckID")
AddEventHandler("CheckID", function()
local domath = math.random(1,3)
TriggerEvent('chatMessage', "NCIC", {10, 120, 255}, "Running ^5License^0...")
Wait(math.ceil(2500))
if domath == 1 then
TriggerEvent('chatMessage', "NCIC", {10, 120, 255}, "^3Warrant^0: ^1Skipped bail")
elseif domath == 2 then
TriggerEvent('chatMessage', "NCIC", {10, 120, 255}, "^3ALERT^0: ^1Expired License^0!")
elseif domath == 3 then
TriggerEvent('chatMessage', "LSPD", {10, 120, 255}, "License is ^2clear^0.")
end
end)
SERVER:
AddEventHandler('chatMessage', function(player, playerName, message)
local message = string.lower(message)
local args = stringsplit(message, " ");
if message == "/runid" then
TriggerClientEvent('chatMessage', player, "NCIC", {10, 120, 255} , "Invalid No Records Found")
CancelEvent()
elseif args[2] ~= nil then
TriggerClientEvent('CheckID', player)
CancelEvent()
end
end)
function stringsplit(self, delimiter)
local a = self:Split(delimiter)
local t = {}
for i = 0, #a - 1 do
table.insert(t, a[i])
end
return t
end
In game when i type /runid 1 it gives me both plate and id returns even when they are not suppose to be talking to each other. Any ideas?
try adding elseif args[1] ~= "/runid" then
before args[2]
no joy, still does the same thing
Did you do the same for the plate script?
elseif args[1] ~= "/runid" then
elseif args[2] ~= nil then
TriggerClientEvent('CheckID', player)
elseif args[1] ~= "/plate" then
elseif args[2] ~= nil then
TriggerClientEvent('CheckPlate', player)
that worked. thanks again bro! i appreciate it!
Can you help me please? Can you contact me on discord please? my discord is…
discord: helicopter#6991
No worries. Updated my original post if anyone else wants to use it.
can u please teach me how to use the code things?
thanks i love u no homo
can u add me on discord? I have a few questions about the server i’m trying to make and i need help… a lot
@ helicopter#6991
“i know i did not create these and am not take any credit for it just need help getting this working for fxserver thanks in advance”
check plate script
client.lua
RegisterNetEvent("CheckPlate")
AddEventHandler("CheckPlate", function()
local domath = math.random(1,3)
TriggerEvent('chatMessage', "LSPD", {10, 120, 255}, "Running ^5plate^0...")
Wait(math.ceil(2500))
if domath == 1 then
TriggerEvent('chatMessage', "LSPD", {10, 120, 255}, "^3Warrant^0: ^1Skipped bail")
elseif domath == 2 then
TriggerEvent('chatMessage', "LSPD", {10, 120, 255}, "Vehicle is reported ^1stolen^0!")
elseif domath == 3 then
TriggerEvent('chatMessage', "LSPD", {10, 120, 255}, "Vehicle is ^2clean^0.")
end
end)
server.lua
AddEventHandler('chatMessage', function(player, playerName, message)
local message = string.lower(message)
local args = stringsplit(message, " ");
if message == "/checkplate" then
TriggerClientEvent('chatMessage', player, "LSPD", {10, 120, 255} , "Invalid plate number")
CancelEvent()
elseif args[1] ~= "/checkplate" then
elseif args[2] ~= nil then
TriggerClientEvent('CheckPlate', player)
CancelEvent()
end
end)
function stringsplit(self, delimiter)
local a = self:Split(delimiter)
local t = {}
for i = 0, #a - 1 do
table.insert(t, a[i])
end
return t
end
Run ID
client.lua
RegisterNetEvent("CheckID")
AddEventHandler("CheckID", function()
local domath = math.random(1,3)
TriggerEvent('chatMessage', "NCIC", {10, 120, 255}, "Running ^5License^0...")
Wait(math.ceil(2500))
if domath == 1 then
TriggerEvent('chatMessage', "NCIC", {10, 120, 255}, "^3Warrant^0: ^1Skipped bail")
elseif domath == 2 then
TriggerEvent('chatMessage', "NCIC", {10, 120, 255}, "^3ALERT^0: ^1Expired License^0!")
elseif domath == 3 then
TriggerEvent('chatMessage', "LSPD", {10, 120, 255}, "License is ^2clear^0.")
end
end)
server.lua
AddEventHandler('chatMessage', function(player, playerName, message)
local message = string.lower(message)
local args = stringsplit(message, " ");
if message == "/ncic" then
TriggerClientEvent('chatMessage', player, "NCIC", {10, 120, 255} , "Invalid No Records Found")
CancelEvent()
elseif args[1] ~= "/ncic" then
elseif args[2] ~= nil then
TriggerClientEvent('CheckID', player)
CancelEvent()
end
end)
function stringsplit(self, delimiter)
local a = self:Split(delimiter)
local t = {}
for i = 0, #a - 1 do
table.insert(t, a[i])
end
return t
end
Not 100% sure, but this might be something that’ll help you. Under Porting Notes in the wiki it shows they are using the lua stringsplit function:
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
Blockquote
Error running system event handling function for resource platecheck: citizen:/scripting/lua/scheduler.lua:39: Failed to execute thread: server.lua:15: attempt to call a nil value (method ‘Split’)
stack traceback:
server.lua:15: in function ‘stringsplit’
server.lua:3: in upvalue ‘handler’
citizen:/scripting/lua/scheduler.lua:124: in function citizen:/scripting/lua/scheduler.lua:123
stack traceback:
[C]: in function ‘error’
citizen:/scripting/lua/scheduler.lua:39: in field ‘CreateThreadNow’
citizen:/scripting/lua/scheduler.lua:123: in function citizen:/scripting/lua/scheduler.lua:92
Should my __Resource folder look like this?
Why is there two Server.lua ?
thanks works for me
can help me then lol