Jump to content
Sultan

[Script] KickAllPlayers

Recommended Posts

[Script] KickAllPlayers

This function is helpful to kick everyone out of the game to ensure no one is lost item during restart or attempted to dupe.

  • KickCha Function, Add it inside your Functions.lua
function KickCha(character)
	local pkt = GetPacket()
	WriteCmd(pkt,1505)
	SendPacket(character,pkt)
end

 

  • Add this inside your Variable.lua
KickAllPlayers = false

 

  • Put this inside your cha_timer at Functions.lua
if(KickAllPlayers == true)then
	if(IsPlayer(role) == 1)then
		KickCha(role)
	end
end

 

  • Use the following function in-game to start Gameserver closing: "Stop( time in seconds )"
&lua_all Stop(20)
  • When system display like 5 second(s) remaining to close Gameserver, use this function in-game instantly to kick everyone out:
&lua_all KickAllPlayers = true

 

Edited by Sultan
  • Like 2

Share this post


Link to post
Share on other sites
28 минуты назад, Syfax сказал:

Can you share Maintenance &lua_all command script? thanks

variable.lua

Maintenance = false

functions.lua, cha_timer()

if (IsPlayer(role) == 1) then
		
	if (Maintenance == true and GetGmLv(role) == 0) then
		
		HelpInfo(role, 0, "Server is under maintenance, please try again later!")
		KickCha(role)
		
	end
		
end

Usage:

&lua_all Maintenance = true

 

  • Like 1

Share this post


Link to post
Share on other sites
14 hours ago, V3ct0r said:

variable.lua

Maintenance = false

functions.lua, cha_timer()

if (IsPlayer(role) == 1) then
		
	if (Maintenance == true and GetGmLv(role) == 0) then
		
		HelpInfo(role, 0, "Server is under maintenance, please try again later!")
		KickCha(role)
		
	end
		
end

Usage:

&lua_all Maintenance = true

 

It didn't work even while using your HandleChat GS

Share this post


Link to post
Share on other sites
8 hours ago, Yomazu said:

Read again, v3ct0r means use char_timer function: functions.lua, cha_timer() .

Uhm , i know what's a cha_timer 

Share this post


Link to post
Share on other sites

@Syfax

Do you use GameServer.exe with GetGmLv(role) function?

 

try

if (IsPlayer(role) == 1) then
		
	if (Maintenance == true) then
		
		HelpInfo(role, 0, "Server is under maintenance, please try again later!")
		KickCha(role)
		
	end
		
end

 


Share this post


Link to post
Share on other sites
On 11/6/2022 at 8:06 PM, dragontechi said:

@V3ct0r the command works excellent but for some reason I always kick everyone who is lv 0 but the helpinfo does not come up saying that it is under maintenance

I am sorry, but looks like I don't quite understand your problem. The script should kick all players, not only characters with level 0.


Share this post


Link to post
Share on other sites
4 hours ago, V3ct0r said:

I am sorry, but looks like I don't quite understand your problem. The script should kick all players, not only characters with level 0.

sorry my english the command is taking out the players that are not gm but it is not sending the maintenance message

Share this post


Link to post
Share on other sites
On 11/8/2022 at 10:28 PM, dragontechi said:

sorry my english the command is taking out the players that are not gm but it is not sending the maintenance message

Try to remove or comment the line:

KickCha(role)

Will a HelpInfo window appear?


Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...