PD Hazır Eşya Çantası

Bilgilendirme

Oyundaki legal birimler için eşya çantası hazırlayabilirsiniz. Paket içeriğinde 8 adet çanta hazır durumda, isterseniz içeriklerini değiştirebilirsiniz, isterseniz yeni çantalar ekleyebilirsiniz. Düzenleme yapmak isterseniz bb_resources/scripts/server/policebag.lua üzerinden düzenleme yapabilirsiniz.


bb_resources


Paramedic = {
	['firstaid'] = 20,
	['bandage'] = 20,
	['painkillers'] = 20,
}

SWAT1 = {
	['weapon_smg'] = 1,
	['smg_ammo'] = 10,
	['smg_extendedclip'] = 1,
	['smg_scope'] = 1,
	['pistol_suppressor'] = 1,
}

SWAT2 = {
	['weapon_specialcarbine'] = 1,
	['rifle_ammo'] = 10,
	['smg_extendedclip'] = 1,
	['smg_scope'] = 1,
	['pistol_suppressor'] = 1,
	['combatpdw_grip'] = 1,
}

Stajyer = {
	['weapon_pistol_mk2'] = 1,
	['weapon_stungun'] = 1,
	['weapon_nightstick'] = 1,
	['weapon_flashlight'] = 1,
	['heavyarmor'] = 5,
	['pistol_ammo'] = 10,
	['handcuffs'] = 2,
	['handcuffkey'] = 1,
	['gps'] = 1,
	['radio'] = 1,
	['empty_evidence_bag'] = 5,
	['bodycam'] = 1,
	['pdkimlik'] = 1,
	-- ['harness'] = 1,
	['bandage'] = 10,
}

Officer = {
	['weapon_smg'] = 1,
	['weapon_ltl'] = 1,
	['weapon_glock17'] = 1,
	['weapon_stungun'] = 1,
	['weapon_nightstick'] = 1,
	['weapon_flashlight'] = 1,
	['heavyarmor'] = 5,
	['pistol_ammo'] = 20,
	['smg_ammo'] = 10,
	['shotgun_ammo'] = 5,
	['handcuffs'] = 2,
	['handcuffkey'] = 1,
	['gps'] = 1,
	['radio'] = 1,
	['empty_evidence_bag'] = 5,
	['bodycam'] = 1,
	['pdkimlik'] = 1,
	-- ['harness'] = 1,
	['bandage'] = 10,
}

Sergeant = {
	['weapon_appistol'] = 1,
	['weapon_carbinerifle'] = 1,
	['weapon_ltl'] = 1,
	['weapon_glock17'] = 1,
	['weapon_stungun'] = 1,
	['weapon_nightstick'] = 1,
	['weapon_flashlight'] = 1,
	['heavyarmor'] = 5,
	['pistol_ammo'] = 20,
	['smg_ammo'] = 10,
	['shotgun_ammo'] = 5,
	['handcuffs'] = 2,
	['handcuffkey'] = 1,
	['gps'] = 1,
	['radio'] = 1,
	['empty_evidence_bag'] = 5,
	['bodycam'] = 1,
	['pdkimlik'] = 1,
	-- ['harness'] = 1,
	['drone_flyer_1'] = 1,
	['bandage'] = 10,
	['firstaid'] = 1,
}

Lieutenant = {
	['weapon_appistol'] = 1,
	['weapon_carbinerifle_mk2'] = 1,
	['weapon_ltl'] = 1,
	['weapon_glock17'] = 1,
	['weapon_stungun'] = 1,
	['weapon_nightstick'] = 1,
	['weapon_flashlight'] = 1,
	['heavyarmor'] = 5,
	['pistol_ammo'] = 20,
	['smg_ammo'] = 10,
	['shotgun_ammo'] = 5,
	['handcuffs'] = 2,
	['handcuffkey'] = 1,
	['gps'] = 1,
	['radio'] = 1,
	['empty_evidence_bag'] = 5,
	['bodycam'] = 1,
	['pdkimlik'] = 1,
	['police_stormram'] = 1,
	-- ['harness'] = 1,
	['drone_flyer_1'] = 1,
	['bandage'] = 10,
	['firstaid'] = 1,
}

Captain = {
	['weapon_appistol'] = 1,
	['weapon_specialcarbine'] = 1,
	['weapon_ltl'] = 1,
	['weapon_glock17'] = 1,
	['weapon_stungun'] = 1,
	['weapon_nightstick'] = 1,
	['weapon_flashlight'] = 1,
	['heavyarmor'] = 5,
	['pistol_ammo'] = 20,
	['smg_ammo'] = 10,
	['handcuffs'] = 2,
	['handcuffkey'] = 1,
	['gps'] = 1,
	['radio'] = 1,
	['empty_evidence_bag'] = 5,
	['bodycam'] = 1,
	['pdkimlik'] = 1,
	['police_stormram'] = 1,
	-- ['harness'] = 1,
	['drone_flyer_1'] = 1,
	['bandage'] = 10,
	['firstaid'] = 1,
}

QBCore.Functions.CreateUseableItem('paramedikcantasi', function(source, item)
	local Player = QBCore.Functions.GetPlayer(source)
	if Player then
		for k,v in pairs(Paramedic) do
			info = {serie = SetItemsSeries(source)}
			Player.Functions.AddItem(k, v)
		end
		Player.Functions.RemoveItem(item.name, item.amount)
		TriggerClientEvent('QBCore:Notify', source, 'Çantadan eşyalar çıkartıldı.', 'success')
	end
end)

QBCore.Functions.CreateUseableItem('swat1cantasi', function(source, item)
	local Player = QBCore.Functions.GetPlayer(source)
	if Player then
		for k,v in pairs(SWAT1) do
			info = {serie = SetItemsSeries(source)}
			Player.Functions.AddItem(k, v, false, info)
		end
		Player.Functions.RemoveItem(item.name, item.amount)
		TriggerClientEvent('QBCore:Notify', source, 'Çantadan eşyalar çıkartıldı.', 'success')
	end
end)

QBCore.Functions.CreateUseableItem('swat2cantasi', function(source, item)
	local Player = QBCore.Functions.GetPlayer(source)
	if Player then
		for k,v in pairs(SWAT2) do
			info = {serie = SetItemsSeries(source)}
			Player.Functions.AddItem(k, v, false, info)
		end
		Player.Functions.RemoveItem(item.name, item.amount)
		TriggerClientEvent('QBCore:Notify', source, 'Çantadan eşyalar çıkartıldı.', 'success')
	end
end)

QBCore.Functions.CreateUseableItem('stajyercantasi', function(source, item)
	local Player = QBCore.Functions.GetPlayer(source)
	if Player then
		for k,v in pairs(Stajyer) do
			info = {serie = SetItemsSeries(source)}
			Player.Functions.AddItem(k, v, false, info)
		end
		Player.Functions.RemoveItem(item.name, item.amount)
		TriggerClientEvent('QBCore:Notify', source, 'Çantadan eşyalar çıkartıldı.', 'success')
	end
end)

QBCore.Functions.CreateUseableItem('officercantasi', function(source, item)
	local Player = QBCore.Functions.GetPlayer(source)
	if Player then
		for k,v in pairs(Officer) do
			info = {serie = SetItemsSeries(source)}
			Player.Functions.AddItem(k, v, false, info)
		end
		Player.Functions.RemoveItem(item.name, item.amount)
		TriggerClientEvent('QBCore:Notify', source, 'Çantadan eşyalar çıkartıldı.', 'success')
	end
end)

QBCore.Functions.CreateUseableItem('cavuscantasi', function(source, item)
	local Player = QBCore.Functions.GetPlayer(source)
	if Player then
		for k,v in pairs(Sergeant) do
			info = {serie = SetItemsSeries(source)}
			Player.Functions.AddItem(k, v, false, info)
		end
		Player.Functions.RemoveItem(item.name, item.amount)
		TriggerClientEvent('QBCore:Notify', source, 'Çantadan eşyalar çıkartıldı.', 'success')
	end
end)

QBCore.Functions.CreateUseableItem('tegmencantasi', function(source, item)
	local Player = QBCore.Functions.GetPlayer(source)
	if Player then
		for k,v in pairs(Lieutenant) do
			info = {serie = SetItemsSeries(source)}
			Player.Functions.AddItem(k, v, false, info)
		end
		Player.Functions.RemoveItem(item.name, item.amount)
		TriggerClientEvent('QBCore:Notify', source, 'Çantadan eşyalar çıkartıldı.', 'success')
	end
end)

QBCore.Functions.CreateUseableItem('captancantasi', function(source, item)
	local Player = QBCore.Functions.GetPlayer(source)
	if Player then
		for k,v in pairs(Captain) do
			info = {serie = SetItemsSeries(source)}
			Player.Functions.AddItem(k, v, false, info)
		end
		Player.Functions.RemoveItem(item.name, item.amount)
		TriggerClientEvent('QBCore:Notify', source, 'Çantadan eşyalar çıkartıldı.', 'success')
	end
end)


function SetItemsSeries(src)
	local Player = QBCore.Functions.GetPlayer(src)
	local seriNumber = nil
	local randomNumber = math.random(11,99)
	if Player then
	    local jobs = (Player.PlayerData.job.name == 'police' and "PD") or (Player.PlayerData.job.name == 'sheriff' and "SD") or (Player.PlayerData.job.name == 'harmony' and "HR") or (Player.PlayerData.job.name == 'parkranger' and "PR") or (Player.PlayerData.job.name == 'sasp' and "ST") or "STATE"
	    seriNumber = tostring(jobs.."-"..RandomInt(2) .. RandomStr(3) .. RandomInt(1) .. RandomStr(2) .. RandomInt(3) .. RandomStr(1))
	end
	return seriNumber
end


local StringCharset = {}
local NumberCharset = {}

for i = 48,  57 do table.insert(NumberCharset, string.char(i)) end
for i = 65,  90 do table.insert(StringCharset, string.char(i)) end
for i = 97, 122 do table.insert(StringCharset, string.char(i)) end

RandomStr = function(length)
	if length > 0 then
		return RandomStr(length-1) .. StringCharset[math.random(1, #StringCharset)]
	else
		return ''
	end
end

RandomInt = function(length)
	if length > 0 then
		return RandomInt(length-1) .. NumberCharset[math.random(1, #NumberCharset)]
	else
		return ''
	end
end

Last updated