Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2017-07-05, 10:44


Dabet







Wiek: 26
Na forum: 3258 dni
Posty: 14
Nick w MP: Dabet

Piwa: 334

Respekt: 60

Ostrzeżeń: 100%
Witam mam problem, poniewa? zrobi?em prace my?liwego ale nie dzia?a mi wyp?ata pieni?dzy. Na serwerze posiadam GM .newMode.

Brak DB3

Kod:
zwierzeta={
{2439.99, -656.49122.54},
{2502.54, -564.57102.93},
{2561.45, -509.0585.76},
{2481.18, -456.5383.18},
{2354.08, -502.83122.38},
{2230.51, -448.68118.57},
{2176.64, -535.35124.52},
{2223.51, -610.03123.90},
{2288.64, -681.23130.96},
{2199.13, -732.1695.57},
{2111.29, -730.80100.22},
{2252.76, -827.40125.28},
{2391.54, -852.98112.45},
{2501.67, -822.3292.00},
{2584.28, -739.6296.14},
{2590.84, -643.41135.32},
}
typyzwierzat={ -- kasapole widzeniaid
{1000,18,121},
{2000,24,122},
{4000,30,123},
}
ilosctypow=#typyzwierzat
aktualneZwierzeta={}
sfery={}
zajete={}
tablesize=function(tabela)
    l=0
    for i,v in pairs(tabela) do
    l=l+1
    end
    return l
end
ilosczwierzat=tablesize(zwierzeta)
function stworzZwierzeta(usun,ilosc,id)
    if not id then id=-1 end
    if usun then
        for i,v in pairs(aktualneZwierzeta) do
            destroyElement(aktualneZwierzeta[i])
            destroyElement(sfery[i])
        end
        aktualneZwierzeta={}
        sfery={}
        zajete={}
        return
    end
    for i=1,ilosc do
        liczba=math.random(ilosczwierzat)
        e=0
        while zajete[liczba] or aktualneZwierzeta[liczba] or liczba==id do
            liczba=math.random(ilosczwierzat)
            e=e+1
            if e>15 then return outputChatBox("e>15"end
        end
        typ=typyzwierzat[math.random(ilosctypow)]
        pos=zwierzeta[liczba]
        aktualneZwierzeta[liczba]=createPed(typ[3],pos[1],pos[2],pos[3])
        sfery[liczba]=createColSphere(pos[1],pos[2],pos[3],typ[2])
        attachElements(sfery[liczba],aktualneZwierzeta[liczba])
        setElementData(aktualneZwierzeta[liczba],"parent",sfery[liczba])
        setElementData(sfery[liczba],"zwierze",true)
        setElementData(sfery[liczba],"id",liczba)
        setElementData(sfery[liczba],"parent",aktualneZwierzeta[liczba])
        setElementData(sfery[liczba],"kasa",typ[1])
        zajete[liczba]=true
    end
end

addEvent("MysliwyStart"true)
addEventHandler("MysliwyStart"resourceRoot, function()
    stworzZwierzeta(false,3)
    if isTimer(timerthen
        killTimer(timer)
    end
    timer=setTimer(zwierzetaMove,2000,0)
end)
addEvent("MysliwyStop"true)
addEventHandler("MysliwyStop"resourceRoot, function()
    stworzZwierzeta(true)
    if isTimer(timerthen
        killTimer(timer)
    end
end)

function MarkerHit(hitElement)
    if hitElement==localPlayer then
        if getElementData(source,"zwierze"then
            id=getElementData(source,"id")
            destroyElement(getElementData(source,"parent"))
            destroyElement(source)
            stworzZwierzeta(false,1,id)
            aktualneZwierzeta[id]=nil
            sfery[id]=nil
            zajete[id]=nil
            exports["nm-noti"]:noti("Sp?oszy?e? zwierz?! Pami?taj, ?e nie mo?esz za blisko podchodzi? do zwierz?t!"el)
        end
    end
end
addEventHandler("onClientColShapeHit",resourceRoot,MarkerHit)

function zwierzetaMove()
    for i,v in pairs(aktualneZwierzeta) do
        setPedControlState(v,"walk",true)
        setPedControlState(v,"forwards",true)
        setElementRotation(v,0,0,math.random(0,360))
    end
end

function pedDmg(attacker)
    if attacker==localPlayer then
        source=getElementData(source,"parent")
        if source and getElementData(source,"zwierze"then
            wyplata=getElementData(source,"kasa")
            exports["nm-noti"]:noti("Otrzymujesz "..wyplata.." PLN"el)
            triggerServerEvent("prace:wyplata",getRootElement(),"mysliwy",wyplata)
            id=getElementData(source,"id")
            destroyElement(getElementData(source,"parent"))
            destroyElement(source)
            stworzZwierzeta(false,1,id)
            aktualneZwierzeta[id]=nil
            sfery[id]=nil
            zajete[id]=nil
        end
    end
end
addEventHandler("onClientPedDamage",resourceRoot,pedDmg)


Stawiam :piwo: za pomoc!

Ostatnio zmieniony przez Dabet 2017-07-05, 11:08, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-05, 11:03


Kalizman







Wiek: 23
Na forum: 3651 dni
Posty: 1394

Piwa: 4619

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

Podaj mi tutaj linijke ktora daje wynagrodzenie w postaci liczb

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-05, 11:08


Dabet







Wiek: 26
Na forum: 3258 dni
Posty: 14
Nick w MP: Dabet

Piwa: 334

Respekt: 60

Ostrzeżeń: 100%
typyzwierzat={ -- kasapole widzeniaid
{1000,18,121},
{2000,24,122},
{4000,30,123},
}


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-05, 16:44


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

Masz poda? kod z server'a zdarzenie 'praca:wyplata'

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Tagi: praca :: dorywcza
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku