Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function _kyle_Buildmode_Enable(z)
- z:SendLua("GAMEMODE:AddNotify(\"Build режим активирован. Введите !pvp чтобы выключить\",NOTIFY_GENERIC, 5)")
- --z:GodEnable()
- if z:Alive() then
- ULib.getSpawnInfo(z)
- if _Kyle_Buildmode["restrictweapons"]=="1" then
- z:StripWeapons()
- for x,y in pairs(_Kyle_Buildmode["buildloadout"]) do
- z:Give(y)
- end
- end
- if z:InVehicle() then
- NoCollide(z:GetVehicle())
- end
- end
- --having two buildmode variables seems redundant, however im too lazy to replace one with the other (if possible)
- z.buildmode = true
- z:SetNWBool("_Kyle_Buildmode", true)
- --boolean to say if buildmode was enabled because the player had just spawned
- z:SetNWBool("_Kyle_BuildmodeOnSpawn", z:GetNWBool("_kyle_died"))
- end
- local function _kyle_Buildmode_Disable(z)
- --z:GodDisable()
- z:SetNWBool("_Kyle_Buildmode", false)
- z.buildmode = false
- z:SendLua("GAMEMODE:AddNotify(\"PvP режим активирован. Введите !build чтобы выключить\",NOTIFY_GENERIC, 5)")
- if z:Alive() then
- local pos = z:GetPos()
- if z:InVehicle() then
- TryUnNoCollide(z:GetVehicle())
- if _Kyle_Buildmode["returntospawn"]=="1" then
- --eject player from vehicle so they can be returned to spawn
- z:ExitVehicle()
- end
- end
- if _Kyle_Buildmode["restrictweapons"]=="1" then
- --dont use spawn info that doesnt exist
- ULib.spawn( z, not z:GetNWBool("_Kyle_BuildmodeOnSpawn") )
- --if there isnt any spawn info, use the default loadout
- if z:GetNWBool("_Kyle_BuildmodeOnSpawn") then z:ConCommand("kylebuildmode defaultloadout") end
- end
- --ULIB.spawn moves the player to spawn, this will return the player to where they where while in buildmode
- if _Kyle_Buildmode["returntospawn"]=="0" then
- z:SetPos(pos)
- end
- if z:GetNWBool("kylenocliped") then
- --called when the player had noclip while in buildmode
- z:ConCommand( "noclip" )
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement