Jump to content

GUI Panel problem


Recommended Posts

9 hours ago, xMKHx said:

Hello, can you please post your code.

 

local kiralamaPed = createPed(120, 354.3173828125, -1812.6943359375, 4.4333090782166)
setElementData(kiralamaPed, "name", "[ARAC KIRALAMA]")
setElementData(kiralamaPed, "talk", 1)
setElementFrozen(kiralamaPed, true)

function centerWindow(center_window)
    local screenW,screenH=guiGetScreenSize()
    local windowW,windowH=guiGetSize(center_window,false)
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2
    guiSetPosition(center_window,x,y,false)
end

local lp = getLocalPlayer()


Cartogo = {
    gridlist = {},
    window = {},
    button = {},
    label = {}
}

Cartogo.window[1] = guiCreateWindow(407, 250, 550, 243, "Araç Kiralama", false)
guiWindowSetSizable(Cartogo.window[1], false)
centerWindow(Cartogo.window[1])

Cartogo.button[1] = guiCreateButton(443, 169, 97, 25, "Kirala", false, Cartogo.window[1])
guiSetProperty(Cartogo.button[1], "NormalTextColour", "FFAAAAAA")
Cartogo.button[2] = guiCreateButton(443, 200, 97, 25, "Kapat", false, Cartogo.window[1])
guiSetProperty(Cartogo.button[2], "NormalTextColour", "FFAAAAAA")
Cartogo.gridlist[1] = guiCreateGridList(9, 23, 531, 141, false, Cartogo.window[1])

local column1 = guiGridListAddColumn(Cartogo.gridlist[1], "Araç", 0.5)
local column2 = guiGridListAddColumn(Cartogo.gridlist[1], "Fiyat", 0.3)
local column3 = guiGridListAddColumn(Cartogo.gridlist[1], "Durumu", 0.3)

local index1 = guiGridListAddRow(Cartogo.gridlist[1])
local index2 = guiGridListAddRow(Cartogo.gridlist[1])
local index3 = guiGridListAddRow(Cartogo.gridlist[1])
local index4 = guiGridListAddRow(Cartogo.gridlist[1])
local index5 = guiGridListAddRow(Cartogo.gridlist[1])
local index6 = guiGridListAddRow(Cartogo.gridlist[1])
local index7 = guiGridListAddRow(Cartogo.gridlist[1])

guiGridListSetItemText(Cartogo.gridlist[1], index1, column1, "Bisiklet", false, false)
guiGridListSetItemText(Cartogo.gridlist[1], index1, column2, "15TL", false, false)
guiGridListSetItemText(Cartogo.gridlist[1], index1, column3, "Müsait", true, false)
guiGridListSetItemText(Cartogo.gridlist[1], index2, column1, "Scooter", false, false)
guiGridListSetItemText(Cartogo.gridlist[1], index2, column2, "50TL", false, false)
guiGridListSetItemText(Cartogo.gridlist[1], index2, column3, "Müsait", true, false)
guiGridListSetItemText(Cartogo.gridlist[1], index3, column1, "Renault Clio", false, false)
guiGridListSetItemText(Cartogo.gridlist[1], index3, column2, "250TL", false, false)
guiGridListSetItemText(Cartogo.gridlist[1], index3, column3, "Müsait", true, false)
guiGridListSetItemText(Cartogo.gridlist[1], index4, column1, "Scania S730 [Meslek Aracı]", false, false)
guiGridListSetItemText(Cartogo.gridlist[1], index4, column2, "750TL", false, false)
guiGridListSetItemText(Cartogo.gridlist[1], index4, column3, "Müsait", true, false)

Cartogo.label[1] = guiCreateLabel(8, 172, 425, 61, "Araç Kiralamaya Hoşgeldiniz!\nKullanımdaki araçları kiralayamazsınız.\nKiraladýðýnýz Araç Siz Terkedince Araç Kiralamaya Geri Döner.", false, Cartogo.window[1])
guiLabelSetColor(Cartogo.label[1], 176, 187, 4)
guiLabelSetHorizontalAlign(Cartogo.label[1], "center", false)

guiSetVisible(Cartogo.window[1], false)

local flash_fiyat = 15
local premier_fiyat = 50
local tampa_fiyat = 250
local bobcat_fiyat = 750

local flash_kullanim = false
local premier_kullanim = false
local tampa_kullanim = false
local bobcat_kullanim = false

