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

Wysłany: 2016-06-06, 18:03


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540

Cze??. Zrobi?em skrypt na barierki:


function barierka (thePlayer, cmd)
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("PSP")) then 
    local x,y,z = getElementPosition(thePlayer)
    local rx,ry,rz = getElementRotation(thePlayer)
    Barierka = createObject (1228, x, y ,z, rx, ry, rz)
    outputChatBox("Stworzy?e? barierke", thePlayer)
end
end
addCommandHandler("bu", barierka)

function barierka (thePlayer, cmd)
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("PSP")) then 
    for k,v in ipairs ( barierki ) do
destroyElement ( v )
    outputChatBox("Usune?e? barierke", thePlayer)
end
end
end
addCommandHandler("busun", barierka)


Jest b??d w 13 linijce:


function barierka (thePlayer, cmd)
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("PSP")) then 
    for k,v in ipairs ( barierki ) do -- tutaj jest b??d
destroyElement ( v )
    outputChatBox("Usune?e? barierke", thePlayer)
end
end
end
addCommandHandler("busun", barierka)


SS:



Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-06, 18:10


AteX







Wiek: 27
Na forum: 4156 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

Nie masz tabeli barierki

Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-06, 18:16


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540

B??d w 6 i14 linijce:


function barierka (thePlayer, cmd)
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("PSP")) then 
    local x,y,z = getElementPosition(thePlayer)
    local rx,ry,rz = getElementRotation(thePlayer)
    Barierka = createObject (1228, x+1, y ,z-0.50, rx, ry, rz)
    table.insert ( barierka, barierka )
end
end
addCommandHandler("bu", barierka)

function barierka (thePlayer, cmd)
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("PSP")) then 
    for k,v in ipairs ( barierki ) do
destroyElement ( v )
end
end
end
addCommandHandler("busun", barierka)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-06, 18:21


AteX







Wiek: 27
Na forum: 4156 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

Na pocz?tku nad funkcjami zadeklaruj t? tabel?.
barierki = {}


oraz popraw table.insert bo nazwy si? nie zgadzaj?.
table.insert(Barierka, barierki)


Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-06, 18:27


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540



Przy okazji jak zrobi? j? freeze oraz nie zniszczaln?? Wiem, ?e jest na to funkcja, ale nie wiem gdzie j? wstawi?.

Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-06, 18:30


AteX







Wiek: 27
Na forum: 4156 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

Nie zauwa?y?em, ?e funkcja ma tak? nazw? co nazwa tworzonego obiektu. Musisz jedno z nich zmieni?.

Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-06, 18:34


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540


barierki2 = {}

function barierka (thePlayer, cmd)
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("PSP")) then 
local x,y,z = getElementPosition(thePlayer)
local rx,ry,rz = getElementRotation(thePlayer)
Barierka = createObject (1228, x+1, y ,z-0.50, rx, ry, rz)
table.insert(barierka, barierki2)
end
end
addCommandHandler("bu", barierka)

function barierka (thePlayer, cmd)
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("PSP")) then 
    for k,v in ipairs ( barierki2 ) do
destroyElement ( v )
end
end
end
addCommandHandler("busun", barierka)


Nadal ten sam b??d. Albo jestem g?upi albo nie umiem tego zrobi?. Przy okazji jak zrobi? j? freeze oraz nie zniszczaln?? Wiem, ?e jest na to funkcja, ale nie wiem gdzie j? wstawi?.

Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-06, 18:36


AteX







Wiek: 27
Na forum: 4156 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

barierki = {}

function stworzbarierka (thePlayer, cmd)
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("PSP")) then 
local x,y,z = getElementPosition(thePlayer)
local rx,ry,rz = getElementRotation(thePlayer)
Barierka = createObject (1228, x+1, y ,z-0.50, rx, ry, rz)
setElementFrozen(Barierka,true) -- freeze barierki
table.insert(Barierka, barierki)
end
end
addCommandHandler("bu", stworzbarierka)

function usunbarierka (thePlayer, cmd)
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("PSP")) then 
    for k,v in ipairs ( barierki ) do
destroyElement ( v )
end
end
end
addCommandHandler("busun", usunbarierka)


Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-06, 18:39


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540

"AteX" napisał/a:

barierki = {}

function stworzbarierka (thePlayer, cmd)
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("PSP")) then 
local x,y,z = getElementPosition(thePlayer)
local rx,ry,rz = getElementRotation(thePlayer)
Barierka = createObject (1228, x+1, y ,z-0.50, rx, ry, rz)
setElementFrozen(Barierka,true) -- freeze barierki
table.insert(Barierka, barierki)
end
end
addCommandHandler("bu", stworzbarierka)



function usunbarierka (thePlayer, cmd)
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("PSP")) then 
    for k,v in ipairs ( barierki ) do
destroyElement ( v )
end
end
end
addCommandHandler("busun", usunbarierka)


bad argument #1 insert (table expected, got userdata) --- taki b??d

o co tu chodzi ;v.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-06, 18:50


AteX







Wiek: 27
Na forum: 4156 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

table.insert(barierki,Barierka)


Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-06, 18:53


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540

Dzi?ki wielkie. Kt?re mam zmieni? pozycje, aby barierka zawsze przed graczem zawsze respi?a si? przed nim.

Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-06, 19:06


AteX







Wiek: 27
Na forum: 4156 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

"Rookspack" napisał/a:

Dzi?ki wielkie. Kt?re mam zmieni? pozycje, aby barierka zawsze przed graczem zawsze respi?a si? przed nim.


x+1


Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-06, 19:13


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540

Po testach:

Gdy gracz postawi barierk? i j? usunie nie mo?e jej ponownie postawi?. Musi by? restart skryptu.

Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-06, 19:14


AteX







Wiek: 27
Na forum: 4156 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

function usunbarierka (thePlayer, cmd)
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("PSP")) then 
    for k,v in ipairs ( barierki ) do
destroyElement ( v )
table.remove(barierki,k)
end
end
end
addCommandHandler("busun", usunbarierka)


Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-06, 19:18


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540

Barierka pojawia si? po kilkunastu sekundach. Da?o by si? tak zrobi?, ?e gracz, kt?ry postawi? barierk? (oboj?tnie ile) usuwa jego wszystkie?

[ Dodano: 2016-06-06, 20:19 ]
Close.

Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Tagi: skrypt :: barierki
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