My server doesn't recognise my commands

Hi guys,

I’m writing this topic because I’m in trouble …
I tried to script the same thing as the “basic scripting” wiki, so I made a copy/paste just to see what it does.
So after that I launch my server which tell me that it started the resource “vehicle”. To this point everything looks like it’s going the right way but after when I try to do some commands in game like “/vehicle” to make a vehicle appear, nothing appears and my server doesn’t say the error message …
Maybe it is a problem with the locations of client.lua and server.lua which are in my script folder for now …
Thanks for help guys
See ya’

Did you edit the Chat.lua?

Place your script and the __resource.lua into "resources/vehiclespawn

insert into: __resource.lua
client_script ‘client.lua’
server_script ‘server.lua’

load the script via citmp-server.yml under
“AutoStartResource:”
-vehiclespawn

restart the server and try /vehicle adder

Yes I’ve made all of this but I only edited the client_chat.lua, maybe it is because of that.

Nah that is right. Could you post your client and server.lua? I guess you made something wrong.

Here is the client.lua
RegisterNetEvent(“createCarAtPlayerPos”)
AddEventHandler(‘createCarAtPlayerPos’, function(message)
Citizen.CreateThread(function()
Citizen.Wait(50)
local carid = GetHashKey(message)
local playerPed = GetPlayerPed(-1)
if playerPed and playerPed ~= -1 then
RequestModel(carid)
while not HasModelLoaded(carid) do
Citizen.Wait(0)
end
local playerCoords = GetEntityCoords(playerPed)
playerCoords = playerCoords + vector3(0, 2, 0)
local car = CreateVehicle(carid, playerCoords, 0.0, true, false)
TaskWarpPedIntoVehicle(playerPed, car, -1)

        TriggerEvent('chatMessage', 'SYSTEM', {0, 255, 0}, "Vehicle spawned.")
    end
end)

end)

and the server.lua
RegisterServerEvent(“chatCommandEntered”)
AddEventHandler(‘chatCommandEntered’, function(fullcommand)
command = stringsplit(fullcommand, " ")

if(command[1] == "/vehicle") then 
    TriggerClientEvent("createCarAtPlayerPos", source, command[2])
    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

Or it is because I named the folder vehicles and not vehiclespawn ? If it is because of that we can’t name our scripts like we want ?

The code seems fine. Sure you can name your scrips how you like. Dunno whats the issue right now.

Well I will try to figure it out, thanks for your help mate :slight_smile:

Try this, it worked for me.

Go into your FiveReborn Server/resources/initial folder and check if you have the __resource.lua - If not, create one and add "server_script ‘net_init.lua’ to it and your commands should work.