I have problem how to correct them.
local Timer = {}
g_ResRoot = getResourceRootElement(getThisResource())
g_Root = getRootElement()
g_PlayerData = {}
g_VehicleData = {}
function getting (PlayerSource, rh,gh,bh,r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4,rand )
--outputChatBox("getting started.")
if Timer[PlayerSource] then
killTimer( Timer[PlayerSource] )
end
--rand = tonumber(rand)
if rand then
Timer[PlayerSource] = setTimer(
function ( playerVehicle )
local vehicle = getPedOccupiedVehicle( PlayerSource )
if vehicle then
--setVehicleOverrideLights ( vehicle, 2 )
setVehicleHeadLightColor ( vehicle, rh,gh,bh)
setVehicleColor ( vehicle,r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4 )
end
end
, 1000, 0, vehicle )
end
end
addEvent( "getting", true )
addEventHandler( "getting", getRootElement(), getting )
function stopwhileupdate(PlayerSource)
if Timer[PlayerSource] then
killTimer( Timer[PlayerSource] )
Timer[PlayerSource] = nil
end
end
addEvent( "stopwhileupdate", true )
addEventHandler( "stopwhileupdate", getRootElement(), stopwhileupdate )
function removeStateOnQuit()
killTimer( Timer[source] )
Timer[source] = nil
end
addEventHandler( "onPlayerQuit", getRootElement(), removeStateOnQuit )
g_RPCFunctions = {
addVehicleUpgrade = { option = 'upgrades', descr = 'Adding/removing upgrades' },
removePedFromVehicle = true,
removeVehicleUpgrade = { option = 'upgrades', descr = 'Adding/removing upgrades' },
setElementAlpha = { option = 'alpha', descr = 'Changing your alpha' },
setElementPosition = true,
setElementInterior = true,
--setVehicleColor = true,
setVehicleHeadLightColor = true,
setVehicleOverrideLights = { option = 'lights', descr = 'Forcing lights' },
setVehiclePaintjob = { option = 'paintjob', descr = 'Applying paintjobs' },
setVehicleRotation = true
}
g_OptionDefaults = {
alpha = true,
time = {
set = true,
freeze = true
}
}
function getOption(optionName)
local option = get(optionName:gsub('%.', '/'))
if option then
if option == 'true' then
option = true
elseif option == 'false' then
option = false
end
return option
end
option = g_OptionDefaults
for i,part in ipairs(optionName:split('.')) do
option = option[part]
end
return option
end
addEvent('onServerCall', true)
addEventHandler('onServerCall', g_Root,
function(fnName, ...)
local fnInfo = g_RPCFunctions[fnName]
if fnInfo and ((type(fnInfo) == 'boolean' and fnInfo) or (type(fnInfo) == 'table' and getOption(fnInfo.option))) then
local fn = _G
for i,pathpart in ipairs(fnName:split('.')) do
fn = fn[pathpart]
end
fn(...)
elseif type(fnInfo) == 'table' then
errMsg(fnInfo.descr .. ' is not allowed', source)
end
end
)
function clientCall(player, fnName, ...)
triggerClientEvent(player, 'onClientCall', g_ResRoot, fnName, ...)
end
function startserver()
triggerClientEvent( "start", getRootElement() )
end
addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ), startserver)