add sborka
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
PLUGIN.name = "Recruit Zapret"
|
||||
PLUGIN.author = "Scripty"
|
||||
PLUGIN.description = "Ограничения для новобранцев"
|
||||
|
||||
local function IsRecruit(client)
|
||||
local char = client:GetCharacter()
|
||||
if not char then return false end
|
||||
|
||||
local spec = char.GetSpec and char:GetSpec() or 0
|
||||
|
||||
return spec == 1
|
||||
end
|
||||
|
||||
function PLUGIN:CanPlayerEnterVehicle(client, vehicle)
|
||||
if IsRecruit(client) then
|
||||
client:Notify("Новоприбывший не может садиться в транспорт.")
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
local lastNotify = {}
|
||||
|
||||
function PLUGIN:PlayerUse(client, entity)
|
||||
if not IsRecruit(client) then return end
|
||||
if not IsValid(entity) then return end
|
||||
if not entity:IsDoor() then return end
|
||||
|
||||
local t = CurTime()
|
||||
if (lastNotify[client] or 0) > t then
|
||||
return false
|
||||
end
|
||||
lastNotify[client] = t + 0.5
|
||||
|
||||
client:Notify("Новоприбывший не может открывать двери.")
|
||||
return false
|
||||
end
|
||||
|
||||
function PLUGIN:PlayerCanPickupWeapon(client, weapon)
|
||||
if IsRecruit(client) then
|
||||
client:Notify("Новоприбывший не может поднимать оружие.")
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:CanPlayerEquipItem(client, item)
|
||||
if IsRecruit(client) and item.isWeapon then
|
||||
client:Notify("Новоприбывший не может экипировать оружие.")
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:PlayerUseArsenal(client)
|
||||
local char = client:GetCharacter()
|
||||
if not char then return false end
|
||||
|
||||
local spec = char.GetSpec and char:GetSpec() or 0
|
||||
if spec == 1 then
|
||||
client:Notify("Новоприбывший не имеет доступа к арсеналу.")
|
||||
return false
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user