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

Wysłany: 2019-11-02, 15:18


pyco







Wiek: 30
Na forum: 3131 dni
Posty: 14



Respekt: 50

Witajcie drodzy uzytkownicy gtao przychodze do was z prosba o to abyscie wspomogli w podpieci skryptu pod frakcje. Za dzialace stawiam stawiam browara :piwo:


addCommandHandler('test'function(source,cmd)
        local save getElementData(source,'player:save') or {}
    
        local x,y,getElementPosition(source)            
        local utrudnienie createBlip(x,y,z19,2,0,0,0,0,0,275)
            --outputChatBox('Postawiles Znak ostrzegawczy')
            table.insert(save,utrudnienie)
            setElementData(source,'player:save',save)
         
end)

    
addCommandHandler('test2',function(source,cmd)
local save getElementData(source,'player:save') or {}
for keysource in ipairs(getElementData(source,'player:save')) do
if isElement(sourcethen
destroyElement(source)
end
end
--outputChatBox('Usuneles Znak ostrzegawczy')
removeElementData(source,'player:save')
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-02, 15:53


killercycDDS

Migacz






Wiek: 25
Na forum: 4512 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1659

Respekt: 22

"pyco" napisał/a:

Witajcie drodzy uzytkownicy gtao przychodze do was z prosba o to abyscie wspomogli w podpieci skryptu pod frakcje. Za dzialace stawiam stawiam browara :piwo:


addCommandHandler('test'function(source,cmd)
        local save getElementData(source,'player:save') or {}
    
        local x,y,getElementPosition(source)            
        local utrudnienie createBlip(x,y,z19,2,0,0,0,0,0,275)
            --outputChatBox('Postawiles Znak ostrzegawczy')
            table.insert(save,utrudnienie)
            setElementData(source,'player:save',save)
         
end)

    
addCommandHandler('test2',function(source,cmd)
local save getElementData(source,'player:save') or {}
for keysource in ipairs(getElementData(source,'player:save')) do
if isElement(sourcethen
destroyElement(source)
end
end
--outputChatBox('Usuneles Znak ostrzegawczy')
removeElementData(source,'player:save')
end)

pod jak?? okre?lon? frakcje czy pod wszystkie?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-02, 16:07


RudyTMM
[Usunięty]









[wmta]GetElementData[/wmta]
Czytanie nie szkodzi

 

 
Wysłany: 2019-11-02, 16:26


pyco







Wiek: 30
Na forum: 3131 dni
Posty: 14



Respekt: 50

killercycDDS, Dla wszystkich co z uzyciem

if getElementData(source,'player:faction') and getElementData(source,'player:faction')=='SAMD' then


zebym mogl dodawac sobie lub usuwac dana frakcje

[ Dodano: 2019-11-02, 16:27 ]
RudyTMM, Tak wiem ze istnieje wiki ale niestety nie bardz rozumiem to

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-02, 16:52


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

No to wklejasz i sprawdzasz czy dzia?a. Debugscript po co? jest tak? (/debugscript 3).

IFa ko?czysz endem. Zamieniasz zmienn? gracza na tak?, zgadzaj?c? si??z tym co masz w komendzie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-02, 18:08


RudyTMM
[Usunięty]









[lua]addCommandHandler('test",function(source,cmd)
local save = getElementData(source,'player:save') or {}
if getElementData(e,"player:faction") == "SAPD" or getElementData(source,'player:faction')=='SAMD' or getElementData(source,'player:faction')=='SAFD' then
local x,y,z = getElementPosition(source)
local utrudnienie = createBlip(x,y,z, 19,2,0,0,0,0,0,275)
--outputChatBox('Postawiles Znak ostrzegawczy')
table.insert(save,utrudnienie)
setElementData(source,'player:save',save)

end)


addCommandHandler('test2",function(source,cmd)
local save = getElementData(source,'player:save') or {}
if getElementData(e,"player:faction") == "SAPD" or getElementData(source,'player:faction')=='SAMD' or getElementData(source,'player:faction')=='SAFD' then
for key, source in ipairs(getElementData(source,'player:save')) do
if isElement(source) then
destroyElement(source)
end
end
--outputChatBox('Usuneles Znak ostrzegawczy')
removeElementData(source,'player:save')
end)[/lua]
dla sapd?w

 

 
Wysłany: 2019-11-02, 19:11


pyco







Wiek: 30
Na forum: 3131 dni
Posty: 14



Respekt: 50

"RudyTMM" napisał/a:

addCommandHandler('test",function(source,cmd)
        local save = getElementData(source,'player:save') or {}
        if getElementData(e,"player:faction") == "SAPD" or getElementData(source,'player:faction')=='SAMD' or getElementData(source,'player:faction')=='SAFD' then
        local x,y,z = getElementPosition(source)            
        local utrudnienie = createBlip(x,y,z, 19,2,0,0,0,0,0,275)
            --outputChatBox('Postawiles Znak ostrzegawczy')
            table.insert(save,utrudnienie)
            setElementData(source,'player:save',save)
         
end)

    
addCommandHandler('test2",function(source,cmd)
local save = getElementData(source,'player:save') or {}
 if getElementData(e,"player:faction") == "SAPD" or getElementData(source,'player:faction')=='SAMD' or getElementData(source,'player:faction')=='SAFD' then
for key, source in ipairs(getElementData(source,'player:save')) do
if isElement(source) then
destroyElement(source)
end
end
--outputChatBox('Usuneles Znak ostrzegawczy')
removeElementData(source,'player:save')
end)

dla sapd?w
Niestert nie dziala nadal

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-02, 22:14


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Bo dalej nie zgadza si? zmienna gracza w tych warunkach (w jednym i drugim, tylko w pierwszym getElementData).

Tak samo cudzys??w, czy tam 'g?rne przecinki', musi by? tylko jeden a nie 2. W obu komendach jest ten sam b??d. Tyle to chyba sam dasz rad? zrobi?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-03, 00:57


killercycDDS

Migacz






Wiek: 25
Na forum: 4512 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1659

Respekt: 22

Zobacz

addCommandHandler('test'function(source,cmd)
    if getElementData(source"player:faction",truethen
    local save getElementData(source,'player:save') or {}

    local x,y,getElementPosition(source)            
    local utrudnienie createBlip(x,y,z19,2,0,0,0,0,0,275)
        --outputChatBox('Postawiles Znak ostrzegawczy')
        table.insert(save,utrudnienie)
        setElementData(source,'player:save',save)
     return end
end)


addCommandHandler('test2',function(source,cmd)
if getElementData(source"player:faction",truethen
local save getElementData(source,'player:save') or {}
for keysource in ipairs(getElementData(source,'player:save')) do
if isElement(sourcethen
destroyElement(source)
end
end
--outputChatBox('Usuneles Znak ostrzegawczy')
removeElementData(source,'player:save')
return end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-03, 10:02


pyco







Wiek: 30
Na forum: 3131 dni
Posty: 14



Respekt: 50

Wilq, Tak wiem przeinki czy jak t sie tam zwie pozmienialem

[ Dodano: 2019-11-03, 10:12 ]
"killercycDDS" napisał/a:

Zobacz

addCommandHandler('test'function(source,cmd)
    if getElementData(source"player:faction",truethen
    local save getElementData(source,'player:save') or {}

    local x,y,getElementPosition(source)            
    local utrudnienie createBlip(x,y,z19,2,0,0,0,0,0,275)
        --outputChatBox('Postawiles Znak ostrzegawczy')
        table.insert(save,utrudnienie)
        setElementData(source,'player:save',save)
     return end
end)


addCommandHandler('test2',function(source,cmd)
if getElementData(source"player:faction",truethen
local save getElementData(source,'player:save') or {}
for keysource in ipairs(getElementData(source,'player:save')) do
if isElement(sourcethen
destroyElement(source)
end
end
--outputChatBox('Usuneles Znak ostrzegawczy')
removeElementData(source,'player:save')
return end
end)
Niestety wystepuje ciagle lad w db3
ERROR:Loading script failed: [frakcje]/utrudnienie/system.lua:30 ')' expected near 'function'

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-03, 13:39


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Widzisz, tak to jest jak dziesi?ciu chce pom?c, a ?aden pewnie nie wie co to LUA.

local player_faction = {['SAPD'] = true, ['SAMD'] = true, ['SAFD'] = true}

addCommandHandler('test', function(playercmd)
    if (getElementData(player"player:faction") and player_faction[getElementData(player"player:faction")]) then

        local save getElementData(player'player:save') or {}
        local xygetElementPosition(player)            
        local utrudnienie createBlip(xyz19200000275)

        --outputChatBox('Postawiles Znak ostrzegawczy')
        table.insert(saveutrudnienie)
        setElementData(player'player:save'save)
         return 
    end
end)


addCommandHandler('test2', function(playercmd)
    if (getElementData(player"player:faction") and player_faction[getElementData(player"player:faction")]) then

        local save getElementData(player'player:save') or {}

        for _element in ipairs(save) do
            if isElement(elementthen
                destroyElement(element)
            end
        end
        --outputChatBox('Usuneles Znak ostrzegawczy')
        removeElementData(player'player:save')
        return 
    end
end)


Kod nie tylko zawiera? b??dy, ale te? zmienne si? nadpisywa?y w p?tli na tabeli 'save'. Taki kod powinien dzia?a? bez problemu.
Co do tych pomocnik?w, je?li nie wiecie o co chodzi to lepiej nie pr?bowa? na si??. Zmieni?em te? nazwy zmiennych (np. source na player) ?eby to by?o bardziej przejrzyste.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-03, 14:00


pyco







Wiek: 30
Na forum: 3131 dni
Posty: 14



Respekt: 50

"Wilq" napisał/a:

Widzisz, tak to jest jak dziesi?ciu chce pom?c, a ?aden pewnie nie wie co to LUA.

local player_faction = {['SAPD'] = true, ['SAMD'] = true, ['SAFD'] = true}

addCommandHandler('test', function(playercmd)
    if (getElementData(player"player:faction") and player_faction[getElementData(player"player:faction")]) then

        local save getElementData(player'player:save') or {}
        local xygetElementPosition(player)            
        local utrudnienie createBlip(xyz19200000275)

        --outputChatBox('Postawiles Znak ostrzegawczy')
        table.insert(saveutrudnienie)
        setElementData(player'player:save'save)
         return 
    end
end)


addCommandHandler('test2', function(playercmd)
    if (getElementData(player"player:faction") and player_faction[getElementData(player"player:faction")]) then

        local save getElementData(player'player:save') or {}

        for _element in ipairs(save) do
            if isElement(elementthen
                destroyElement(element)
            end
        end
        --outputChatBox('Usuneles Znak ostrzegawczy')
        removeElementData(player'player:save')
        return 
    end
end)


Kod nie tylko zawiera? b??dy, ale te? zmienne si? nadpisywa?y w p?tli na tabeli 'save'. Taki kod powinien dzia?a? bez problemu.
Co do tych pomocnik?w, je?li nie wiecie o co chodzi to lepiej nie pr?bowa? na si??. Zmieni?em te? nazwy zmiennych (np. source na player) ?eby to by?o bardziej przejrzyste.
Kod jak najbardziej nic nie pokazuje zadnych bledow w db 3 ale po wpisania komendy nic nie dzieje

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-03, 14:22


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Jeste? pewny, ?e masz elementDat? "player:faction"? Kt?r? komend? wpisujesz? Mo?e si??co??dzieje ale ty o tym nie wiesz (dodaj sobie outputChatBoxy).

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-03, 14:35


pyco







Wiek: 30
Na forum: 3131 dni
Posty: 14



Respekt: 50

"Wilq" napisał/a:

Jeste? pewny, ?e masz elementDat? "player:faction"? Kt?r? komend? wpisujesz? Mo?e si??co??dzieje ale ty o tym nie wiesz (dodaj sobie outputChatBoxy).
Dodalem outchatboxy i mam date 'player:faction' . Po wpisaniu komendy /test nic sie nie pojawia a po wpisaniu komendy /test2 wyskakuje usuneles znak ostrzegawczy

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-03, 17:14


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Spr?buj podmieni? komend?:

addCommandHandler('test', function(playercmd)
    if (getElementData(player"player:faction")) then

        local save getElementData(player'player:save') or {}
        local xygetElementPosition(player)            
        local utrudnienie createBlip(xyz19200000275)

        outputChatBox('Postawi?es: znak ostrzegawczy!'player)
        table.insert(saveutrudnienie)
        setElementData(player'player:save'save)
         return 
    end
end)


Daj zna? o wyniku.

Postaw piwo autorowi tego posta
 

 
Tagi: podpiecie :: skryptu
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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