ply:Kick

Alrighty so I’ve been working on my script again and finally got my reading of the users.txt working, now the problem seems to be my ply:Kick, whenever it’s used it screws up the script (probably the problem before hand, can someone help me with what I’m doing wrong?

This works:
[lua]function GM:PlayerInitialSpawn( ply )
for k,v in pairs(player.GetAll()) do
if !v:IsUserGroup(“vip”) then
ply:PrintMessage( HUD_PRINTTALK, “Hey sexy, “…ply:Nick()…” you’re the best ;).” )
ply:SetTeam( 1 )
end
end
end[/lua]

This doesn’t:
[lua]function GM:PlayerSpawn( ply )
for k,v in pairs(player.GetAll()) do
if !v:IsUserGroup(“vip”) then
ply:Kick(“You’re not an ECGamers.com VIP”)
end
end
end[/lua]


function GM:PlayerSpawn( ply )
for k,v in pairs(player.GetAll()) do
		if !v:IsUserGroup("vip") then
			ply:Disconnect ("You're not an ECGamers.com VIP")
		end
	end
end

Dont know if it works.

[lua]function GM:PlayerInitialSpawn(ply)
if !ply:IsUserGroup(“vip”) then
ply:Kick(“You are not an ECGamers.com VIP”)
end
end[/lua]

:doh: I must be tired or something :stuck_out_tongue:

-snip-

:wtc:

This has not worked for me at any time, it is no longer the ply:IsUserGroup, so please leave that be, but whether

…:Kick() is in initial spawn or regular spawn it fucks the script up and makes it stop working, there are no error messages or anything it just doesn’t work…

[lua]
hook.Add(“PlayerInitialSpawn”, “NoVIP”, function( ply )
timer.Simple( .1, function()
if ValidEntity( ply ) and !ply:IsUserGroup(“vip”) then
ply:Kick(“You are not a VIP!”)
end
end )
end )
[/lua]

OMG COMBINE I LOVE YOU!!!

Thank you so much that actually worked so now I can start doing some implementing, thankies so much!

:buddy: