zhitmansystem.zip (19,2 КБ)
запрет делать заказ на админа. Как запретить делать заказ на админа? TEAM_ADMIN!
lua\zhitman\sv_core.lua
заменить zhits.canPlaceHit на то что я написал.
function zhits.canPlaceHit(requester, target, price)
if zhits.hitCooldowns[requester:SteamID64()] and zhits.hitCooldowns[requester:SteamID64()] > CurTime() then
return false
end
if target:Team() == TEAM_ADMIN then return false end
if price <= 0 then
zhits.notifyPlayer(requester, 'Offer must be greater than 0!')
return false
end
if not requester:canAfford(price) then
zhits.notifyPlayer(requester, translate 'notEnoughMoney')
return false
end
if not cfg 'jailHits' then
if requester:isArrested() then
zhits.notifyPlayer(requester, translate 'jailHit')
return false
end
end
if cfg 'telephoneOnly' then
if not requester.currentHitPhone then
zhits.notifyPlayer(requester, translate 'mustBeNearPhone')
return false
end
if not IsValid(requester.currentHitPhone) or requester.currentHitPhone:GetPos():DistToSqr(requester:GetPos()) >= 7500 then
zhits.notifyPlayer(requester, translate 'tooFarFromPhone')
return false
end
end
if numToBool(cfg 'limitHits') then
if zhits.hitCount[requester:SteamID64()] and zhits.hitCount[requester:SteamID64()] >= tonumber(cfg 'limitHits') then
zhits.notifyPlayer(requester, translate 'hitLimitReached')
return false
end
end
if numToBool(cfg 'minimumOffer') then
if price < tonumber(cfg 'minimumOffer') then
zhits.notifyPlayer(requester, translate 'offerTooSmall')
return false
end
end
if numToBool(cfg 'maxOffer') then
if price > tonumber(cfg 'maxOffer') then
zhits.notifyPlayer(requester, translate 'offerTooLarge')
return false
end
end
if not cfg 'noHitmanHits' then
if requester:IsHitman() then
zhits.notifyPlayer(requester, translate 'cantPlaceAsHitman')
return false
end
end
if cfg 'oneHitPerPerson' then
if target:HasHit() then
zhits.notifyPlayer(requester, translate 'alreadyHitOnPlayer')
return false
end
end
return true
end
Как сделать точно такое же но со Slownls Hitman?
где код?
lua/slownls_hitman/server/init.lua
замени функцию на 201 строчке
SlownLS.Hitman:addEvent('send_contract', function(self, pPlayer, tblInfos)
if( pPlayer:isHitman() ) then return end
if( SlownLS.Hitman.Config.BlackList[team.GetName(pPlayer:Team())] ) then return end
pPlayer.SlownLS_Hitman_LastContract = pPlayer.SlownLS_Hitman_LastContract or 0
if( pPlayer.SlownLS_Hitman_LastContract > CurTime() ) then
DarkRP.notify(pPlayer, 1, 5, self:getLanguage("contractDelay"))
return
end
local ent = tblInfos.ent
local pVictim = tblInfos.player
local intPrice = tblInfos.price
local strDescription = tblInfos.description
local tblVerifications = self:getConfig('Verifications')
-- Check variables
intPrice = tonumber(intPrice)
if( not intPrice ) then return end
-- Check entity
if( not IsValid(ent) ) then return end
if( ent:GetClass() != "slownls_hitman_phone" ) then return end
if( ent:GetPos():Distance(pPlayer:GetPos()) > 300 ) then return end
-- Check player
if( not IsValid(pVictim) ) then return end
if( not pVictim:IsPlayer() ) then return end
if( pVictim == pPlayer ) then return end
-- Check price
local tblPrice = tblVerifications.price
if( tblPrice.min and intPrice < tblPrice.min ) then
return DarkRP.notify(pPlayer, 1, 5, string.format(self:getLanguage("priceMin"), DarkRP.formatMoney(tblPrice.min)))
end
if( tblPrice.max and intPrice > tblPrice.max ) then
return DarkRP.notify(pPlayer, 1, 5, string.format(self:getLanguage("priceMax"), DarkRP.formatMoney(tblPrice.max)))
end
if( !pPlayer:canAfford(intPrice) ) then
return DarkRP.notify(pPlayer, 1, 5, self:getLanguage("noMoney"))
end
if pVictim:Team() == TEAM_ADMIN then
return DarkRP.notify(pPlayer, 1, 5, 'Запрещено заказывать администрацию')
end
-- Check description
local tblDescription = tblVerifications.description
strDescription = strDescription or ""
if( tblDescription.required ) then
local intLength = string.len(strDescription)
if(tblDescription.min and intLength < tblDescription.min) then
return DarkRP.notify(pPlayer, 1, 5, self:getLanguage("descriptionShort"))
end
if(tblDescription.max and intLength > tblDescription.max) then
return DarkRP.notify(pPlayer, 1, 5, self:getLanguage("descriptionLong"))
end
end
pPlayer:addMoney(- intPrice)
pPlayer.SlownLS_Hitman_LastContract = CurTime() + 5
local intId = table.insert(self.Contracts, {
victim = pVictim,
by = pPlayer,
price = intPrice,
description = strDescription
})
self:sendToHitmans(0, self:getLanguage("contractSendedHitman"))
self:sendContracts()
hook.Run("SlownLS:Hitman:Contract:Sent", pPlayer, self.Contracts[intId])
DarkRP.notify(pPlayer, 0, 5, self:getLanguage("contractSended"))
end)
Спасибо