GMOD LUA - 冻结并强制切换到"键"

时间:2018-06-17 22:18:45

标签: lua

(gmod DarkRP服务器的代码)

所以我想编辑一个冻结玩家(找到here)的physgun脚本,这样它也会强迫玩家进入"键"当你接他们(当他们的悲伤或杀死球员) 应该很简单,但脚本不起作用...... 任何人有任何想法或提示?已经尝试将代码放入自动运行和服务器自动运行。 谢谢!

PS。 第一篇文章,抱歉,如果我做错了什么



function GODMODE( ply, dmginfo) if(ply:GetNWInt("GOD") == 1) then
        dmginfo:ScaleDamage(0)
    end

hook.Add("EntityTakeDamage", "GODMODE", GODMODE)
    end

hook.add("PhysgunDrop", "ply_physgunfreeze", function(ply, ent)
    hook.Remove("PhysgunDrop", "ulxPlayerDrop")

    ent._frozen = false if( ent:IsPlayer()) then
        ent.SetMoveType(ply:KeyDown(IN_ATTACK2) and MOVETYPE_NOCLIP or MOVETYPE_WALK)

    if(ply:KeyDown(IN_ATTACK2)) then
        ent:Freeze(true)
        RunCOnsoleCommand( "use", "keys" )
        ent:SetNWInt(GODMODE, 1)
        ent:DisallowSpawning( not should_unfreeze)
        ulx.setNoDie(ent, not should_unfreeze)
    else
        ent:Freeze(false)
        ent:SetNWInt(GODMODE, 0)
        ent:DisallowSpawning(false)
        ulx.setNoDie(ent, should_unfreeze)

        end
    if SERVER then if not ent:Alive() then
            ent:Spawn()
            self:PlayerSpawn(ent)
            ent:SetPos(ply:GetEyeTrace().HitPos)
        end
    end
    return
end
end)

    hook.Add("PhysgunPickup", "ply_frozen", function(pl, ent)
        if (ent:IsPlayer() )then
            ent._frozen = true
            print( "Entity is a player!" )
            RunConsoleCommand( "use", "keys")
        else
            print( "Entity is not a player!" )
            return false
        end
    end)

    function playerdies( ply, weapon, killer ) if(ply._frozen)then
        return false
    else
        return true
    end

hook.Add("CanPlayerSuicide", "playerNoDeath", playerDies)
    end




0 个答案:

没有答案