[YARDIM] Hapis Panel

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı furkan58123

  • Yeni Üye
  • *
    • İleti: 27
: 02 Nisan 2019, 15:26:39
Beyler ByCash'ın hapis panelinde hapse attığım adamın o yerde hareket edebilmesini istiyorum nasıl yapabilirim.
Linki görebilmek için Kayıt olun yada Giriş yapın.

Kod
--//Genel ayarları ayarlıyabileceğiniz kısım.
ayarlar = {

 acl = "Polis",--//Hangi ACL grubunun paneli açabileceğini ayarlıyabileceğiniz kısım.
 komut = "hapis", --//Panelin açma komutunu ayarlıyabileceğiniz kısım.
 
 g_karakter = 206, --//Hapise atılınca verilecek karakteri ayarlıyabileceğiniz kısım.
 c_karakter = 0, --//Hapisten çıkınca verilecek karakteri ayarlıyabileceğiniz kısım.

--//Hapise atılınca gidilecek kordinatları ayarlıyabileceğiniz kısım.
 giris_kordinatlari = {

 {243.4, 3172.6, 2.1},
 {244.1, 3186.5, 2.1},

 },
 
--//Hapisten çıkınca gidilecek kordinatlları ayarlıyabileceğiniz kısım.
 cikis_kordinatlari = {

 {266.2, 3164.5, 3.1},
 {263.2, 3190.1, 2.6},

 },

}

--//Mesaj ayarlarını ayarlıyabileceğiniz kısım.
chatbox = {

 hata_mesaj1 = "Bu oyuncu zaten hapiste!", --//Hata mesajı 1 düzenleyebileceğiniz kısım.
 hata_mesaj2 = "Bu oyuncu hapiste değil.", --//Hata mesajı 2 düzenleyebileceğiniz kısım.
 hata_mesaj3 = "Paneli açmak için gerekli yetkiye sahip değilsin.", --//Hata mesajı 3 düzenleyebileceğiniz kısım.
 hata_mesaj4 = "Lütfen bir sebep giriniz.", --//Hata mesajı 4 düzenleyebileceğiniz kısım.

 bilgi_mesaj1 = "Hapise atıldınız. Sebep: #666666", --//Bilgi mesajı 1 düzenleyebileceğiniz kısım.
 bilgi_mesaj2 = "Süre doldu! hapisten çıktın.", --//Bilgi mesajı 2 düzenleyebileceğiniz kısım.

}

Kod
--//Hapis Panel
x = (terimler.ekran[1]/2-panel.yatay/2)
y = (terimler.ekran[2]/2-panel.dikey/2)
sure_x = (terimler.ekran[1]/2-panel.sure_yatay/2)
sure_y = (terimler.ekran[2]/2-panel.sure_dikey/2)

hapis_panel = guiCreateStaticImage(x, y, panel.yatay, panel.dikey, terimler.renk, false)
guiSetProperty(hapis_panel, "ImageColours", panel.panel_renk)
guiSetVisible(hapis_panel, false)

--//Süre Butonu
sure_buton = guiCreateStaticImage(sure_x, sure_y-250, panel.sure_yatay, panel.sure_dikey, terimler.renk, false)
guiSetProperty(sure_buton, "ImageColours", panel.panel_renk)
guiSetVisible(sure_buton, false)
guiSetAlpha(sure_buton, 0.7)

sure_label = guiCreateLabel(0, -15, panel.sure_yatay, panel.sure_dikey, "", false, sure_buton)
guiLabelSetHorizontalAlign(sure_label, "center")
guiLabelSetVerticalAlign(sure_label, "bottom")
guiSetFont(sure_label, terimler.font)

function sure_goster()
local sure = tostring(getElementData(source, "HapisSure"))
guiSetVisible(sure_buton, true)
guiSetText(sure_label, "Kalan Süre: "..sure.." Saniye")
end
addEvent("SureGoster", true, sure_goster)
addEventHandler("SureGoster", terimler.oyuncu, sure_goster)

function sure_gizle()
guiSetText(sure_label, "Kalan Süre: 0 Saniye")
setTimer(guiSetText, 1000, 1, sure_label, "Süre Doldu!")
setTimer(guiSetVisible, 3000, 1, sure_buton, false)
end
addEvent("SureGizle", true, sure_gizle)
addEventHandler("SureGizle", terimler.oyuncu, sure_gizle)

function sure_kaldir()
guiSetText(sure_label, "Hapisten Çıkartıldınız!")
setTimer(guiSetVisible, 2000, 1, sure_buton, false)
end
addEvent("SureKaldir", true, sure_kaldir)
addEventHandler("SureKaldir", terimler.oyuncu, sure_kaldir)

--//Başlıklar
panel_baslik = guiCreateStaticImage(0, 0, panel.yatay, 35, terimler.renk, false, hapis_panel)
guiSetProperty(panel_baslik, "ImageColours", panel.baslik_renk)

baslik_label = guiCreateLabel(0, -10, panel.yatay, 35, panel.paneladi, false, panel_baslik)
guiLabelSetHorizontalAlign(baslik_label, "center")
guiLabelSetVerticalAlign(baslik_label, "bottom")
guiSetFont(baslik_label, terimler.font)

bilgi_baslik = guiCreateStaticImage(0, panel.dikey-20, panel.yatay, 20, terimler.buton, false, hapis_panel)

bilgibaslik_label = guiCreateLabel(0, -5, panel.yatay, 20, "Hapis Sistemi V1 © ByCash - "..panel.sunucuadi.." 2018", false, bilgi_baslik)
guiLabelSetHorizontalAlign(bilgibaslik_label, "center")
guiLabelSetVerticalAlign(bilgibaslik_label, "bottom")
guiSetFont(bilgibaslik_label, terimler.font)

--//Kapat Butonu
kapat_buton = guiCreateStaticImage(panel.yatay-50, 0, 50, 35, terimler.renk, false, panel_baslik)
guiSetProperty(kapat_buton, "ImageColours", panel.diger_buton_renk)

kapat_label = guiCreateLabel(0, -12, 50, 35, "X", false, kapat_buton)
guiLabelSetHorizontalAlign(kapat_label, "center")
guiLabelSetVerticalAlign(kapat_label, "bottom")
guiSetFont(kapat_label, terimler.font)

--//GridList 1
bilgi1 = guiCreateStaticImage(30, 50, 182, 25, terimler.buton, false, hapis_panel)
bilgi1_label = guiCreateLabel(0, 5, 182, 30, "Oyuncu Listesi", false, bilgi1)
guiLabelSetHorizontalAlign(bilgi1_label, "center")
guiSetFont(bilgi1_label, terimler.font)

gizle1 = guiCreateStaticImage(30, 80, 182, panel.dikey-115, terimler.buton, false, hapis_panel)
grid1 = guiCreateGridList(0-10, 0-25, 182+20, panel.dikey-115+50, false, gizle1)
guiGridListAddColumn(grid1, "Oyuncu Listesi", 0.9)

--//Tutuklanma Sebebi
bilgi2 = guiCreateStaticImage(232, 50, 182, 25, terimler.buton, false, hapis_panel)
bilgi2_label = guiCreateLabel(0, 5, 182, 30, "Tutuklanma Sebebi", false, bilgi2)
guiLabelSetHorizontalAlign(bilgi2_label, "center")
guiSetFont(bilgi2_label, terimler.font)

edit_gizle1 = guiCreateStaticImage(232, 80, 182, 30, terimler.buton, false, hapis_panel)
sebep_edit = guiCreateEdit(0-7, 0-20, 195, 65, "Bir sebep giriniz.", false, edit_gizle1)
guiEditSetMaxLength(sebep_edit, ayarlar.sebep_limit)

addEventHandler("onClientGUIClick", getRootElement(),
function()
if source == sebep_edit then
guiSetText(sebep_edit, "")
end
end)

edit1_resim = guiCreateStaticImage(0, 0, 195, 65, terimler.renk, false, sebep_edit)
guiSetProperty(edit1_resim, "ImageColours", panel.panel_renk)
guiSetEnabled(edit1_resim, false)
guiSetAlpha(edit1_resim, 0.7)
--//GridList 3

bilgi3 = guiCreateStaticImage(232, 125, 182, 25, terimler.buton, false, hapis_panel)
bilgi3_label = guiCreateLabel(0, 5, 182, 30, "Süre Listesi | Dakika", false, bilgi3)
guiLabelSetHorizontalAlign(bilgi3_label, "center")
guiSetFont(bilgi3_label, terimler.font)

gizle3 = guiCreateStaticImage(232, 155, 182, panel.dikey-115-170+35, terimler.buton, false, hapis_panel)
grid3 = guiCreateGridList(0-10, 0-25, 182+20, panel.dikey-115+50-170+35, false, gizle3)
guiGridListAddColumn(grid3, "Süre", 0.5)

--//Buton 1
buton1 = guiCreateStaticImage(232, 310, 182, 25, terimler.renk, false, hapis_panel)
buton1_label = guiCreateLabel(0, 5, 182, 30, "Hapse At", false, buton1)
guiSetProperty(buton1, "ImageColours", panel.diger_buton_renk)
guiLabelSetHorizontalAlign(buton1_label, "center")
guiSetFont(buton1_label, terimler.font)

--//Buton 2
buton2 = guiCreateStaticImage(232, 340, 182, 25, terimler.renk, false, hapis_panel)
buton2_label = guiCreateLabel(0, 5, 182, 30, "Hapisten Çıkart", false, buton2)
guiSetProperty(buton2, "ImageColours", panel.diger_buton_renk)
guiLabelSetHorizontalAlign(buton2_label, "center")
guiSetFont(buton2_label, terimler.font)

--//Fonksiyonlar
function oyuncu_listesi()
guiGridListClear(grid1)
for _,player in ipairs(getElementsByType("player")) do
row1 = guiGridListAddRow(grid1)
if player then
guiGridListSetItemText(grid1,row1,1,(string.gsub (getPlayerName(player), "#%x%x%x%x%x%x", "")), false, false)
guiGridListSetItemData(grid1,row1,1, getPlayerName(player))
end
end
end

for _,sure in pairs (ayarlar.sureler) do
local row = guiGridListAddRow(grid3)
guiGridListSetItemText(grid3, row, 1, sure[1], false, false)
guiGridListSetSortingEnabled(grid3, false)
end

function hapse_at()
if source == buton1_label then
local oyuncu = getPlayerFromName(guiGridListGetItemData(grid1, guiGridListGetSelectedItem(grid1), 1))
if oyuncu then
local sure = guiGridListGetItemText(grid3, guiGridListGetSelectedItem(grid3), 1)
local sebep = guiGetText(sebep_edit)
if sebep == "Bir sebep giriniz." then
triggerServerEvent("mesaj1", terimler.oyuncu)
else
triggerServerEvent("at_event", oyuncu, oyuncu, sure, sebep, getLocalPlayer())
end
end
end
end
addEventHandler("onClientGUIClick", getRootElement(), hapse_at)

function hapisten_cikar()
if source == buton2_label then
local oyuncu = getPlayerFromName(guiGridListGetItemData(grid1, guiGridListGetSelectedItem(grid1), 1))
if oyuncu then
triggerServerEvent("cikar_event", oyuncu, oyuncu)
end
end
end
addEventHandler("onClientGUIClick", getRootElement(), hapisten_cikar)

--//Maus Efekti
addEventHandler ("onClientMouseEnter", root,
function()
if source == baslik_label then
guiSetAlpha(panel_baslik, 0.5)
elseif source == bilgibaslik_label then
guiSetAlpha(bilgi_baslik, 0.5)
elseif source == buton1_label then
guiSetAlpha(buton1, 0.5)
elseif source == buton2_label then
guiSetAlpha(buton2, 0.5)
elseif source == kapat_label then
guiSetAlpha(kapat_buton, 0.5)
end
end)

addEventHandler ("onClientMouseLeave", root,
function()
if source == baslik_label then
guiSetAlpha(panel_baslik, 1)
elseif source == bilgibaslik_label then
guiSetAlpha(bilgi_baslik, 1)
elseif source == buton1_label then
guiSetAlpha(buton1, 1)
elseif source == buton2_label then
guiSetAlpha(buton2, 1)
elseif source == kapat_label then
guiSetAlpha(kapat_buton, 1)
end
end)

--//Açma Kapatma Fonksiyonu
function panel_ac()
if (guiGetVisible (hapis_panel) == true) then
guiSetVisible(hapis_panel, false)
guiSetInputEnabled(false)
showCursor(false)
elseif (guiGetVisible (hapis_panel) == false) then
guiSetVisible(hapis_panel, true)
guiSetInputEnabled(true)
showCursor(true)
oyuncu_listesi()
end
end
addEvent("panel_ac", true)
addEventHandler("panel_ac", terimler.oyuncu, panel_ac)

addEventHandler("onClientGUIClick", getRootElement(),
function()
if source == kapat_label then
guiSetVisible(hapis_panel, false)
guiSetInputEnabled(false)
showCursor(false)
end
end)

--//Kontrol Fonksiyonu
function kontrol_kapat()
toggleAllControls(false)
end
addEvent("kontrol_kapat", true)
addEventHandler("kontrol_kapat", getLocalPlayer(), kontrol_kapat)

function kontrol_ac()
toggleAllControls(true)
end
addEvent("kontrol_ac", true)
addEventHandler("kontrol_ac", getLocalPlayer(), kontrol_ac)

--//Karakter Kaplaması
local txd = engineLoadTXD("Dosyalar/karakter/mahkum.txd")
engineImportTXD(txd, ayarlar.karakter)
local dff = engineLoadDFF("Dosyalar/karakter/mahkum.dff")
engineReplaceModel(dff, ayarlar.karakter)

Kod
--//Panel Açma/Kapatma Fonksiyonu
function panel_ac(oyuncu)
hesap = getAccountName(getPlayerAccount(oyuncu))
if isObjectInACLGroup("user."..hesap, aclGetGroup(ayarlar.acl)) then
triggerClientEvent("panel_ac", oyuncu)
else
outputChatBox(chatbox.hata_mesaj3, oyuncu, 10, 10, 10, true)
end
end
addCommandHandler(ayarlar.komut, panel_ac)

function mesaj1()
outputChatBox(chatbox.hata_mesaj4, source, 70, 70, 70, true)
end
addEvent("mesaj1", true)
addEventHandler("mesaj1", getRootElement(), mesaj1)

--//Fonksiyonlar
local random1 = math.random(#ayarlar.giris_kordinatlari)
local random2 = math.random(#ayarlar.cikis_kordinatlari)

function arac_kaldir(oyuncu)
local arac = getPedOccupiedVehicle(oyuncu)
if arac then
destroyElement(arac)
end
end

sureler = {}
timer = {}
function hapis(oyuncu, sure, sebep, diger)
local hesap = getPlayerAccount(oyuncu)
if isTimer(timer[oyuncu]) then
outputChatBox(chatbox.hata_mesaj1, source, 70, 70, 70, true)
else
sureler[oyuncu] = sureler[oyuncu] or tonumber(sure*60)
timer[oyuncu] = setTimer(function(oyuncu)
sureler[oyuncu] = tonumber(sureler[oyuncu])-1
if sureler[oyuncu] <= 0 then -- eğer süre 0 dan küçükse
if isTimer(timer[oyuncu]) then killTimer(timer[oyuncu]) end
setElementPosition(oyuncu, unpack(ayarlar.cikis_kordinatlari[random2]))
triggerClientEvent(oyuncu, "SureGizle", oyuncu)
removeElementData(oyuncu, "HapisSure")
outputChatBox(chatbox.bilgi_mesaj2, oyuncu, 70, 70, 70, true)
timer[oyuncu] = nil
sureler[oyuncu] = nil
setAccountData(hesap, "HapisSure", "Yok")
setElementModel(oyuncu, ayarlar.c_karakter)
triggerClientEvent(oyuncu, "kontrol_ac", oyuncu)
else -- 0dan büyükse
arac_kaldir(oyuncu)
setAccountData(hesap, "HapisSure", sureler[source])
setElementData(oyuncu, "HapisSure", sureler[oyuncu])
setElementPosition(oyuncu, unpack(ayarlar.giris_kordinatlari[random1]))
triggerClientEvent(oyuncu, "SureGoster", oyuncu)
setElementModel(oyuncu, ayarlar.g_karakter)
triggerClientEvent(oyuncu, "kontrol_kapat", oyuncu)
end
end, 1000, 0, oyuncu)
if sebep and diger then -- oyuncu hapisteyken oyundan çıkıp girdiğinde tekrar hapise atıldığında sebep ve diger olmuyor  o yüzden if koyduk
outputChatBox(chatbox.bilgi_mesaj1.."["..getPlayerName(diger)..": "..sebep.."]", oyuncu, 10, 10, 10, true)
end
end
end
addEvent("at_event", true, hapis)
addEventHandler("at_event", getRootElement(), hapis)

function hapis_cikar(oyuncu, local_oyuncu)
if getElementData(oyuncu, "HapisSure") then
local hesap = getPlayerAccount(oyuncu)
if isTimer(timer[oyuncu]) then killTimer(timer[oyuncu]) end
timer[oyuncu] = nil
sureler[oyuncu] = nil
removeElementData(oyuncu, "HapisSure")
setElementPosition(oyuncu, unpack(ayarlar.cikis_kordinatlari[random2]))
triggerClientEvent(oyuncu, "SureKaldir", oyuncu)
setAccountData(hesap, "HapisSure", "Yok")
setElementModel(oyuncu, ayarlar.c_karakter)
triggerClientEvent(oyuncu, "kontrol_ac", oyuncu)
else
outputChatBox(chatbox.hata_mesaj2, local_oyuncu, 70, 70, 70, true)
end
end
addEvent("cikar_event", true, hapis_cikar)
addEventHandler("cikar_event", getRootElement(), hapis_cikar)

addEventHandler("onPlayerQuit", getRootElement(), function()
local hesap = getPlayerAccount(source)
if isTimer(timer[source]) then
setAccountData(hesap, "HapisSure", sureler[source])
if isTimer(timer[source]) then killTimer(timer[source]) end
end 
end)

addEventHandler("onPlayerLogin", getRootElement(), function(_,hesap)
local hapisveri = getAccountData(hesap, "HapisSure")
if hapisveri ~= "Yok" then
sureler[source] = tonumber(hapisveri)
hapis(source)
end
end)

Mesaj Birleştirildi: [time]03 Nisan 2019, 20:01:37[/time]
çözen varmı beyler ?

Mesaj Birleştirildi: [time]03 Nisan 2019, 20:24:26[/time]
adamı hareket ettirebiliyorum ama bi kaç adım atınca tekrar aynı yere dönüyor.
« Son Düzenleme: 11 Nisan 2019, 08:11:04 Gönderen: Narkoz »
Linki görebilmek için Kayıt olun yada Giriş yapın.
 


MTASATURK

[YARDIM] Hapis Panel
« : 02 Nisan 2019, 15:26:39 »