Cinema VIP Area Lua

Ok, I need help ot just a poke in the right direction.

I want to be able to get the THEATER_PRIVILEGED to recognise certain ranks, ie; admin and vip but also to teleport other players out upon entering.

I have read pretty much every article on this and tried added the vip hook into the function GM:PrePlayerEnterTheater as the example shown. I also then tried to use this lua but as someone said it will same messages and that it is best to use the gamemode hooks.

if(SERVER) then
function VIP ()
for k, v in pairs(ents.FindInBox( Vector(x,y,z), Vector(x2,y2,z2) )) do
if v and v:IsValid() then
– With EVOLVE
if( v:EV_GetRank() == “vip” || v:EV_GetRank() == “admin” || v:EV_GetRank() == “superadmin”)
then
v:PrintMessage( HUD_PRINTCENTER, “Welcome, " … v:Nick() … " !”)

else
v:PrintMessage( HUD_PRINTCENTER, “You can’t enter in this area.”)
v:SetPos(Vector(x,y,z)) – Teleport the player at this location on the map
v:SetAngles(Angle(0,148,0))
end
end
end
end
hook.Add(‘Think’, ‘vip’, VIP);
end

Now I edited all the vectors for the vip area and where to teleport them back too, but it is still not working. I really need help.

[editline]14th March 2016[/editline]

Oh, and I meant to say… I save that script above as vip.lua and placed it in the \garrysmod\lua\autorun\server\

I think you may need to look at how k, v pairs work - you’re looping through vectors but then in the line below, expect v to be a player entity

I didn’t write that above script, I found that on here but for the for the likes of us folks who know the basic’s of lua I will just buy this script instead.

https://scriptfodder.com/scripts/view/1472