Jump to content

KickPlayer


Hugos

Recommended Posts

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
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? :D

Besides few advices.

Player in event is defined as:

source

From wiki:

52P7iSM.png

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 by majqq
Link to comment
10 minutes ago, majqq said:

 Are you sure that is good idea? What if he will be downloading resources more than 5 minutes? :D

Besides few advices.

 Player in event is defined as:


source

From wiki:

52P7iSM.png

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 by Hugos
Link to comment
  • Scripting Moderators
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...