NoviceWithManyProblems Posted May 3, 2020 Share Posted May 3, 2020 Ok. client side: addEventHandler("onClientPlayerWasted", localPlayer, function() setTimer(function(source) triggerServerEvent("spawnWastedPlayer", resourceRoot, source) end, 60000, 1, source) end) server side addEvent("spawnWastedPlayer", true) addEventHandler("spawnWastedPlayer", resourceRoot, function(source) spawnPlayer(source, 0, 0, 0) end) why practically never waiting for a spawn takes 1 minute, but it's "randomly", but never longer than that 1 minute? Link to comment
Moderators IIYAMA Posted May 3, 2020 Moderators Share Posted May 3, 2020 (edited) 40 minutes ago, NoviceWithManyProblems said: why practically never waiting for a spawn takes 1 minute, but it's "randomly", but never longer than that 1 minute? Because the moment of execution is aligned with your fps. (Or internal clock) I assume this decision is made in order to reduce constantly activity of the CPU and not blocking processes of other applications. Edited May 3, 2020 by IIYAMA Link to comment
NoviceWithManyProblems Posted May 3, 2020 Author Share Posted May 3, 2020 49 minutes ago, IIYAMA said: Because the moment of execution is aligned with your fps. (Or internal clock) I assume this decision is made in order to reduce constantly activity of the CPU and not blocking processes of other applications. How can I better deduct this time? Link to comment
Moderators IIYAMA Posted May 3, 2020 Moderators Share Posted May 3, 2020 1 hour ago, NoviceWithManyProblems said: How can I better deduct this time? You can tighten the timing a little bit by align it manual. https://wiki.multitheftauto.com/wiki/OnClientPreRender https://wiki.multitheftauto.com/wiki/OnClientRender See example on the following page: https://wiki.multitheftauto.com/wiki/GetTickCount Link to comment
xMKHx Posted May 4, 2020 Share Posted May 4, 2020 addEventHandler("onClientPlayerWasted", localPlayer, function() setTimer(function () triggerServerEvent("spawnWastedPlayer", resourceRoot) end, 60000, 1) end) addEvent("spawnWastedPlayer", true) addEventHandler("spawnWastedPlayer", resourceRoot, function () spawnPlayer(source, 0, 0, 0) end) Non tested Link to comment
KronoS Lettify Posted May 5, 2020 Share Posted May 5, 2020 21 hours ago, xMKHx said: addEventHandler("onClientPlayerWasted", localPlayer, function() setTimer(function () triggerServerEvent("spawnWastedPlayer", resourceRoot) end, 60000, 1) end) addEvent("spawnWastedPlayer", true) addEventHandler("spawnWastedPlayer", resourceRoot, function () spawnPlayer(source, 0, 0, 0) end) Non tested source of your server-side event is a resource, not a player. Link to comment
xMKHx Posted May 5, 2020 Share Posted May 5, 2020 2 hours ago, KronoS Lettify said: source of your server-side event is a resource, not a player. Try this addEventHandler("onClientPlayerWasted", localPlayer, function() local name = getPlayerName(localPlayer) setTimer(function () triggerServerEvent("spawnWastedPlayer", resourceRoot, name) end, 60000, 1) end) addEvent("spawnWastedPlayer", true) addEventHandler("spawnWastedPlayer", resourceRoot, function (name) spawnPlayer(getPlayerFromName(name), 0, 0, 0) end) Link to comment
#\_oskar_/# Posted May 5, 2020 Share Posted May 5, 2020 use onPlayerWasted on the serverside wiht spawnPlayer 1 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