Benny/gamemodes/benny/gamemode/player.lua

169 lines
2.8 KiB
Lua

---------------------
-- Your Name is Benny
---------------------
function GM:PlayerSpawn( ply )
player_manager.SetPlayerClass( ply, "player_benny" )
ply:SetViewOffset( Vector( 0, 0, 64 ) )
ply:SetViewOffsetDucked( Vector( 0, 0, 50 ) )
ply:Give( "itemhandler" )
ply:SetStamina( 1 )
ply:SetCrouchedWalkSpeed( 0.3 )
ply:SetDuckSpeed( 0.1 )
ply:SetUnDuckSpeed( 0.1 )
ply:SetSlowWalkSpeed( 100 )
ply:SetWalkSpeed( 200 )
ply:SetRunSpeed( 200 )
ply:SetStepSize( 18 )
ply:SetCanZoom( false )
ply:MakeCharacter()
end
function GM:PlayerNoClip()
return true
end
local PT = FindMetaTable( "Player" )
local bgl = {
["benny"] = {
[0] = Vector( 0.275, 0.7, 0.7 ),
[1] = 17,
[2] = 7,
[3] = 2,
[4] = 11,
[5] = 3,
[6] = 0,
[7] = 0,
[8] = 3,
[9] = 0,
[10] = 0,
[11] = 0,
[12] = 3,
[13] = 0,
},
["nikki"] = {
[0] = Vector( 0.9, 0.3, 0.9 ),
[1] = 17,
[2] = 7,
[3] = 2,
[4] = 11,
[5] = 3,
[6] = 0,
[7] = 0,
[8] = 2,
[9] = 1,
[10] = 5,
[11] = 0,
[12] = 3,
[13] = 0,
},
["igor"] = {
[0] = Vector( 0.776, 0.929, 0.89 ),
[1] = 4,
[2] = 6,
[3] = 2,
[4] = 3,
[5] = 1,
[6] = 0,
[7] = 2,
[8] = 3,
[9] = 3,
[10] = 6,
[11] = 2,
[12] = 1,
[13] = 0,
},
["yanghao"] = {
[0] = Vector( 0.627, 0.21, 0.186 ),
[1] = 13,
[2] = 2,
[3] = 0,
[4] = 3,
[5] = 0,
[6] = 1,
[7] = 3,
[8] = 0,
[9] = 3,
[10] = 4,
[11] = 0,
[12] = 0,
[13] = 0,
},
["mp_cia"] = {
[0] = Vector( 1, 1, 1 )
},
["mp_plasof"] = {
[0] = Vector( 1, 1, 1 )
},
["mp_militia"] = {
[0] = Vector( 1, 1, 1 )
},
["mp_natguard"] = {
[0] = Vector( 1, 1, 1 )
},
["mp_viper"] = {
[0] = Vector( 1, 1, 1 )
},
["mp_halo"] = {
[0] = Vector( 1, 1, 1 )
},
}
function PT:MakeCharacter()
local char = "benny"
self:SetModel( "models/player/infoplayerrealism.mdl" )
self:SetPlayerColor( bgl[char][0] )
self:SetBodygroup( 0, 0 )
self:SetSkin( 3 )
for i, v in ipairs( bgl[char] ) do
self:SetBodygroup( i, v )
end
end
function PT:HandlerCheck()
local wep = self:GetActiveWeapon()
return ( wep:IsValid() and wep:GetClass() == "itemhandler" and wep.GetActiveR ) and wep or false
end
-- Temporary
function GM:UpdateAnimation( ply, vel, maxseqgroundspeed )
local len = vel:Length()
local movement = 1.0
if ( len > 0.2 ) then
movement = ( len / maxseqgroundspeed )
end
local rate = math.min( movement, 2 )
-- if we're under water we want to constantly be swimming..
if ( ply:WaterLevel() >= 2 ) then
rate = math.max( rate, 0.5 )
elseif ( !ply:IsOnGround() && len >= 1000 ) then
rate = 0.1
end
ply:SetPlaybackRate( rate )
end
function GM:HandlePlayerJumping( ply, vel )
return false
end
function GM:HandlePlayerVaulting( ply, vel )
return false
end
function GM:HandlePlayerLanding( ply, vel, onground )
return false
end
function GM:HandlePlayerNoClipping( ply, vel )
return false
end