This is really got me confused xD (RESOLVED)


RegisterNetEvent(“SetVehicleFixed”)
AddEventHandler(‘SetVehicleFixed’, function(message)
Citizen.CreateThread(function() – Created a new thread
Citizen.Wait(50) – A wait function for 50 miliseconds.
local playerPed = GetPlayerPed(-1) – Gets the player that ran the command.
if playerPed and playerPed ~= -1 then – Checks if the player exists
local car = GetVehiclePedIsIn(playerPed,false)
SetVehicleEngineHealth(car, 1000)
TriggerEvent(‘chatMessage’, ‘VehicleRepair:’, {0, 255, 0}, “Vehicle fixed.”)
elseif IsPedOnFoot(GetPlayerPed(-1)) then
TriggerEvent(‘chatMessage’, ‘VehicleRepair:’, {255, 0, 0}, “You are not in a car!”)
end
end
end)
end)

^ Whats wrong with this… this should work!!! ^


RegisterServerEvent(“chatCommandEntered”)
AddEventHandler(‘chatCommandEntered’, function(fullcommand)
command = stringsplit(fullcommand, " ")

if(command[1] == "/fix") then -- Captures the command
    TriggerClientEvent("SetVehicleFixed", source, command[2])
    end

end)

function stringsplit(self, delimiter) – A function
local a = self:Split(delimiter) – Splits the string.
local t = {} – Creates a table

for i = 0, #a - 1 do – For loop to loop through all the arguments.
table.insert(t, a[i]) – Inserts the arguments into a table
end

return t – Returns the table
end

^ Also this is messed up and i need help fixing it. ^

All of that is horribly outdated, take a look at FreeRoam2 for the new events

I tried to update this and i haven’t got any luck… i would rather just use this as a resource its self instead of FreeRoam2.

But none of this is event remotely correct anymore.

@kanersps I know. ill just leave it and remake it. i just wanted help redoing it. anyways thanks for replying.