Y_MAN Posted July 18, 2014 Posted July 18, 2014 (edited) What error? Client silde script: lua:22: Bad argument @ 'addEventHandler' [Expected function at argument 3, got nil] lua:42: Bad argument @ 'addEventHandler' [Expected function at argument 3, got nil] addEventHandler("onClientResourceStart",resourceRoot,ObjectCreate) function ObjectCreate() local counter = 1 for i = 1,50000 do createObject (3334,10,10+value,10+value) counter = counter + 1 end outputConsole(string.format("%d object created",counter),resourceRoot) end addEventHandler("onClientResourceStart", getRootElement(),hideHUD) function hideHUD() showPlayerHudComponent("all", false) end Edited July 18, 2014 by Guest
Et-win Posted July 18, 2014 Posted July 18, 2014 The functions are not found, place the events under the functions. ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
Y_MAN Posted July 18, 2014 Author Posted July 18, 2014 The functions are not found, place the events under the functions. Well, I do not understand. In what is wrong? What is the solution? Write your example!
Et-win Posted July 18, 2014 Posted July 18, 2014 function ObjectCreate() local counter = 1 for i = 1,50000 do createObject (3334,10,10+value,10+value) counter = counter + 1 end outputConsole(string.format("%d object created",counter),resourceRoot) end addEventHandler("onClientResourceStart",resourceRoot,ObjectCreate) function hideHUD() showPlayerHudComponent("all", false) end addEventHandler("onClientResourceStart", getResourceRootElement(),hideHUD) Or you can do: addEventHandler("onClientResourceStart",resourceRoot, function() local counter = 1 for i = 1,50000 do createObject (3334,10,10+value,10+value) counter = counter + 1 end outputConsole(string.format("%d object created",counter),resourceRoot) end ) addEventHandler("onClientResourceStart", getResourceRootElement(), function() showPlayerHudComponent("all", false) end ) PS: Changed getRootElement() to getResourceRootElement() because it otherwise will start the function by every resource that gets started. ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
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