Advertisement
Guest User

Untitled

a guest
Sep 30th, 2015
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1.  
  2. AddCSLuaFile( "cl_init.lua" )
  3. AddCSLuaFile( "shared.lua" )
  4.  
  5. include( 'shared.lua' )
  6.  
  7.  
  8. // Serverside only stuff goes here
  9.  
  10. /*---------------------------------------------------------
  11. Name: gamemode:PlayerLoadout( )
  12. Desc: Give the player the default spawning weapons/ammo
  13. ---------------------------------------------------------*/
  14. function GM:PlayerLoadout(ply) --"The weapons/items that the player spawns with" function
  15.  
  16. ply:StripWeapons() -- This command strips all weapons from the player.
  17.  
  18. if ply:Team() == 1 then --If the player is on team "Guest"...
  19. ply:Give("weapon_physcannon") -- ...then give them the Gravity Gun.
  20.  
  21. elseif ply:Team() == 2 then -- Otherwise, if the player is on team "Another Guest"...
  22. ply:Give("weapon_physgun") -- ...then give them the Phys Gun.
  23. ply:SetModel("models/player/gman_high.mdl")
  24.  
  25. end -- This ends the if/elseif.
  26.  
  27. end -- This ends the function.
  28.  
  29. function GM:ShowSpare2( ply ) -- This hook is called everytime F1 is pressed.
  30. umsg.Start( "MyMenu", ply ) -- Sending a message to the client.
  31. umsg.End()
  32. end --Ends function
  33.  
  34. function team_1( ply )
  35.  
  36. ply:SetTeam( 1 )
  37.  
  38. end
  39.  
  40. function team_2( ply )
  41.  
  42. ply:SetTeam( 2 )
  43. end
  44.  
  45. hook.Add("PlayerDisconnected", "SavePlayerData", function(ply)
  46. if not file.Exists("/skeletongamemodedata","DATA") then
  47. file.CreateDir("skeletongamemodedata")
  48. end
  49. local data = {}
  50. data.team = ply:Team()
  51. data = util.TableToJSON(data, true)
  52. file.Write("/skeletongamemodedata/"..ply:SteamID64()..".txt", data)
  53. end)
  54.  
  55. hook.Add("PlayerInitialSpawn", "LoadPlayerData", function(ply)
  56. if not file.Exists("/skeletongamemodedata/"..ply:SteamID64()..".txt", "DATA") then return end
  57. local data = file.Read("/skeletongamemodedata/"..ply:SteamID64()..".txt", "DATA")
  58. data = util.JSONToTable(data)
  59. ply:SetTeam(data.team)
  60. end)
  61.  
  62. concommand.Add( "team_1", team_1 )
  63. concommand.Add( "team_2", team_2 )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement