[Yardım] Fonksiyon

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı DrateX

  • Yeni Üye
  • *
    • İleti: 13
: 01 Kasım 2020, 19:23:24
Function'u kapattım ancak  "SCRIPT ERROR: maden\server.lua:40: 'end' expected (to close 'function' at line 8 ) near 'else' hatası alıyorum.
Kod
 alan = createColSphere(2277.51294, -761.58533, 130.81004, 1000)
tablo = {}
ekpara = 0
function meslek (plr,cmd,state)

    if isElementWithinColShape(plr,alan) then
        if not state then
           outputChatBox("Maden toplamak için :#FFFFFF /"..cmd.."<topla,sat>",plr,127,255,0,true)
        return end
        if not tablo[plr] then tablo[plr] = {} end
       
        if state == "topla" then
            if not isTimer(tablo[plr].zaman) then
               outputChatBox("Maden toplamaya başladın!",plr,0,0,255,true)       
              setPedAnimation(plr,"baseball","bat_4")
            tablo[plr].zaman = setTimer (function()
                setElementData(plr,"maden:sayi",(    getElementData(plr,"maden:sayi")or 0)+1)
                outputChatBox("Madeni topladın! Maden sayın:"  ..getElementData(plr,"maden:sayi"),plr,205,51,51,true)
            setPedAnimation(plr)
            end,10000,1)
            else 
             outputChatBox("Zaten maden topluyorsun!",plr,0,238,238,true)
            end
        end         
        elseif state == "sat" then
           if  (tonumber(getElementData(plr,"maden:sayi")) or 0 ) > 0 then
                    if tonumber(getElementData(plr,"maden:sayi")) > 10 then
                     ekpara = 30
                    end
                    outputChatBox("Madenleri sattın!",plr,255,185,15,true)
                else
                    outputChatBox("Maden satmak için maden toplaman gerek!",plr,255,127,36,true)
                end
            end
         
        else
        outputChatBox("Maden toplamak için :#FFFFFF /"..cmd.."<topla,sat>",plr,127,255,0,true)
        end
    else
       outputChatBox("Maden toplama alanında değilsiniz!",plr,255,0,0,true)
    return end
end
 
addCommandHandler("maden",meslek)
« Son Düzenleme: 01 Kasım 2020, 21:21:36 Gönderen: ByCash »
 


MTASATURK

[Yardım] Fonksiyon
« : 01 Kasım 2020, 19:23:24 »

Çevrimdışı ByCash

  • Admin
  • *
    • İleti: 986
Kod
alan = createColSphere(2277.51294, -761.58533, 130.81004, 1000)
tablo = {}
ekpara = 0
function meslek(plr,cmd,state)
    if isElementWithinColShape(plr,alan) then
        if not state then
           outputChatBox("Maden toplamak için :#FFFFFF /"..cmd.."<topla,sat>",plr,127,255,0,true)
        return end
        if not tablo[plr] then tablo[plr] = {} end
        if state == "topla" then
            if not isTimer(tablo[plr].zaman) then
outputChatBox("Maden toplamaya başladın!",plr,0,0,255,true)       
setPedAnimation(plr,"baseball","bat_4")
tablo[plr].zaman = setTimer (function()
setElementData(plr,"maden:sayi",(    getElementData(plr,"maden:sayi")or 0)+1)
outputChatBox("Madeni topladın! Maden sayın:"  ..getElementData(plr,"maden:sayi"),plr,205,51,51,true)
setPedAnimation(plr)
end,10000,1)
            else 
outputChatBox("Zaten maden topluyorsun!",plr,0,238,238,true)
            end
        elseif state == "sat" then
           if (tonumber(getElementData(plr,"maden:sayi")) or 0 ) > 0 then
                if tonumber(getElementData(plr,"maden:sayi")) > 10 then
ekpara = 30
                end
                outputChatBox("Madenleri sattın!",plr,255,185,15,true)
            else
                outputChatBox("Maden satmak için maden toplaman gerek!",plr,255,127,36,true)
            end
        else
outputChatBox("Maden toplamak için :#FFFFFF /"..cmd.."<topla,sat>",plr,127,255,0,true)
        end
else
outputChatBox("Maden toplama alanında değilsiniz!",plr,255,0,0,true)
end
end
addCommandHandler("maden",meslek)
« Son Düzenleme: 01 Kasım 2020, 21:35:45 Gönderen: ByCash »
 
Mesajı Beğenenler: DrateX