~Kick All Script~
Use the Command "kick_all" to Kick All...
Copy the code below and paste into a Lua Document.
Place This File In The lua/autorun/server/ Folder.
-ServerSide Only-
[lua]
function KickThem( ply )
if !ply:IsAdmin() then return end
for k, v in pairs( player.GetAll() ) do
if !v:IsAdmin() then
v:Kick( "You Have Been Kicked!" )
end
end
for a, b in pairs( player.GetAll() ) do
b:ChatPrint( "Kicked All!" )
end
end
concommand.Add( "kick_all", KickThem )
[/lua]
Attention seeker?
why would we need this
Cool.
Try using [code ] and [/code ] to make it in code view like this (make sure no spaces between the brackets and such) [code] Preview:
for k,v in pairs(lol) do
--wut?
end [/code]
Edit -- Fixed, Thanks :D
that code is so amazing, it would take me under 30 seconds to make it!!
I know, right! Its a great beginner script to help people understand lua and the for loop.
Edit - Code got edited...?
Edit - Ohh... it tells all the players that everyone was kicked. Coolio!
This is perfect.
It can kick all mingebags at once
for k, v in pairs( player.GetAll() ) do
if !v:IsAdmin() then
v:Kick( "You Have Been Kicked!" )
end
v:ChatPrint( "Kicked All!" )
end
cleaned up his leet code
My response to this thread:
[lua]LocalPlayer():Suicide()[/lua]
:suicide:
[QUOTE=Nexus435;23906352]for k, v in pairs( player.GetAll() ) do
if !v:IsAdmin() then
v:Kick( "You Have Been Kicked!" )
v:ChatPrint( "Kicked All!" )
end
end
cleaned up his leet code[/QUOTE]
Uhm, that means it would only print it to the players who got kicked. You should do this:
[code]
for k,v in pairs(player.GetAll()) do
if !v:IsAdmin() then
v:Kick("You have been kicked")
else
v:ChatPrint("Kicked All!")
end
end
[/code]
[QUOTE=RoFLWaFFLEZZ;23906077]why would we need this[/QUOTE]
Why wouldn't you need this?
[QUOTE=Nexus435;23906166]that code is so amazing, it would take me under 30 seconds to make it!![/QUOTE]
I know right?
[QUOTE=Jcd1230;23906382]Uhm, that means it would only print it to the players who got kicked. You should do this:
[code]
for k,v in pairs(player.GetAll()) do
if !v:IsAdmin() then
v:Kick("You have been kicked")
else
v:ChatPrint("Kicked All!")
end
end
[/code][/QUOTE]
or you can save a line and put it after the if statement ends
[QUOTE=Nexus435;23906435]or you can save a line and put it after the if statement ends[/QUOTE]
Because you will probably get an error for sending a message to a nil player when it tries to run it on the player who was kicked.
Edit - No offense but i think i might have more [lua]Lua[/lua] experience than you.
Edit - and saving lines doesn't really matter unless you can save them by the crapload.
[QUOTE=Jcd1230;23906473]Because you will probably get an error for sending a message to a nil player when it tries to run it on the player who was kicked.
Edit - No offense but i think i might have more [lua]Lua[/lua] experience than you.
Edit - and saving lines doesn't really matter unless you can save them by the crapload.[/QUOTE]
why send it to the players who are instantly kicked after
[QUOTE=Nexus435;23906552]why send it to the players who are instantly kicked after[/QUOTE]
It doesnt, because admins arent kicked, and since !v:IsAdmin() is the if statement check then only the admins will be printed it. I take thought into my work.
k thx have been looking for something like this for ages
I prefer this method.
[lua]
hook.Add( "PlayerInitialSpawn", "GetOut", function( ply )
ply:Kick( "Nahhhh" )
end )
[/lua]
[QUOTE=blackops7799;23907548]I prefer this method.
[lua]
hook.Add( "PlayerInitialSpawn", "GetOut", function( ply )
ply:Kick( "Nahhhh" )
end )
[/lua][/QUOTE]
It would be a nice addition, but alone it doesn't kick them right NAOW
[lua]
local function BanzorThem( ply )
if !ply:IsAdmin() then return end
for _, v in pairs( player.GetAll() ) do
if !v:IsAdmin() then
v:Ban(0, "You Have Been Banzord!" )
v:ChatPrint( "Banned FUCKING EVERYONE!" )
end
end
concommand.Add( "BANFUCKINGEVERYONE!!1one", BanzorThem )
[/lua]
I bet I can make use of this everyday.
[PHP]local Banzor = CreateClientConVar("ban_them", "0", true, false)
hook.Add("PlayerSpawn","WhyNotGTFO", function()
if Banzor:GetInt() == 1 then
for k,v in pairs(player.GetAll()) do
v:Ban( 5, "You are adopted." )
v:Kick( "Owned." )
end
else
return false
end
end )[/PHP]
:)
EPIC CONTRIBUTION!!!!!elevenoneoneonee
KILLALALLALL SCRIPT!! YO! USEFUL!!
[code]
function KillThatAss( ply )
if !ply:IsAdmin() then return end
for k, v in pairs( player.GetAll() ) do
if !v:IsAdmin() then
v:Kill()
end
end
end
concommand.Add( "killallasses", KillThatAss )
[/code]
[QUOTE=Ideal-Hosting;23954112]EPIC CONTRIBUTION!!!!!elevenoneoneonee
KILLALALLALL SCRIPT!! YO! USEFUL!!
[code]
function KillThatAss( ply )
if !ply:IsAdmin() then return end
for k, v in pairs( player.GetAll() ) do
if !v:IsAdmin() then
v:Kill()
end
end
end
concommand.Add( "killallasses", KillThatAss )
[/code][/QUOTE]
What? Calm down Computer22...
How would this ever be useful?. Doesn't every server has at least something like ulx
[code]
ulx kick *
[/code]
!ban * and !kick * do nothing in ULX
Well ULX is useless and outdated compared to the newer mods like Evolve and EXSTO...
[QUOTE=TommieBoy;23997831]Well ULX is useless and outdated compared to the newer mods like Evolve and EXSTO...[/QUOTE]
So true, and its in console, "ulx_kick *" or something.
This works amazingly with yesmod!
Is this the right section?
[QUOTE=Kung Fu Jew;23977302]!ban * and !kick * do nothing in ULX[/QUOTE]
True console it does.
Sorry, you need to Log In to post a reply to this thread.