Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AddCSLuaFile( "cl_init.lua" )
- AddCSLuaFile( "shared.lua" )
- include( 'shared.lua' )
- // Serverside only stuff goes here
- /*---------------------------------------------------------
- Name: gamemode:PlayerLoadout( )
- Desc: Give the player the default spawning weapons/ammo
- ---------------------------------------------------------*/
- function GM:PlayerLoadout(ply) --"The weapons/items that the player spawns with" function
- ply:StripWeapons() -- This command strips all weapons from the player.
- if ply:Team() == 1 then --If the player is on team "Guest"...
- ply:Give("weapon_physcannon") -- ...then give them the Gravity Gun.
- elseif ply:Team() == 2 then -- Otherwise, if the player is on team "Another Guest"...
- ply:Give("weapon_physgun") -- ...then give them the Phys Gun.
- ply:SetModel("models/player/gman_high.mdl")
- end -- This ends the if/elseif.
- end -- This ends the function.
- function GM:ShowSpare2( ply ) -- This hook is called everytime F1 is pressed.
- umsg.Start( "MyMenu", ply ) -- Sending a message to the client.
- umsg.End()
- end --Ends function
- function team_1( ply )
- ply:SetTeam( 1 )
- end
- function team_2( ply )
- ply:SetTeam( 2 )
- end
- hook.Add("PlayerDisconnected", "SavePlayerData", function(ply)
- if not file.Exists("/skeletongamemodedata","DATA") then
- file.CreateDir("skeletongamemodedata")
- end
- local data = {}
- data.team = ply:Team()
- data = util.TableToJSON(data, true)
- file.Write("/skeletongamemodedata/"..ply:SteamID64()..".txt", data)
- end)
- hook.Add("PlayerInitialSpawn", "LoadPlayerData", function(ply)
- if not file.Exists("/skeletongamemodedata/"..ply:SteamID64()..".txt", "DATA") then return end
- local data = file.Read("/skeletongamemodedata/"..ply:SteamID64()..".txt", "DATA")
- data = util.JSONToTable(data)
- ply:SetTeam(data.team)
- end)
- concommand.Add( "team_1", team_1 )
- concommand.Add( "team_2", team_2 )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement