- Katılım
- 2 yıl 4 ay 23 gün
- Mesajlar
- 80
- Discord
- AlphaCarry#2425
.
Son düzenleme:
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.
TriggerClientEvent('cylex:ReturnInventory', _source, xPlayer.getQuantity('melon'), xPlayer.getQuantity('choped_melon'), xPlayer.getQuantity('sarap'), xPlayer.getQuantity('choped_sarap'),xPlayer.job.name, currentZone)
end)
Itemlerin ismini istedigin gibi degistirebilirsin, tam olarak ne istedigini anlamadim.elimdeki kodu bu şekilde değiştirince şarap işi çözüme kavuştu yalnız karpuz işi haşa sıkıntılı ayrıca bu kodu uyguladığımızda database üzerinde sarap ve choped_sarap ın yerlerini değiştirmesi gerekmekte yani data base üzerinde sarap iteminin labelini üzüm choped_sarap ın labelini ise şarap şeklinde değiştirmesi gerek yalnız şuan bir mesleğe özgü yapmak istiyorum bu scripti mümkünmüdür?
KOD SATIRI/SERVER KISMI:
Kod:ESX = nil local CopsConnected = 0 local PlayersHarvestingMelon = {} local PlayersTransformingMelon = {} local PlayersSellingMelon = {} local PlayersHarvestingSarap = {} local PlayersTransformingSarap = {} local PlayersSellingSarap = {} TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) function CountCops() local xPlayers = ESX.GetPlayers() CopsConnected = 0 for i=1, #xPlayers, 1 do local xPlayer = ESX.GetPlayerFromId(xPlayers[i]) if xPlayer.job.name == 'police' then CopsConnected = CopsConnected + 1 end end -- SetTimeout(120 * 1000, CountCops) end -- CountCops() ------------------------------------------------------- -----------------------Sarap---------------------------- ------------------------------------------------------- local function HarvestSarap(source) SetTimeout(Config.TimeToFarmSarap, function() if PlayersHarvestingSarap[source] == true then local _source = source local xPlayer = ESX.GetPlayerFromId(_source) xPlayer.addInventoryItem('sarap', 1) HarvestSarap(source) end end) end RegisterServerEvent('cylex:startHarvestSarap') AddEventHandler('cylex:startHarvestSarap', function() local _source = source PlayersHarvestingSarap[_source] = true TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) HarvestSarap(_source) end) RegisterServerEvent('cylex:stopHarvestSarap') AddEventHandler('cylex:stopHarvestSarap', function() local _source = source PlayersHarvestingSarap[_source] = false end) local function TransformSarap(source) SetTimeout(Config.TimeToProcessSarap, function() if PlayersTransformingSarap[source] == true then local _source = source local xPlayer = ESX.GetPlayerFromId(_source) if xPlayer.getQuantity('choped_sarap') > 25 then TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) elseif xPlayer.getQuantity('sarap') < 5 then TriggerClientEvent('esx:showNotification', source, _U('not_enough_sarap')) else xPlayer.removeInventoryItem('sarap', 5) xPlayer.addInventoryItem('choped_sarap', 1) TransformSarap(source) end end end) end RegisterServerEvent('cylex:startTransformSarap') AddEventHandler('cylex:startTransformSarap', function() local _source = source PlayersTransformingSarap[_source] = true TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) TransformSarap(_source) end) RegisterServerEvent('cylex:stopTransformSarap') AddEventHandler('cylex:stopTransformSarap', function() local _source = source PlayersTransformingSarap[_source] = false end) local function SellSarap(source) SetTimeout(Config.TimeToSellSarap, function() if PlayersSellingSarap[source] == true then local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local poochQuantity = xPlayer.getQuantity('choped_sarap') if poochQuantity == 0 then TriggerEvent('mythic_notify:client:SendAlert', { type = 'error', text = 'Satıcak uyuşturucu paketi kalmadı.'}) else xPlayer.removeInventoryItem('choped_sarap', 1) xPlayer.addAccountMoney('black_money', 50) SellSarap(source) end end end) end RegisterServerEvent('cylex:startSellSarap') AddEventHandler('cylex:startSellSarap', function() local _source = source PlayersSellingSarap[_source] = true TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) SellSarap(_source) end) RegisterServerEvent('cylex:stopSellSarap') AddEventHandler('cylex:stopSellSarap', function() local _source = source PlayersSellingSarap[_source] = false end) ------------- KARPUZ ------------------- local function HarvestMelon(source) if PlayersHarvestingMelon[source] == true then SetTimeout(Config.TimeToFarmMelon, function() local src = source local xPlayer = ESX.GetPlayerFromId(src) xPlayer.addInventoryItem('melon', 1) HarvestMelon(source) end) end end RegisterServerEvent('cylex:startHarvestMelon') AddEventHandler('cylex:startHarvestMelon', function() local _source = source PlayersHarvestingMelon[_source] = true TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) HarvestMelon(_source) end) RegisterServerEvent('cylex:stopHarvestMelon') AddEventHandler('cylex:stopHarvestMelon', function() local _source = source PlayersHarvestingMelon[_source] = false end) local function TransformMelon(source) SetTimeout(Config.TimeToProcessMelon, function() if PlayersTransformingMelon[source] == true then local _source = source local xPlayer = ESX.GetPlayerFromId(_source) if xPlayer.getQuantity('choped_melon') > 25 then TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) elseif xPlayer.getQuantity('melon') < 5 then TriggerClientEvent('esx:showNotification', source, _U('not_enough_melon')) else xPlayer.removeInventoryItem('melon', 5) xPlayer.addInventoryItem('choped_melon', 1) TransformMelon(source) end end end) end RegisterServerEvent('cylex:startTransformMelon') AddEventHandler('cylex:startTransformMelon', function() local _source = source PlayersTransformingMelon[_source] = true TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) TransformMelon(_source) end) RegisterServerEvent('cylex:stopTransformMelon') AddEventHandler('cylex:stopTransformMelon', function() local _source = source PlayersTransformingMelon[_source] = false end) local function SellMelon(source) SetTimeout(Config.TimeToSellMelon, function() if PlayersSellingMelon[source] == true then local _source = source local xPlayer = ESX.GetPlayerFromId(_source) if xPlayer.getQuantity('choped_melon') == 0 then TriggerClientEvent('esx:showNotification', source, _U('no_pouches_melon_sale')) else xPlayer.removeInventoryItem('choped_melon', 1) xPlayer.addMoney(20) TriggerClientEvent('esx:showNotification', source, _U('sold_one_melon')) SellMelon(source) end end end) end RegisterServerEvent('cylex:startSellMelon') AddEventHandler('cylex:startSellMelon', function() local _source = source PlayersSellingMelon[_source] = true TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) SellMelon(_source) end) RegisterServerEvent('cylex:stopSellMelon') AddEventHandler('cylex:stopSellMelon', function() local _source = source PlayersSellingMelon[_source] = false end) RegisterServerEvent('cylex:GetUserInventory') AddEventHandler('cylex:GetUserInventory', function(currentZone) local _source = source local xPlayer = ESX.GetPlayerFromId(_source) TriggerClientEvent('cylex:ReturnInventory', _source, xPlayer.getQuantity('melon'), xPlayer.getQuantity('choped_melon'), xPlayer.getQuantity('sarap'), xPlayer.getQuantity('choped_sarap'), xPlayer.job.name, currentZone) end) ESX.RegisterUsableItem('sarap', function(source) local _source = source local xPlayer = ESX.GetPlayerFromId(_source) xPlayer.removeInventoryItem('sarap', 1) TriggerClientEvent('cylex:onPot', _source) TriggerClientEvent('mythic_notify:client:SendAlert', _source, { type = 'inform', text = _U('used_one_sarap')}) end)
function DogruMeslek()
if PlayerData ~= nil then
local DogruMeslek = false
if PlayerData.job ~= nil and PlayerData.job.name == 'sarapci' then
DogruMeslek = true
end
return DogruMeslek
end
end
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
PlayerData = xPlayer
end)
RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
PlayerData.job = job
end)
if DogruMeslek() then
-- buraya meslek dogruysa E basip ise baslama gibi bir script koyabilirsin
end
Yukarida zaten ne yapman gerektigini yazdim.şey benim databesemde olan bir hata sanırsam üzüm toplayınca şarap veriyor sonra onu işleyince gene şarap veriyor item id si doğru ilk başta sarap daha sonra choped_sarap şeklinde veriyor ancak benim data basede sarap'ın label'i de sarap olduğu için öyle bir sıkıntı veriyordu neyse bu önemli değil zaten.
Şuan aradığım kısım satışı bir mesleğe ait yapmak istiyorum zaten kod satırı mevcut attım ancak satış kısmının içerisine mi ekleyeceğim yoksa ayrı bir kısıma yazıp servertrigger mi oluşturacağım onu çözemedim rica etsem tam olarak yazacağım şeyi atabilir misin?
Forumdan daha fazla yararlanmak için giriş yapın veya kayıt olun!