- Katılım
- 2 yıl 7 ay 21 gün
- Mesajlar
- 85
Merhaba, ben okok'un diyalog sistemini kullanıyorum. Polis ve EMS de cephanelik ve depoya entegre etmem lazım. fakat event'e nasıl çevirebilirim bilmiyorum. qb-shops kullanıyorum cephanelik için.
Forum içeriğine ve tüm hizmetlerimize erişim sağlamak için foruma kayıt olmalı ya da giriş yapmalısınız. Foruma üye olmak tamamen ücretsizdir.
if IsControlJustReleased(1, 51) then
Gunshop()
end
qb-shops'un client tarafına gir ve
bu şekilde olan kodun (kodyun içinde gunshop yerine başka birşeyde yazabilir) dialog scriptinin triger eventini ekle.Kod:if IsControlJustReleased(1, 51) then Gunshop() end
Citizen.CreateThread(function()
while true do
local InRange = false
local PlayerPed = PlayerPedId()
local PlayerPos = GetEntityCoords(PlayerPed)
local wait = 2000
if PlayerData.job then
for shop, _ in pairs(Config.Locations) do
if Config.Locations[shop]["job"] == "all" or Config.Locations[shop]["job"] == PlayerData.job.name then
local position = Config.Locations[shop]["coords"]
for _, loc in pairs(position) do
local dist = #(vector3(PlayerPos) - vector3(loc["x"], loc["y"], loc["z"]))
if dist < 3 then
DrawMarker(2, loc["x"], loc["y"], loc["z"], 0, 0, 0, 0, 0, 0, 0.2, 0.2, 0.2, 32, 236, 54, 100, 0, 0, 0, 1, 0, 0, 0)
text = Config.Locations[shop]["label"]
wait = 1
InRange = true
-- DrawMarker(2, loc["x"], loc["y"], loc["z"], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.25, 0.2, 0.1, 255, 255, 255, 155, 0, 0, 0, 1, 0, 0, 0)
if dist < 1 then
text = '[E] - '..text
if IsControlJustPressed(0, Config.Keys["E"]) then
if Config.Locations[shop]["label"] == "Silahçı" then
if not exports["tq-level"]:checkLevel(3) then
exports['h-notif']:send('fas fa-exclamation-circle', 'error', 'Silahçı seni tanımıyor.', 'top-center', 5000)
break
end
end
if Config.Locations[shop]["label"] == "Blackmarket" then
if not exports["tq-level"]:checkLevel(3) then
exports['h-notif']:send('fas fa-exclamation-circle', 'error', 'Satıcı seni tanımıyor.', 'top-center', 5000)
break
end
end
local ShopItems = {}
ShopItems.label = Config.Locations[shop]["label"]
ShopItems.items = Config.Locations[shop]["products"]
ShopItems.slots = 30
TriggerServerEvent("inventory:server:OpenInventory", "shop", "Itemshop_"..shop, ShopItems)
end
end
-- DrawText3D(loc["x"], loc["y"], loc["z"] , text)
end
end
end
end
end
Citizen.Wait(wait)
end
end)
RegisterNetEvent('xxx:xxx:xxx', function()
if Config.Locations[shop]["label"] == "Silahçı" then
if not exports["tq-level"]:checkLevel(3) then
exports['h-notif']:send('fas fa-exclamation-circle', 'error', 'Silahçı seni tanımıyor.', 'top-center', 5000)
break
end
end
if Config.Locations[shop]["label"] == "Blackmarket" then
if not exports["tq-level"]:checkLevel(3) then
exports['h-notif']:send('fas fa-exclamation-circle', 'error', 'Satıcı seni tanımıyor.', 'top-center', 5000)
break
end
end
local ShopItems = {}
ShopItems.label = Config.Locations[shop]["label"]
ShopItems.items = Config.Locations[shop]["products"]
ShopItems.slots = 30
TriggerServerEvent("inventory:server:OpenInventory", "shop", "Itemshop_"..shop, ShopItems)
end)
options = {
{"Siah almak istiyorum", 'xxx:xxx:xxx', 'c'},
},
peki bu silahçı için, bunu lspd market için nasıl yapıcam?Önce o createThread i sileceksin, sonra
bunu yazacaksın, sonra okokTalkNpc configine gidip yeni bir npc ekleyipKod:RegisterNetEvent('xxx:xxx:xxx', function() if Config.Locations[shop]["label"] == "Silahçı" then if not exports["tq-level"]:checkLevel(3) then exports['h-notif']:send('fas fa-exclamation-circle', 'error', 'Silahçı seni tanımıyor.', 'top-center', 5000) break end end if Config.Locations[shop]["label"] == "Blackmarket" then if not exports["tq-level"]:checkLevel(3) then exports['h-notif']:send('fas fa-exclamation-circle', 'error', 'Satıcı seni tanımıyor.', 'top-center', 5000) break end end local ShopItems = {} ShopItems.label = Config.Locations[shop]["label"] ShopItems.items = Config.Locations[shop]["products"] ShopItems.slots = 30 TriggerServerEvent("inventory:server:OpenInventory", "shop", "Itemshop_"..shop, ShopItems) end)
Kod:options = { {"Siah almak istiyorum", 'xxx:xxx:xxx', 'c'}, },
options kısmını bunun gibi yapacaksın, o xxx:xxx:xx artık sen ne yazarsan
bilmem sence ne yapabilirsin, aynı yöntemi deneyeceksin, lspd marketini açan kodu alacaksın gene okokTalknpc configine yeni bir npc ekleyeceksin, onun optionsundaki event bölümüne örneğin "lsp:market-Open:" "c" yazacakısn mesela, kodlar bende yok görmeden bilemem atarsın buraya bakmaya çalışırım müsait oldukça
Citizen.CreateThread(function()
while true do
local wait = 1000
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
for k,v in pairs(Config.Jobs) do
if PlayerData.job ~= nil then
if PlayerData.job.name == k then
wait = 500
local distance = #(coords - vector3(v.Stash.coords.x, v.Stash.coords.y, v.Stash.coords.z))
if distance <= 2.3 then
wait = 0
text = v.Stash.text
if distance <= 1.0 then
text = "~b~E ~w~- " ..text
if IsControlJustPressed(0, 46) then
-- stash açma kodu
OpenStash(v)
end
end
DrawText3Ds(v.Stash.coords.x, v.Stash.coords.y, v.Stash.coords.z, text)
end
local distance = #(coords - vector3(v.Shop.coords.x, v.Shop.coords.y, v.Shop.coords.z))
if distance <= 2.3 then
wait = 0
text = v.Shop.text
if distance <= 1.0 then
text = "~b~E ~w~- " ..text
if IsControlJustPressed(0, 46) then
-- stash açma kodu
OpenMarket(v)
end
end
DrawText3Ds(v.Shop.coords.x, v.Shop.coords.y, v.Shop.coords.z, text)
end
end
end
end
Citizen.Wait(wait)
end
end)
RegisterNetEvent('aaa:bbb:OpenStash', function()
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
for k,v in pairs(Config.Jobs) do
if PlayerData.job ~= nil then
if PlayerData.job.name == k then
local distance = #(coords - vector3(v.Stash.coords.x, v.Stash.coords.y, v.Stash.coords.z))
if distance <= 5.0 then
OpenStash(v)
end
end
end
end
end)
RegisterNetEvent('aaa:bbb:OpenMarket', function()
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
for k,v in pairs(Config.Jobs) do
if PlayerData.job ~= nil then
if PlayerData.job.name == k then
local distance = #(coords - vector3(v.Shop.coords.x, v.Shop.coords.y, v.Shop.coords.z))
if distance <= 5.0 then
OpenMarket(v)
end
end
end
end
OpenMarket(v)
end)
create threadı silince marketler çalışmayacak amaCreateThread i sil,
Kod:RegisterNetEvent('aaa:bbb:OpenStash', function() OpenStash(v) end) RegisterNetEvent('aaa:bbb:OpenMarket', function() OpenMarket(v) end)
bunları nasıl tetikleyeceğini biliyorsundur umarım? okokTalkNpc de oluşturduğun npclerin options' bölümünden butona basıldığında tetikleteceksin, zaten config.lua' sında anlatıyor olması gerek
Attığım kodu yazıp dediğimi yaparsa çalışır, yeni hali*create threadı silince marketler çalışmayacak ama
peki npcye nasıl polis marketini açmasını sağlayacağım? çünkü police marketi falan configde ayarlı clientte sadece e basma olayı var.CreateThread i sil,
Kod:RegisterNetEvent('aaa:bbb:OpenStash', function() local ped = PlayerPedId() local coords = GetEntityCoords(ped) for k,v in pairs(Config.Jobs) do if PlayerData.job ~= nil then if PlayerData.job.name == k then local distance = #(coords - vector3(v.Stash.coords.x, v.Stash.coords.y, v.Stash.coords.z)) if distance <= 5.0 then OpenStash(v) end end end end end) RegisterNetEvent('aaa:bbb:OpenMarket', function() local ped = PlayerPedId() local coords = GetEntityCoords(ped) for k,v in pairs(Config.Jobs) do if PlayerData.job ~= nil then if PlayerData.job.name == k then local distance = #(coords - vector3(v.Shop.coords.x, v.Shop.coords.y, v.Shop.coords.z)) if distance <= 5.0 then OpenMarket(v) end end end end OpenMarket(v) end)
bunları nasıl tetikleyeceğini biliyorsundur umarım? okokTalkNpc de oluşturduğun npclerin options' bölümünden butona basıldığında tetikleteceksin, zaten config.lua' sında anlatıyor olması gerek
Forumdan daha fazla yararlanmak için giriş yapın veya kayıt olun!