Wysłany: 2019-05-17, 19:13
Yami
Mapper / Uczeń LUA
Wiek: 25 Na forum: 3059 dni Posty: 379
Piwa : 97
Siemka
Wie kto? z was jak zrobi? aby kto? kto zginie w danym cuboidzie pojawia? si? w podanym w kodzie miejscu?
Z G?ry Dzi?ki za pomoc
Wysłany: 2019-05-17, 19:48
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
U?ywasz eventu
i sprawdzasz czy gracz by? w cuboidzie
Wysłany: 2019-05-17, 20:44
Yami
Mapper / Uczeń LUA
Wiek: 25 Na forum: 3059 dni Posty: 379
Piwa : 97
Spr?bowa?em zrobi? co? takiego ale nie dzia?a
local Cuboid = createColSphere ( 1468.11670 , - 1762.87305 , 27 , 10 )
function ColShapeHit ( thePlayer , matchingDimension )
local detection = isElementWithinColShape ( thePlayer , Cuboid )
detection = detection and getElementDimension ( thePlayer ) == getElementDimension ( Cuboid )
function spawnWasted ( player )
local players = getElementsWithinColShape ( Cuboid , "player" )
repeat until spawnPlayer ( player , 1481.25574 , - 1744.36475 , 13.54688 , 180 , math . random ( 19 , 30 ) )
fadeCamera ( player , true )
setCameraTarget ( player , player )
setPlayerTeam ( player , nil )
takePlayerMoney ( player , 25 )
end
end
addEventHandler ( "onPlayerWasted" , root ,
function()
setTimer ( spawnWasted , 5000 , 1 , source )
end
)
DB3: WARNING: xxx/s.lua:18: Bad argument @ 'setTimer' [Expected function at argument 1, got nil]
Wysłany: 2019-05-17, 21:27
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
Totalny chaos.
Tworzysz funkcj? w innej funkcji, dlatego timer nie mo?e si? do niej odnie??. Zb?dna funkcja ColShapeHit (pewnie kopiowa?e? sk?d?).
Tutaj podsy?am Ci gotowy, jak najlepiej u?o?ony kod:
local Cuboid = createColSphere ( 1468.11670 , - 1762.87305 , 27 , 10 )
addEventHandler ( "onPlayerWasted" , getRootElement (), function()
if ( isElementWithinColShape ( source , Cuboid ) and ( getElementDimension ( source ) == getElementDimension ( Cuboid ))) then
spawnPlayer ( source , 1481.25574 , - 1744.36475 , 13.54688 , 180 , math . random ( 19 , 30 ))
fadeCamera ( source , true )
setCameraTarget ( source , source )
setPlayerTeam ( source , nil )
takePlayerMoney ( source , 25 )
end
end )
Więcej szczegółów
Wystawiono 1 piw(a):Yami
Wysłany: 2019-05-17, 21:59
Yami
Mapper / Uczeń LUA
Wiek: 25 Na forum: 3059 dni Posty: 379
Piwa : 97
Dzi?ki bardzo
Za pomoc piwko leci
Tagi: śmierć :: cuboidzie
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: