[?]Button'a setTimer Nasıl Eklerim.

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı mR.PuFF

  • Happy Gaming
  • Yeni Üye
  • *
    • İleti: 60
: 18 Nisan 2020, 12:08:56
Ben Butonuma setTimer Eklemek İstiyorum Ve Sadece 1 Kere Basma Hakkı Olacak (HESAP ÜZERİNDEN).


Kod
button = guiCreateButton(125, 252, 251, 222,"Buttonum",  true)

Nasıl setTimer Eklerim ?
Nasıl Tek Basımlık Yaparım ?
 


MTASATURK

[?]Button'a setTimer Nasıl Eklerim.
« : 18 Nisan 2020, 12:08:56 »

Çevrimdışı wicky

  • hasssssssikome
  • Acemi Üye
  • *
    • İleti: 170
Yanıtla #1 : 18 Nisan 2020, 14:53:44
setElementData() kullanabilirsin

örn;
Kod
myFuckingButton = guiCreateButton(0,0,0,0,"click lan click",false)

function myFuckingFunction()
    if not (getElementData(source,"clikced") then
        setElementData(myFuckingFunction,"clicked",true)
        setTimer(outputChatBox,1000,1,"fako beri bak beri")
   end
end

addEventHandler("onClientGUIClick",myFuckingButton,myFuckingFunction)
« Son Düzenleme: 19 Nisan 2020, 04:01:21 Gönderen: wicky »
 


Çevrimdışı Murcielago.MTA

  • Yeni Üye
  • *
    • İleti: 16
Yanıtla #2 : 18 Nisan 2020, 17:11:25
Kod: client.lua
local kullanimhakki;
local timerbutton;
local surekontrol;
local sureolustur;
local mesaj;
local zaman;
local tekrar;
local serverSideEvent;
local clienteventfunc;
sureolustur = setTimer;
surekontrol = isTimer;
mesaj = outputChatBox;
zaman = 1 * 500
tekrar = 1
kullanimhakki = 1;
timerbutton = function()
if ( source == button and not surekontrol(zamanlayici) and kullanimhakki == 1 and tonumber(zaman)) then
setTimer(function()
kullanimhakki = 0;
mesaj(
"Kullanım hakkınız dolmuştur",
255,0,0,
true)
serverSideEvent(
getLocalPlayer(),
getLocalPlayer(),
kullanimhakki
)
end,
zaman,
tekrar)
end end
addEventHandler("onClientGUIClick",root,timerbutton)

serverSideEvent = function(element,element2,element3)
triggerServerEvent(
"kullanimhakki_kullanici",
 element, element2,element3
 )
end
clienteventfunc = function(element)
kullanimhakki = tonumber(element)
end
addEvent("kullanimhakki_kullanici_client",true)
addEventHandler("kullanimhakki_kullanici_client",root,clienteventfunc)


Kod: server.lua
local kullanimhaki_user;
local kullanimhaki_user_log;
local uyelik;
local veri_adi;
local kkdata;
local clientSideEvent;
veri_adi = "kalanhakki"
kullanimhaki_user = function(element,element2)
if ( element ) then
uyelik = getPlayerAccount(element)
setAccountData(uyelik,veri_adi,
 element2
 )
 print("kullanıcı kullanım hakkı kayıt edildi.")
end
end
addEvent("kullanimhakki_kullanici",true)
addEventHandler("kullanimhakki_kullanici",root,kullanimhaki_user)

kullanimhaki_user_log = function(element,element2)
uyelik = getAccountName ( element2 )
if ( uyelik ) then
kkdata = getAccountData(element2,
veri_adi
)
clientSideEvent(
source,
kkdata or 0
)
print("kullanıcı kullanım hakkı yüklendi.")
end end
addEventHandler("onPlayerLogin",root,kullanimhaki_user_log)


clientSideEvent = function(element,element2)
triggerClientEvent(
element,
"kullanimhakki_kullanici_client",
 element, element2
 )
end
Kогда видите счастливых людeй – не завидуйте. Вы нe знаете, как oни боpолись за своё счaстье.