pocko Posted January 26, 2012 Share Posted January 26, 2012 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) Link to comment
Castillo Posted January 26, 2012 Share Posted January 26, 2012 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, playerSource, rh,gh,bh,r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4 ) 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", resourceRoot, startserver) Not sure if it'll work. Link to comment
Kenix Posted January 26, 2012 Share Posted January 26, 2012 Show how you trigger events: stopwhileupdate, getting Link to comment
pocko Posted January 27, 2012 Author Share Posted January 27, 2012 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, playerSource, rh,gh,bh,r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4 ) 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", resourceRoot, startserver) Not sure if it'll work. Ty Solidsnake14 you are the god of scripters Link to comment
Kenix Posted January 27, 2012 Share Posted January 27, 2012 Show how you trigger this events: stopwhileupdate, getting Link to comment
Castillo Posted January 27, 2012 Share Posted January 27, 2012 Kenix: Why's that? if he said "Thanks", I guess it worked? Link to comment
Kenix Posted January 27, 2012 Share Posted January 27, 2012 Kenix: Why's that? if he said "Thanks", I guess it worked? Maybe he not tested. Show how you trigger events:stopwhileupdate, getting I not sure if he trigger correct. Link to comment
pocko Posted January 27, 2012 Author Share Posted January 27, 2012 anythink Work so i tell tnx to all ! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now