addEventHandler("onClientGUIClick", Cartogo.button[2], function(button)

	if button == "left" then
		guiSetVisible(Cartogo.window[1], false)
		showCursor(false)
	end
end, false)

addEvent("kiralamaGoster", true)
addEventHandler("kiralamaGoster", getLocalPlayer(), 
	function()
		if (not getElementData(getLocalPlayer(), "kiralanmis")) then
			triggerServerEvent("sendLocalText", getLocalPlayer(), getLocalPlayer(), "[-] Hoşgeldiniz bayım, size nasıl yardımcı olabilirim?", 255, 255, 255, 10, {}, true)
			guiSetVisible(Cartogo.window[1], true)
			showCursor(true)
		else
			triggerServerEvent("sendLocalText", getLocalPlayer(), getLocalPlayer(), "[-] Üzgünüm, zaten bir araç kiraladınız. Aynı anda birden fazla araç kiralayamazsınız.", 255, 255, 255, 10, {}, true)
		end	
	end
)

addEventHandler("onClientGUIClick", Cartogo.button[1], function(button)
	local screenW, screenH = guiGetScreenSize()
	saatlikPencere = guiCreateWindow((screenW - 301) / 2, (screenH - 166) / 2, 301, 166, "Araç Kiralama", false)
	guiWindowSetSizable(saatlikPencere, false)

	birsaatbuton = guiCreateButton(17, 32, 128, 51, "1 Saat", false, saatlikPencere)
	ikisaatbuton = guiCreateButton(155, 32, 128, 51, "2 Saat", false, saatlikPencere)
	ucsaatbuton = guiCreateButton(17, 93, 128, 51, "3 Saat", false, saatlikPencere)
	dortsaatbuton = guiCreateButton(155, 93, 128, 51, "4 Saat", false, saatlikPencere)

	local x, y, z = 0, 0, 0
	local rz = 0
	local int = 0
	local rnd_park = math.random(1, 5)

	if rnd_park == 1 then
		x, y, z = 350.29998779297, -1809.5, 4.4000000953674
	elseif rnd_park == 2 then
		x, y, z = 343.89999389648, -1809.6999511719, 4.4000000953674
	elseif rnd_park == 3 then
		x, y, z = 337.29998779297, -1809.8000488281, 4.5
	elseif rnd_park == 4 then
		x, y, z = 330.89999389648, -1809.8000488281, 4.5
	elseif rnd_park == 5 then
		x, y, z = 324.39999389648, -1809.5999755859, 4.5
	end

	if button == "left" then
		guiSetVisible(Cartogo.window[1], false)
		showCursor(false)
		if (guiGridListGetSelectedItem(Cartogo.gridlist[1]) == index1) and flash_kullanim == false then
			guiSetText(birsaatbuton, "1 Saat\n $" .. tostring(flash_fiyat))
			guiSetText(ikisaatbuton, "2 Saat\n $" .. tostring(flash_fiyat*2))
			guiSetText(ucsaatbuton, "3 Saat\n $" .. tostring(flash_fiyat*3))
			guiSetText(dortsaatbuton, "4 Saat\n $" .. tostring(flash_fiyat*4))
		if button == "left" then--
			addEventHandler("onClientGUIClick", birsaatbuton, 
				function()			
					triggerServerEvent("flashOlustur", lp, lp, x, y, z, rz, int, 3600000)
					setGridList("bmx", "Kullanımda", "evet")
					flash_kullanim = true
					guiSetVisible(saatlikPencere, false)
				end
			)
		elseif button == "left" then
			addEventHandler("onClientGUIClick", ikisaatbuton, 
				function()			
					triggerServerEvent("flashOlustur", lp, lp, x, y, z, rz, int, 7200000)
					setGridList("bmx", "Kullanımda", "evet")
					flash_kullanim = true
					guiSetVisible(saatlikPencere, false)
				end
			)
		elseif button == "left" then
			addEventHandler("onClientGUIClick", ucsaatbuton, 
				function()			
					triggerServerEvent("flashOlustur", lp, lp, x, y, z, rz, int, 10800000)
					setGridList("bmx", "Kullanımda", "evet")
					flash_kullanim = true
					guiSetVisible(saatlikPencere, false)
				end
			)
		elseif button == "left" then
			addEventHandler("onClientGUIClick", dortsaatbuton, 
				function()			
					triggerServerEvent("flashOlustur", lp, lp, x, y, z, rz, int, 14400000)
					setGridList("bmx", "Kullanımda", "evet")
					flash_kullanim = true
					guiSetVisible(saatlikPencere, false)
				end
			)
		end--
			guiSetVisible(Cartogo.window[1], false)
		elseif (guiGridListGetSelectedItem(Cartogo.gridlist[1]) == index2) and premier_kullanim == false then
			guiSetText(birsaatbuton, "1 Saat\n $" .. tostring(premier_fiyat))
			guiSetText(ikisaatbuton, "2 Saat\n $" .. tostring(premier_fiyat*2))
			guiSetText(ucsaatbuton, "3 Saat\n $" .. tostring(premier_fiyat*3))
			guiSetText(dortsaatbuton, "4 Saat\n $" .. tostring(premier_fiyat*4))
			addEventHandler("onClientGUIClick", birsaatbuton, 
				function()			
					triggerServerEvent("premierOlustur", lp, lp, x, y, z, rz, int, 3600000)
					setGridList("faggio", "Kullanımda", "evet")
					premier_kullanim = false --true oj
					guiSetVisible(saatlikPencere, false)
				end
			)
			addEventHandler("onClientGUIClick", ikisaatbuton, 
				function()			
					triggerServerEvent("premierOlustur", lp, lp, x, y, z, rz, int, 7200000)
					setGridList("faggio", "Kullanımda", "evet")
					premier_kullanim = false --true oj
					guiSetVisible(saatlikPencere, false)
				end
			)
			addEventHandler("onClientGUIClick", ucsaatbuton, 
				function()			
					triggerServerEvent("premierOlustur", lp, lp, x, y, z, rz, int, 10800000)
					setGridList("faggio", "Kullanımda", "evet")
					premier_kullanim = false --true oj
					guiSetVisible(saatlikPencere, false)
				end
			)
			addEventHandler("onClientGUIClick", dortsaatbuton, 
				function()			
					triggerServerEvent("premierOlustur", lp, lp, x, y, z, rz, int, 14400000)
					setGridList("faggio", "Kullanımda", "evet")
					premier_kullanim = false --true oj
					guiSetVisible(saatlikPencere, false)
				end
			)
			guiSetVisible(Cartogo.window[1], false)
		elseif (guiGridListGetSelectedItem(Cartogo.gridlist[1]) == index3) and tampa_kullanim == false then
			guiSetText(birsaatbuton, "1 Saat\n $" .. tostring(tampa_fiyat))
			guiSetText(ikisaatbuton, "2 Saat\n $" .. tostring(tampa_fiyat*2))
			guiSetText(ucsaatbuton, "3 Saat\n $" .. tostring(tampa_fiyat*3))
			guiSetText(dortsaatbuton, "4 Saat\n $" .. tostring(tampa_fiyat*4))
			addEventHandler("onClientGUIClick", birsaatbuton, 
				function()			
					triggerServerEvent("tampaOlustur", lp, lp, x, y, z, rz, int, 60000)--3600000
					setGridList("banshee", "Kullanımda", "evet")
					tampa_kullanim = false
					guiSetVisible(saatlikPencere, false)
				end
			)
			addEventHandler("onClientGUIClick", ikisaatbuton, 
				function()			
					triggerServerEvent("tampaOlustur", lp, lp, x, y, z, rz, int, 7200000)
					setGridList("banshee", "Kullanımda", "evet")
					tampa_kullanim = false
					guiSetVisible(saatlikPencere, false)
				end
			)
			addEventHandler("onClientGUIClick", ucsaatbuton, 
				function()			
					triggerServerEvent("tampaOlustur", lp, lp, x, y, z, rz, int, 10800000)
					setGridList("banshee", "Kullanımda", "evet")
					tampa_kullanim = false
					guiSetVisible(saatlikPencere, false)
				end
			)
			addEventHandler("onClientGUIClick", dortsaatbuton, 
				function()			
					triggerServerEvent("tampaOlustur", lp, lp, x, y, z, rz, int, 14400000)
					setGridList("banshee", "Kullanımda", "evet")
					tampa_kullanim = false
					guiSetVisible(saatlikPencere, false)
				end
			)
			guiSetVisible(Cartogo.window[1], false)
		elseif (guiGridListGetSelectedItem(Cartogo.gridlist[1]) == index4) and bobcat_kullanim == false then
			guiSetText(birsaatbuton, "1 Saat\n $" .. tostring(bobcat_fiyat))
			guiSetText(ikisaatbuton, "2 Saat\n $" .. tostring(bobcat_fiyat*2))
			guiSetText(ucsaatbuton, "3 Saat\n $" .. tostring(bobcat_fiyat*3))
			guiSetText(dortsaatbuton, "4 Saat\n $" .. tostring(bobcat_fiyat*4))
			addEventHandler("onClientGUIClick", birsaatbuton, 
				function()			
					triggerServerEvent("bobcatOlustur", lp, lp, x, y, z, rz, int, 3600000)
					setGridList("roadtrain", "Kullanımda", "evet")
					bobcat_kullanim = true
					guiSetVisible(saatlikPencere, false)
				end
			)
			addEventHandler("onClientGUIClick", ikisaatbuton, 
				function()			
					triggerServerEvent("bobcatOlustur", lp, lp, x, y, z, rz, int, 7200000)
					setGridList("roadtrain", "Kullanımda", "evet")
					bobcat_kullanim = true
					guiSetVisible(saatlikPencere, false)
				end
			)
			addEventHandler("onClientGUIClick", ucsaatbuton, 
				function()			
					triggerServerEvent("bobcatOlustur", lp, lp, x, y, z, rz, int, 10800000)
					setGridList("roadtrain", "Kullanımda", "evet")
					bobcat_kullanim = true
					guiSetVisible(saatlikPencere, false)
				end
			)
			addEventHandler("onClientGUIClick", dortsaatbuton, 
				function()			
					triggerServerEvent("bobcatOlustur", lp, lp, x, y, z, rz, int, 14400000)
					setGridList("roadtrain", "Kullanımda", "evet")
					bobcat_kullanim = true
					guiSetVisible(saatlikPencere, false)
				end
			)
			guiSetVisible(Cartogo.window[1], false)
		else
			if flash_kullanim == true then
				triggerServerEvent("sendLocalText", getLocalPlayer(), getLocalPlayer(), " Üzgünüm ancak istediğiniz araç şu anda kullanımda.", 255, 255, 255, 10, {}, true)
				destroyElement(saatlikPencere)
			elseif premier_kullanim == true then
				triggerServerEvent("sendLocalText", getLocalPlayer(), getLocalPlayer(), " Üzgünüm ancak istediğiniz araç şu anda kullanımda.", 255, 255, 255, 10, {}, true)
				destroyElement(saatlikPencere)
			elseif tampa_kullanim == true then
				triggerServerEvent("sendLocalText", getLocalPlayer(), getLocalPlayer(), " Üzgünüm ancak istediğiniz araç şu anda kullanımda.", 255, 255, 255, 10, {}, true)
				destroyElement(saatlikPencere)
			elseif bobcat_kullanim == true then
				triggerServerEvent("sendLocalText", getLocalPlayer(), getLocalPlayer(), " Üzgünüm ancak istediğiniz araç şu anda kullanımda.", 255, 255, 255, 10, {}, true)
				destroyElement(saatlikPencere)
			end
		end
	end
end, false)

function setGridList(typ, text, state)
	local text = tostring(text)
	local state = tostring(state)

	if typ == "bmx" then --bisiklet
		guiGridListSetItemText(Cartogo.gridlist[1], index1, column3, text, true, false)
		if state == "hayır" then
			flash_kullanim = false
		else
			flash_kullanim = true
		end
	elseif typ == "faggio" then --sıkutur
		guiGridListSetItemText(Cartogo.gridlist[1], index2, column3, text, true, false)
		if state == "hayır" then
			premier_kullanim = false
		else
			premier_kullanim = true
		end
	elseif typ == "banshee" then --clio --orj tampa
		guiGridListSetItemText(Cartogo.gridlist[1], index3, column3, text, true, false)
		if state == "hayır" then
			tampa_kullanim = false
		else
			tampa_kullanim = true
		end
	elseif typ == "roadtrain" then --tır
		guiGridListSetItemText(Cartogo.gridlist[1], index4, column3, text, true, false)
		if state == "hayır" then
			bobcat_kullanim = false
		else
			bobcat_kullanim = true
		end
	end
end
addEvent("setGridList", true)
addEventHandler("setGridList", getRootElement(), setGridList)

 

Link to comment
1 hour ago, xMKHx said:

Post server side too

Quote
function setCarToGoGridlistRow (player, vehname, text, state)
local text = tostring(text)
local veh = tostring(vehname)
local state = tostring(state)

triggerClientEvent(getRootElement(), "setGridList", getRootElement(), veh, text, state)
end

function flashOlustur (player, x, y, z, rz, int, zaman)
	local vehShopData = exports["arp_vehicle_manager"]:getInfoFromVehShopID(1034)
	local gerekenPara = 15
	if zaman == 14400000 then
		gerekenPara = gerekenPara * 4
	elseif zaman == 10800000 then
		gerekenPara = gerekenPara * 3
	elseif zaman == 7200000 then
		gerekenPara = gerekenPara * 2
	elseif zaman == 3600000 then -- sıfır ekle
		gerekenPara = gerekenPara
	end
	
	if (exports.arp_global:hasMoney(player, gerekenPara)) then
		exports.arp_global:sendLocalText(source, " Aracınızı yan taraftan alabilirsiniz!", 255, 255, 255, 10, {}, true)
		exports.arp_global:takeMoney(player, gerekenPara)
		local x = tonumber(x)
		local y = tonumber(y)
		local z = tonumber(z)
		local rz = tonumber(rz)
		local int = tonumber(int)
		local veh = createVehicle(getVehicleModelFromName("BMX"), x, y, z, 0, 0, rz, "KIRALIK")
		
		setVehicleOverrideLights(veh, 1)
		setVehicleEngineState(veh, true)
		setVehicleFuelTankExplodable(veh, false)
		setVehicleVariant(veh, exports['arp_vehicle']:getRandomVariant(getElementModel(veh)))

		exports.arp_anticheat:changeProtectedElementDataEx(veh, "fuel", exports["arp_vehicle_fuel"]:getMaxFuel(veh), false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "plate", "KIRALIK", true)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "Impounded", 0)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "dbid", -getElementData(player, "dbid"), true)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "engine", 0, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "oldx", x, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "oldy", y, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "oldz", z, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "faction", -1)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "owner", getElementData(player, "dbid"), false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "job", 0, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "handbrake", 0, true)
		
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "brand", vehShopData.vehbrand, true)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "maximemodel", vehShopData.vehmodel, true)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "year", vehShopData.vehyear, true)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "vehicle_shop_id", vehShopData.id, true)
		
		exports.arp_global:giveItem(player, 3, -getElementData(player, "dbid"))
		setElementData(player, "kiralanmis", true)
		
		warpPedIntoVehicle(player, veh, 0)
		setTimer(function() 
			exports["arp_items"]:deleteAll(3, -getElementData(player, "dbid"))
			destroyElement(veh) 
			outputChatBox("Kiraladığınız Aracın Süresi Doldu Dükkana Geri Gönderildi!!", player, 255, 0, 0) 
			setElementData(player, "kiralanmis", false)
		end, zaman, 1)
		addEventHandler("onPlayerQuit", function() setElementData(source, "kiralanmis", false) 
		exports["arp_items"]:deleteAll(3, -getElementData(player, "dbid")) destroyElement(veh) end)
	else
		exports.arp_global:sendLocalText(player, " Üzgünüm efendim, yeterli paranız yok.", 255, 255, 255, 10, {}, true)
		setCarToGoGridlistRow(player, "bmx", "Müsait", "hayır")
	end
end
addEvent("flashOlustur", true)
addEventHandler("flashOlustur", getRootElement(), flashOlustur)

function premierOlustur (player, x, y, z, rz, int, zaman)
	local vehShopData = exports["arp_vehicle_manager"]:getInfoFromVehShopID(1037)
	local gerekenPara = 50
	if zaman == 14400000 then
		gerekenPara = gerekenPara * 4
	elseif zaman == 10800000 then
		gerekenPara = gerekenPara * 3
	elseif zaman == 7200000 then
		gerekenPara = gerekenPara * 2
	elseif zaman == 3600000 then
		gerekenPara = gerekenPara
	end
	
	if (exports.arp_global:hasMoney(player, gerekenPara)) then
		exports.arp_global:sendLocalText(source, " Aracınızı yan taraftan alabilirsiniz!", 255, 255, 255, 10, {}, true)
		exports.arp_global:takeMoney(player, gerekenPara)
		local x = tonumber(x)
		local y = tonumber(y)
		local z = tonumber(z)
		local rz = tonumber(rz)
		local int = tonumber(int)
		local veh = createVehicle(getVehicleModelFromName("Faggio"), x, y, z, 0, 0, rz, "KIRALIK")
		
		setVehicleOverrideLights(veh, 1)
		setVehicleEngineState(veh, true)
		setVehicleFuelTankExplodable(veh, false)
		setVehicleVariant(veh, exports['vehicle-system']:getRandomVariant(getElementModel(veh)))

		exports.arp_anticheat:changeProtectedElementDataEx(veh, "dbid", -getElementData(player, "dbid"), true)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "fuel", exports["arp_vehicle_fuel"]:getMaxFuel(veh), false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "plate", "KIRALIK", true)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "Impounded", 0)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "engine", 0, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "oldx", x, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "oldy", y, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "oldz", z, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "faction", -1)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "owner", getElementData(player, "dbid"), false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "job", 0, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "handbrake", 0, true)
		
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "brand", vehShopData.vehbrand, true)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "maximemodel", vehShopData.vehmodel, true)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "year", vehShopData.vehyear, true)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "vehicle_shop_id", vehShopData.id, true)
		
		exports.arp_global:giveItem(player, 3, -getElementData(player, "dbid"))
	
		setElementData(player, "kiralanmis", true)
		
		warpPedIntoVehicle(player, veh, 0)
		setTimer(function() 
			exports["arp_items"]:deleteAll(3, -getElementData(player, "dbid"))
			destroyElement(veh) 
			outputChatBox("Kiraladığınız Aracın Süresi Doldu Dükkana Geri Gönderildi!", player, 255, 0, 0) 
			setElementData(player, "kiralanmis", false)
		end, zaman, 1)
		addEventHandler("onPlayerQuit", function() setElementData(source, "kiralanmis", false)
		exports["arp_items"]:deleteAll(3, -getElementData(player, "dbid")) destroyElement(veh) end)
	else
		exports.arp_global:sendLocalText(source, " Üzgünüm efendim, yeterli paranız yok.", 255, 255, 255, 10, {}, true)
		setCarToGoGridlistRow(player, "faggio", "Müsait", "hayır")
	end
end
addEvent("premierOlustur", true)
addEventHandler("premierOlustur", getRootElement(), premierOlustur)

function tampaOlustur (player, x, y, z, rz, int, zaman)
	local vehShopData = exports["arp_vehicle_manager"]:getInfoFromVehShopID(1176)
	local gerekenPara = 250
	if zaman == 14400000 then
		gerekenPara = gerekenPara * 4
	elseif zaman == 10800000 then
		gerekenPara = gerekenPara * 3
	elseif zaman == 7200000 then
		gerekenPara = gerekenPara * 2
	elseif zaman == 3600000 then --3600000
		gerekenPara = gerekenPara
	end
	
	if (exports.arp_global:hasMoney(player, gerekenPara)) then
		exports.arp_global:sendLocalText(source, " Aracınızı yan taraftan alabilirsiniz!", 255, 255, 255, 10, {}, true)
		exports.arp_global:takeMoney(player, gerekenPara)
		local x = tonumber(x)
		local y = tonumber(y)
		local z = tonumber(z)
		local rz = tonumber(rz)
		local int = tonumber(int)
		local veh = createVehicle(getVehicleModelFromName("Banshee"), x, y, z, 0, 0, rz, "KIRALIK")
		
		setVehicleOverrideLights(veh, 1)
		setVehicleEngineState(veh, true)
		setVehicleFuelTankExplodable(veh, false)
		setVehicleVariant(veh, exports['arp_vehicle']:getRandomVariant(getElementModel(veh)))

		exports.arp_anticheat:changeProtectedElementDataEx(veh, "dbid", -getElementData(player, "dbid"), true)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "fuel", exports["arp_vehicle_fuel"]:getMaxFuel(veh), false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "plate", "KIRALIK", true)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "Impounded", 0)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "engine", 0, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "oldx", x, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "oldy", y, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "oldz", z, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "faction", -1)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "owner", getElementData(player, "dbid"), false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "job", 0, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "handbrake", 0, true)
		
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "brand", vehShopData.vehbrand, true)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "model", vehShopData.vehmodel, true) --maximemodel
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "year", vehShopData.vehyear, true)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "vehicle_shop_id", vehShopData.id, true)
		
		exports.arp_global:giveItem(player, 3, -getElementData(player, "dbid"))
		---exports["arp_items"]:giveItem(player, 1, 5)
		exports["discordbot"]:sendMessage("arackira"," DK")
		setElementData(player, "kiralanmis", true)
		warpPedIntoVehicle(player, veh, 0)

		setTimer(function() 
			exports["arp_items"]:deleteAll(3, -getElementData(player, "dbid"))
			destroyElement(veh) 
			outputChatBox("Kiraladığınız Aracın Süresi Doldu Dükkana Geri Gönderildi!!", player, 255, 0, 0) 
			setElementData(player, "kiralanmis", false)
			tampa_kullanim = false
		end, zaman, 1)
		addEventHandler("onPlayerQuit", function() setElementData(source, "kiralanmis", false) 
		exports["arp_items"]:deleteAll(3, -getElementData(player, "dbid")) destroyElement(veh) end)
	else
		exports.arp_global:sendLocalText(source, " Üzgünüm efendim, yeterli paranız yok.", 255, 255, 255, 10, {}, true)
		setCarToGoGridlistRow(player, "banshee", "Müsait", "hayır")
	end
end
addEvent("tampaOlustur", true)
addEventHandler("tampaOlustur", getRootElement(), tampaOlustur)

function bobcatOlustur (player, x, y, z, rz, int, zaman)
	local vehShopData = exports["arp_vehicle_manager"]:getInfoFromVehShopID(1031)
	local gerekenPara = 750
	if zaman == 14400000 then
		gerekenPara = gerekenPara * 4
	elseif zaman == 10800000 then
		gerekenPara = gerekenPara * 3
	elseif zaman == 7200000 then
		gerekenPara = gerekenPara * 2
	elseif zaman == 3600000 then
		gerekenPara = gerekenPara
	end
	
	if (exports.arp_global:hasMoney(player, gerekenPara)) then
		exports.arp_global:sendLocalText(source, " Aracınızı yan taraftan alabilirsiniz!", 255, 255, 255, 10, {}, true)
		exports.arp_global:takeMoney(player, gerekenPara)
		local x = tonumber(x)
		local y = tonumber(y)
		local z = tonumber(z)
		local rz = tonumber(rz)
		local int = tonumber(int)
		local veh = createVehicle(getVehicleModelFromName("Roadtrain"), x, y, z, 0, 0, rz, "KIRALIK")
		setVehicleOverrideLights(veh, 1)
		setVehicleEngineState(veh, true)
		setVehicleFuelTankExplodable(veh, false)
		setVehicleVariant(veh, exports['arp_vehicle']:getRandomVariant(getElementModel(veh)))

		exports.arp_anticheat:changeProtectedElementDataEx(veh, "dbid", -getElementData(player, "dbid"), true)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "fuel", exports["arp_vehicle_fuel"]:getMaxFuel(veh), false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "plate", "KIRALIK", true)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "Impounded", 0)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "engine", 0, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "oldx", x, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "oldy", y, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "oldz", z, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "faction", -1)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "owner", getElementData(player, "dbid"), false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "job", 0, false)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "handbrake", 0, true)
		
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "brand", vehShopData.vehbrand, true)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "maximemodel", vehShopData.vehmodel, true)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "year", vehShopData.vehyear, true)
		exports.arp_anticheat:changeProtectedElementDataEx(veh, "vehicle_shop_id", vehShopData.id, true)
		
		exports.arp_global:giveItem(player, 3, -getElementData(player, "dbid"))

		setElementData(player, "kiralanmis", true)
		
		warpPedIntoVehicle(player, veh, 0)
		setTimer(function() 
			exports["arp_items"]:deleteAll(3, -getElementData(player, "dbid"))
			destroyElement(veh) 
			outputChatBox("Kiraladığınız Aracın Süresi Doldu Dükkana Geri Gönderildi!", player, 255, 0, 0) 
			setElementData(player, "kiralanmis", false)
		end, zaman, 1)
		addEventHandler("onPlayerQuit", function() setElementData(source, "kiralanmis", false) 
		exports["arp_items"]:deleteAll(3, -getElementData(player, "dbid")) destroyElement(veh) end)
	else
		exports.arp_global:sendLocalText(source, " Üzgünüm efendim, yeterli paranız yok.", 255, 255, 255, 10, {}, true)
		setCarToGoGridlistRow(player, "roadtrain", "Müsait", "hayır")
	end
end
addEvent("bobcatOlustur", true)
addEventHandler("bobcatOlustur", getRootElement(), bobcatOlustur)


addCommandHandler("kira", function(thePlayer) setElementData(thePlayer, "kiralanmis", false) end)

 

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...