so i've looked around and used some code and modified it a little but still it doesn't work. tried a cl_init.lua and a player.lua in the gamemode but it doesn't work. im not a genius so i really need some help
local ply = LocalPlayer()
function ply:InitialSpawn(ply)
ply:SetCanZoom(false)
ply:SetRunSpeed(245)
ply:SetWalkSpeed(245)
ply:SetMaxSpeed(245)
end
function PlayerHasSpawned(ply)
ply:SetRunSpeed(245)
ply:SetWalkSpeed(245)
ply:SetMaxSpeed(245)
end
hook.Add("PlayerSpawn", "PlayerSpawnHook", PlayerHasSpawned(ply) )
hook.Add("pspawn", "pspawnhook", player:InitialSpawn(ply) )
function GM:ScaleNPCDamage(npc,hitgroup,dmginfo)
if dmginfo:IsFallDamage() then
dmginfo:ScaleDamage(0)
end
end
hook.add("falldmg","falldmghook",GM:ScaleNPCDamage() )
hook.Add("ScalePlayerDamage", "fallhook", function(ply, dmginfo)
if dmginfo:IsFallDamage() then
dmginfo:ScaleDamage(0)
end
end)
\
Not sure how to cancel sprinting, but for Fall Damage, run a http://wiki.garrysmod.com/page/GM/GetFallDamage hook and just return 0. (Not tested so sorry if i'm wrong)
Your code has a lot of syntactical and logical errors that would be raising actual Lua errors. You should check out some Lua tutorials to become familiar with how your code should be structured.
thank you! the fall damage actually worked, but unfortunately i cannot disable sprinting still but it makes no sense at all, can anyone help with that?
function GM:PlayerSpawn( ply )
ply:SetWalkSpeed(245)
ply:SetRunSpeed(245)
ply:SetMaxSpeed(245)
print(testttt)
end
function GM:ScaleNPCDamage(npc,hitgroup,dmginfo)
if dmginfo:IsFallDamage() then
dmginfo:ScaleDamage(0)
end end
function GM:PlayerSpawn( player )
player:SetWalkSpeed(245)
player:SetRunSpeed(245)
player:SetMaxSpeed(245)
print(testttt)
end
function GM:GetFallDamage( ply, speed )
return ( 0 / speed )
end
function GM:GetFallDamage( ply, speed )
return 0
end
Hrm. Not sure if this would work but check if the player is holding shift and just set his walk speed to the walk speed.
Sorry, you need to Log In to post a reply to this thread.