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

Wysłany: 2014-11-04, 20:05


Dixers

No-Life






Wiek: 26
Na forum: 4313 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

Mo?na to zrobi? te? tak.

barierki = {}

addCommandHandler "barierka", function(plr)
team getPlayerTeam plr )
if getTeamName team ) ~= "SAPD" then return end
x,y,getElementPosition plr )
r1,r2,r3 getElementRotation plr )
barierka createObject 1459xyzr1r2r3 )
table.insert barierkibarierka )
end)


addCommandHandler "usunbarierka", function(plr)
team getPlayerTeam plr )
if getTeamName team ) ~= "SAPD" then return end
for k,v in ipairs barierki ) do
destroyElement )
end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-04, 20:51


XQward







Wiek: 24
Na forum: 4344 dni
Posty: 56



Respekt: 50

Barierki dzia?aj? tylko znowu problem si? rozwalaj? :C
Jak wpisuje debugscript to jest takie co?:
ERROR: Barierki/Barierki.lua:12: attempt to call global 'SetObjectBreakable' (a nill value) Prosz? o pomoc :mrgreen:

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-04, 22:48


Tostuch







Wiek: 27
Na forum: 4931 dni
Posty: 483
Nick w MP: Tost

Piwa: 137

Respekt: 110
Respekt: 110

Funkcja setObjectBreakable dzia?a po stronie klienta :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-05, 15:23


XQward







Wiek: 24
Na forum: 4344 dni
Posty: 56



Respekt: 50

Da?em kod na strone clienta tylko teraz dalej jest problem :C.Wpisuje debugscipt i postawiam barierke i takie co?: WARNING:Barierki/Barierki.lua:4: Bad argument @ 'GetTeamName' [Expented team at argument 1,got nil] to samo jest z usuwaniem WARNING:Barierki/Barierki.lua:19: Bad argument @ 'GetTeamName' [Expented team at argument 1,got nil]. M?j kod wygl?da tak:
pacholki = {} 

function createPacholek(player) 
if getTeamName team ) ~= "SAPD" then return
end
team getPlayerTeam player )
local xygetElementPosition(playerr1r2r3 getElementRotation(player)
local obiekt createObject 1228xyz-0.5setElementRotation obiektr1r2r3)
setElementFrozen(obiekttrue)
table.insert(pacholkiobiektsetObjectBreakable(pacholkifalse)
setElementCollisionsEnabled (theElementtrue)
end 
addCommandHandler("ustawbarierke"createPacholek)

function destroyPacholki(player)
if getTeamName team ) ~= "SAPD" then return
end
team getPlayerTeam player )
for i,v in pairs(pacholki) do 
if isElement(vthen 
destroyElement(vend 
end 
pacholki = {} 
end 
addCommandHandler "usunbarierki"destroyPacholki)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-05, 17:57


Tostuch







Wiek: 27
Na forum: 4931 dni
Posty: 483
Nick w MP: Tost

Piwa: 137

Respekt: 110
Respekt: 110

Gdzie masz zdefiniowan? zmienn? team?
if getTeamName(getPlayerTeam(player)) ~= "SAPD" then return end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-05, 18:12


XQward







Wiek: 24
Na forum: 4344 dni
Posty: 56



Respekt: 50

Dopisa?em i dalej nie dzia?a :C.Prosz? o pomoc piwko dalej czeka:)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-06, 15:04


Tostuch







Wiek: 27
Na forum: 4931 dni
Posty: 483
Nick w MP: Tost

Piwa: 137

Respekt: 110
Respekt: 110

Jakie b??dy?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-06, 22:12


XQward







Wiek: 24
Na forum: 4344 dni
Posty: 56



Respekt: 50

Pisze mi:
WARNING: Barierki/Barierki.lua:4: Bad argument @ 'GetPlayerTeam' [Expented player at argument 1, got string 'ustawbarierke']
WARNING: Barierki/Barierki.lua:4: Bad argument @ 'GetTeamName' [Expented team at argument 1, got boolean]


Z usuwaniem te? to samo.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-06, 22:17


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
"XQward" napisał/a:

Pisze mi:
WARNING: Barierki/Barierki.lua:4: Bad argument @ 'GetPlayerTeam' [Expented player at argument 1, got string 'ustawbarierke']
WARNING: Barierki/Barierki.lua:4: Bad argument @ 'GetTeamName' [Expented team at argument 1, got boolean]


Z usuwaniem te? to samo.


Z racji ze nie jestem w temacie a te bledy swiadcza jedynie o bledach zwiazanych z teamem podaje prawidlowy warunek na team:

Kod:


if getTeamName(getPlayerTeam(getLocalPlayer())) == "Nazwa teamu" then


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-07, 12:27


Tostuch







Wiek: 27
Na forum: 4931 dni
Posty: 483
Nick w MP: Tost

Piwa: 137

Respekt: 110
Respekt: 110

Da?e? kod po stronie klienta? Ustaw po stronie serwera i b?dzie dzia?a?o...

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-07, 17:31


XQward







Wiek: 24
Na forum: 4344 dni
Posty: 56



Respekt: 50

Napiszcie jak powinno to wygl?da? chodzi mi o kod.Prosz? mi napiszcie bo ju? mam pomieszano w g?owie :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-07, 19:13


Tostuch







Wiek: 27
Na forum: 4931 dni
Posty: 483
Nick w MP: Tost

Piwa: 137

Respekt: 110
Respekt: 110

skrypt.lua
pacholki = {} 

function createPacholek(player)
 if getTeamName(v) == "SAPD" then
  local xygetElementPosition(player) 
  r1r2r3 getElementRotation(player)
  local obiekt createObject 1228xyz-0.5) 
  setElementRotation obiektr1r2r3)
  setElementFrozen(obiekttrue)
  table.insert(pacholkiobiekt) 
  setObjectBreakable(pacholkifalse)
  setElementCollisionsEnabled (theElementtrue)
 end
end
addCommandHandler("ustawbarierke"createPacholek)

function destroyPacholki(player)
 if getTeamName(getPlayerTeam(player)) == "SAPD" then
  for i,v in pairs(pacholki) do 
   if isElement(vthen 
    destroyElement(v) 
   end 
  end 
 pacholki = {} 
 end 
end
addCommandHandler "usunbarierki"destroyPacholki)


meta.xml
Kod:


<meta>
<script src="skrypt.lua"/>
</meta>


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-07, 23:40


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

 if getTeamName(v) == "SAPD" then


Czym jest v?

[ Dodano: 2014-11-07, 23:41 ]
Spr?buj :


pacholki = {} 

function createPacholek(player)
 if getTeamName(getPlayerTeam(player)) == "SAPD" then
  local xygetElementPosition(player) 
  r1r2r3 getElementRotation(player)
  local obiekt createObject 1228xyz-0.5) 
  setElementRotation obiektr1r2r3)
  setElementFrozen(obiekttrue)
  table.insert(pacholkiobiekt) 
  setObjectBreakable(pacholkifalse)
  setElementCollisionsEnabled (theElementtrue)
 end
end
addCommandHandler("ustawbarierke"createPacholek)

function destroyPacholki(player)
 if getTeamName(getPlayerTeam(player)) == "SAPD" then
  for _,v in pairs(pacholki) do 
    destroyElement(v) 
  end 
 pacholki = {} 
 end 
end
addCommandHandler "usunbarierki"destroyPacholki)


Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-15, 09:11


XQward







Wiek: 24
Na forum: 4344 dni
Posty: 56



Respekt: 50

Barierki da?em na t? mete,kt?r? podes?a? Tostuch.I jak wgrywam i postawiam barierki to dalej barierki si? rozwalaj? :C.

Prosz? bardzo o pomoc :) Dam piwko

[ Dodano: 2014-12-04, 19:43 ]
Ref :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-04, 19:59


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

Da si? zrobi? tak, aby barierki si? nie psu?y?


local pacholki = {} 

function createPacholek(playerteam getPlayerTeam player )
if getTeamName team ) ~= "SAPD" then return end
local xygetElementPosition(playerr1r2r3 getElementRotation(player)
local obiekt createObject 1228xyz-0.5r1r2r3 setElementFrozen(obiekttrue)
table.insert(pacholkiobiektsetObjectBreakable(pacholkitrue)
end 
addCommandHandler("ustawbarierke"createPacholek) 

function destroyPacholki(player)
team getPlayerTeam player )
if getTeamName team ) ~= "SAPD" then return end 
for i,v in pairs(pacholki) do 
if isElement(envythen 
destroyElement(envyend 
end 
pacholki = {} 
end 
addCommandHandler("usunbarierki"destroyPacholki)



Pr?bowa?em setElementFrozen ( playerVehicle, newFreezeStatus ), ale nic.

Za pomoc :piwo:

Postaw piwo autorowi tego posta
 

 
Tagi: 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 » Barierki 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