- Katılım
- 5 yıl 9 ay 14 gün
- Mesajlar
- 578
- Discord
- Mub#9999
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.
end vermeyi unutmuş olabilir misin ?
RegisterNetEvent("mkilit")
AddEventHandler("mkilit", function()
if doorUnlockable then
doorState = doorState == 1 and 0 or 1
cachedData["motelRooms"][roomId]["roomLocked"] = doorState
DoorSystemSetDoorState(cachedData["doorHandle"], doorState, true, true)
TriggerServerEvent("pluto_motels:syncDoorState", roomId, doorState)
else
ESX.ShowNotification("Bu oda size ait değil.")
end
end)
RegisterNetEvent("mkira")
AddEventHandler("mkira", function(roomRentable)
ESX.TriggerServerCallback("pluto_motels:rentRoom", function(rented, errorMessage)
if rented then
exports["diazmotelkey"]:AddKey({
["label"] = motelData["motelName"] .. " - oda " .. roomNumber,
["keyId"] = "room-" .. roomId,
["uuid"] = NetworkGetRandomInt()
})
ESX.ShowNotification("You just " .. (motelData["rentMode"] and "rented room " or "bought room ") .. roomNumber .. " for $" .. motelData["motelPrice"])
else
ESX.ShowNotification(errorMessage)
end
end, roomId, motelData)
end)
pluto_motels:rentRoom bu callbacki bulup bana atarmısınız?
ESX.RegisterServerCallback("pluto_motels:rentRoom", function(source, callback, interiorId, motelData)
local player = ESX.GetPlayerFromId(source)
local playerMoney = Config.NewESX and player.getAccount("money")["money"] or player.getMoney()
local playerBankMoney = player.getAccount("bank")["money"]
local defaultRoomData = {
["roomFinish"] = motelData["roomFinish"],
["roomLocked"] = 1,
["roomStorages"] = {},
["motelName"] = motelData["motelName"]
}
if player then
if not interiorId then return callback(false, "No room number got specified.") end
if playerMoney < motelData["motelPrice"] and playerBankMoney < motelData["motelPrice"] then return callback(false, "You don't have enough money, you need $" .. motelData["motelPrice"] - playerMoney) end
if not Config.DiscInventory then
for furnitureName, furnitureData in pairs(motelData["furniture"]) do
if furnitureData["type"] == "storage" then
defaultRoomData["roomStorages"][furnitureName] = {
["cash"] = 0,
["black_money"] = 0,
["items"] = {}
}
end
end
end
local sqlQuery = [[
INSERT
INTO
pluto_motels
(interiorId, roomOwner, roomData, latestPayment)
VALUES
(@interiorId, @roomOwner, @roomData, @latestPayment)
]]
MySQL.Async.execute(sqlQuery, {
["@interiorId"] = interiorId,
["@roomOwner"] = player["identifier"],
["@roomData"] = json.encode(defaultRoomData),
["@latestPayment"] = os.time()
}, function(rowsChanged)
if rowsChanged and rowsChanged > 0 then
if playerMoney >= motelData["motelPrice"] then
player.removeMoney(motelData["motelPrice"])
cachedData["motelRooms"][interiorId] = {
["roomOwner"] = player["identifier"],
["roomLocked"] = 1,
["roomData"] = defaultRoomData,
["roomFinish"] = defaultRoomData["roomFinish"],
["roomStorages"] = defaultRoomData["roomStorages"],
["latestPayment"] = os.time(),
["paymentTimer"] = os.difftime(os.time(), os.time()) / 3600
}
callback(true)
TriggerClientEvent("pluto_motels:syncRooms", -1, cachedData["motelRooms"])
elseif playerBankMoney >= motelData["motelPrice"] then
player.removeAccountMoney("bank", motelData["motelPrice"])
cachedData["motelRooms"][interiorId] = {
["roomOwner"] = player["identifier"],
["roomLocked"] = 1,
["roomData"] = defaultRoomData,
["roomFinish"] = defaultRoomData["roomFinish"],
["roomStorages"] = defaultRoomData["roomStorages"],
["latestPayment"] = os.time(),
["paymentTimer"] = os.difftime(os.time(), os.time()) / 3600
}
callback(true)
TriggerClientEvent("pluto_motels:syncRooms", -1, cachedData["motelRooms"])
end
else
callback(false, "Couldn't insert in db.")
end
end)
else
callback(false, "Player doesn't exist.")
end
end)
pluto_motels:syncRooms bu eventide alabilirmiyim ve motel scriptinizde f3 için kullandığınız eventler veya callbackleri motel scriptinizde aktif olarak kullanılıyormu?
RegisterNetEvent("pluto_motels:syncRooms")
AddEventHandler("pluto_motels:syncRooms", function(motelData)
if motelData then
cachedData["motelRooms"] = motelData
end
end)
RegisterNetEvent("mkira")
AddEventHandler("mkira", function(roomRentable)
ESX.TriggerServerCallback("pluto_motels:rentRoom", function(rented, errorMessage)
if rented then
exports["diazmotelkey"]:AddKey({
["label"] = motelData["motelName"] .. " - oda " .. roomNumber,
["keyId"] = "room-" .. roomId,
["uuid"] = NetworkGetRandomInt()
})
ESX.ShowNotification("You just " .. (motelData["rentMode"] and "rented room " or "bought room ") .. roomNumber .. " for $" .. motelData["motelPrice"])
else
ESX.ShowNotification(errorMessage)
end
end, roomId, motelData)
end)
hayır bulunmamaktaDediğimi anlamadınız mesela bu event;
triggerlı bir şekilde motelin içinde kullanılıyormu örnek olarak TriggerEvent("mkira") buna benzer bir satır varmı?Kod:RegisterNetEvent("mkira") AddEventHandler("mkira", function(roomRentable) ESX.TriggerServerCallback("pluto_motels:rentRoom", function(rented, errorMessage) if rented then exports["diazmotelkey"]:AddKey({ ["label"] = motelData["motelName"] .. " - oda " .. roomNumber, ["keyId"] = "room-" .. roomId, ["uuid"] = NetworkGetRandomInt() }) ESX.ShowNotification("You just " .. (motelData["rentMode"] and "rented room " or "bought room ") .. roomNumber .. " for $" .. motelData["motelPrice"]) else ESX.ShowNotification(errorMessage) end end, roomId, motelData) end)
if IsControlledJustPressed(0, statü)
if IsControlledJustPressed(1, kira tuşu)
AddEventHandler('mkira', function()
-- buraya ifin içindeki kod satırı
end)
zaten komut şeklinde hiç bir sıkıntı oluşturmuyor ben np-menü de kullandığım zaman sıkıntı çıkarıyor tuşa eklemek değil amacım np-menü entegre şekilde sorunsuz çalıştırmakEventi baştan yapın kira tuşunun statüsüyle veya direk kendisiyle client dosyalarını arayın şöyle birşey olması lazım;
Kod:if IsControlledJustPressed(0, statü)
veya
Kod:if IsControlledJustPressed(1, kira tuşu)
yanında then vb olabilir bunu bulduğun zaman client dosyasının en altına gel ve oraya;
Kod:AddEventHandler('mkira', function() -- buraya ifin içindeki kod satırı end)
Bu şekilde sorunun çözüleceğini düşünüyorum.
Forumdan daha fazla yararlanmak için giriş yapın veya kayıt olun!