Hugos Posted July 2, 2019 Share Posted July 2, 2019 Help! I need to make a timer function to kick a player who is not spawn 5 minutes after join. How to do it correctly? function PlayerJoin() ... ... ... setTimer(function() kickPlayer(? ? ?) end, 5000, 0) end addEventHandler("onPlayerJoin", root, PlayerJoin) Link to comment
Scripting Moderators ds1-e Posted July 2, 2019 Scripting Moderators Share Posted July 2, 2019 (edited) 27 minutes ago, Hugos said: Help! I need to make a timer function to kick a player who is not spawn 5 minutes after join. How to do it correctly? function PlayerJoin() ... ... ... setTimer(function() kickPlayer(? ? ?) end, 5000, 0) end addEventHandler("onPlayerJoin", root, PlayerJoin) Are you sure that is good idea? What if he will be downloading resources more than 5 minutes? Besides few advices. Player in event is defined as: source From wiki: You don't need to "create" function within timer, for me it's simpler to use following syntax. Also, time interval is 5000 ms, 5 minutes = 300 000 ms. Take a look at `times to execute`, it's unlimited, most likely it will throw out errors, because defined player doesn't exist, if he will quit. -- From wiki setTimer ( function theFunction, int timeInterval, int timesToExecute [, var arguments... ] ) -- -- Function, interval, times to execute, argument1, argument2 setTimer(kickPlayer, 300000, 1, source, "Reason") Edited July 2, 2019 by majqq Link to comment
Hugos Posted July 2, 2019 Author Share Posted July 2, 2019 (edited) 10 minutes ago, majqq said: Are you sure that is good idea? What if he will be downloading resources more than 5 minutes? Besides few advices. Player in event is defined as: source From wiki: You don't need to "create" function within timer, for me it's simpler to use following syntax. Also, time interval is 5000 ms, 5 minutes = 300 000 ms. Take a look at `times to execute`, it's unlimited, most likely it will throw out errors, because defined player doesn't exist, if he will quit. -- From wiki setTimer ( function theFunction, int timeInterval, int timesToExecute [, var arguments... ] ) -- -- Function, interval, times to execute, argument1, argument2 setTimer(kickPlayer, 300000, 1, source, "Reason") What better way? To players who are not logged in did not occupy the slots? (the player will go to the server and will not enter the account, and the slot will be busy - until he leaves the server.) Edited July 2, 2019 by Hugos Link to comment
Scripting Moderators ds1-e Posted July 2, 2019 Scripting Moderators Share Posted July 2, 2019 2 minutes ago, Hugos said: What better way? To players who are not logged in did not occupy the slots? (the player will go to the server and will not enter the account, and the slot will be busy - until he leaves the server.) Hmm, maybe timer, which will use trigger(Latent)ClientEvent + this function. It will check if player is downloading resources. https://wiki.multitheftauto.com/wiki/IsTransferBoxActive If it returns true, then send back trigger back to server, reset timer, and check again after x minutes, otherwise send back to server, kill timer and kick player? 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