hi. first of all, i am trying to get the member teams, to automaticly put a player, in a certain group from the users.txt file in the "settings" folder. but when the init.lua is run, it says its unable to.
init.lua
hook.Add( "PlayerInitialSpawn", "PlayerReloadToolmenu", ReloadToolMenu )
AddCSLuaFile( "teams.lua" );
include( "teams.lua" );
function GM:PlayerInitialSpawn( player )
if ( pl:IsUserGroup( "SuperAdmin" )) then
player:SetTeam( SuperAdmins.Index );
else
player:SetTeam( Clients.Index );
end
end
i dont know what i am doing wrong here.
teams.lua
TEAM_BASE_INDEX = 2000;
Clients = { Index = TEAM_BASE_INDEX + 1, Name = "Clients", Color = Color( 255, 255, 0 ) };
Friends = { Index = TEAM_BASE_INDEX + 2, Name = "Friends", Color = Color( 0, 0, 255 ) };
VIPs = { Index = TEAM_BASE_INDEX + 3, Name = "VIPs", Color = Color( 50, 255, 50 ) };
Admins = { Index = TEAM_BASE_INDEX + 4, Name = "Admins", Color = Color( 160, 32, 240 ) };
SuperAdmins = { Index = TEAM_BASE_INDEX + 5, Name = "SuperAdmins", Color = Color( 255, 0, 0 ) };
team.SetUp( Clients.Index, Clients.Name, Clients.Color );
team.SetUp( Friends.Index, Friends.Name, Friends.Color );
team.SetUp( VIPs.Index, VIPs.Name, VIPs.Color );
team.SetUp( Admins.Index, Admins.Name, Admins.Color );
team.SetUp( SuperAdmins.Index, SuperAdmins.Name, SuperAdmins.Color );
this file is perfectly fine i think, but i just put it here for reference.
cl_init.lua just includes teams.lua.
users.txt
"Users"
{
//
// This is your users file
//
// You can use this file to add people as admins on your server
// Add them to the relevant section
//
// If you're a Lua coder you can add your own sections and use them
// in your script by doing pl:IsUserGroup( "admin" ) etc
//
"superadmin"
{
//"garry" "STEAM_0:1:XXXXXXXX"
"Griff" "STEAM_0:1:XXXXXXXX"
}
"admin"
{
//"garry" "STEAM_0:1:7099"
}
"VIPs"
{
// vips here
}
"Friends"
{
// Friends here
}
}
i know my STEAM ID has loads of X's in it. its NOT like that in the file. i just dont give away my steam id.
anyway. i am just trying to get the script to well, on player join move the player to the specified teem, decided from users.txt. i do script, but not lua. just php, and mrc etc. so any code that you can give me, or help or otherwise is much apreciated.