Tematy otagowane jako: onmarkerhit
1. onMarkerHit
Cze?? wszystkim,
Mam problem z u?yciem onMarkerHit.
Kod wygl?da nast?puj?co:
marker1 = createMarker
function start ()
marker2 = createMarker
end
addEventHandler ( "onMarkerHit" , marker1 , start )
function step ( plr )
if not isElementWithinMarker ( plr , marker2 ) then return end
co ? si ? tutaj dzieje
end
addEventHandler ( "onMarkerHit" , marker2 , step )
I teraz problem jest nast?puj?cy, skrypt po uruchomieniu stwierdza, ?e argument 2 nie ma warto?ci czyli marker2 i faktycznie tak jest, bo uzyskuje j? gdy funkcja start si? wype?ni.
Ale ten marker nie mo?e si? utworzy?(nie chce tego) nim funkcja start si? nie wype?ni
Z tego te? powodu w momencie wype?nienia funkcji start i pr?bie wej?cia w marker2 nic si? nie dzieje (powinien uruchomi? funkcje step)
Dodam tylko, ?e funkcja 2 tworzy te? marker u?ywany przez funkcje 3 a trzecia tworzy dla czwartej.
Jak to rozwi?za??
2. onMarkerHit
Witam. Jak oznaczy? gracza w evencie onMarkerHit?
function markerhit ( thePlayer )
local team = getPlayerTeam ( thePlayer )
Z?y argument getPlayerTeam [oczekiwany gracz otrzymano marker]
3. onmarkerhit
witam mam jakis dziwny problem z onmarkerhit za pomoc dam piwo
kod
local marker = createMarker (- 2412.40259 , - 599.09100 , 132.60568 - 1 , 'cylinder' , 1.0 , 80 , 180 , 0 , 170 )
function test ( player )
outputChatBox ( 'test' , player )
end
addEventHandler ( 'onMarkerHit' , marker , test )
i powie mi ktos czemu to nie dziala?
4. Tabela onMarkerHit for
Cze??, mam problem gdy? ucz? si? lua i tworze skrypt, stworzy?em tabele i p?tle aby z tabeli tworzyc markery o podane argumenty czyli tak x, y, z, r, g, b itd.
Lecz teraz mam problem bo nie wiem jak to zrobi? by funkcja onMarkerHit zastosowa? do wszystkich market?w stworzonych z tabeli. Sory, ?e to troche nie po polsku napisane no ale no...
M?j kod z tablica itd:
local Ballas = {
{ 0 , 0 , 13 , 3 , 255 , 0 , 0 , 150 }, -- x , y , z , wielkosc markeru , kolor r , g , b , alpha
}
function StworzmBallas ( plr , cmd )
for i , v in ipairs ( Ballas ) do
createMarker ( v [ 1 ], v [ 2 ], v [ 3 ], "cylinder" , v [ 4 ], v [ 5 ], v [ 6 ], v [ 7 ])
setElementData ( v , "MarkerBallas" , true )
end
end
function WybieramBallasMarker ( plr , etc )
-- i tu nie wiem jak to dalej zrobic , czytalem wiki ale no cozz tam mojego problemu nie ma
Prosz? o pomoc.
5. onMarkerHit
Witam da si? zrobi? aby onMarkerHit dzia?a? na marker kt?ry jest w funkcji
podaje m?j kod
function kappa ( thePlayer )
marker = createMarker ( 0 , 0 , 0 , "cylinder" , 1 , 255 , 255 , 255 )
end
addCommandHandler ( "test" , kappa )
function kappa2 ( player )
outputChatBox ( "kupa" , player )
end
addEventHandler ( "onMarkerHit" , marker , kappa2 )
Wywala mi b?ad w DBS3 prosze o pomoc
6. onMarkerHit
Witajcie otoz mam taki oto kod:
addEventHandler( "onMarkerHit" , root ,function( elem , dim )
if getElementType ( elem ) == "vehicle" and getElementData ( source , "bullet" ) then
local damage = getElementData ( source , "damage" )
local hp = getElementHealth ( elem )
setElementHealth ( elem , hp - damage )
print( "taken damage" )
destroyElement ( source )
print( "marker destroyed" )
end
end )
(Nie jest to caly kod iz nie chce zdradzac do czego to jest)
i problem jest taki:
Marker jest przyczepiony do obiektu ktory przesuwam za pomoca moveObject i po zderzeniu sie z obiektem (vehicle) nie dzieje sie nic, poprostu marker leci dalej.
Jest to jakis blad w mta czy ja cos zle zrobilem z onMarkerHit ?
7. zdarzenie onMarkerHit
Witam, pisz? kod na prac? dorywcz? i mam warning: s.lua:60 Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil]
Linijka 60:
function miejsceMarker ( gracz )
if getElementData ( gracz , "praca:transport" ) then
if isPedInVehicle ( gracz ) then
outputChatBox ( "Zadanie wykonane!" , gracz )
zakonczPrace ( gracz )
if getElementData ( gracz , "premium" ) then
givePlayerMoney ( gracz , math . random ( 350 , 560 ))
else
givePlayerMoney ( gracz , math . random ( 280 , 390 ))
end
fadeCamera ( gracz , false )
setTimer (function()
fadeCamera ( gracz , true )
outputChatBox ( "Wynagrodzenie zosta?o dodane na Twoje konto." , gracz )
setElementData ( gracz , "praca:transport" , false )
end , 3000 , 1 )
end
end
end
addEventHandler ( "onMarkerHit" , marker , miejsceMarker )
8. onMarkerHit
Witam, zrobi?em prost? funkcj? na wyswietlenie tekstu dla testowania czy marker dzia?a, lecz po wej?ciu w marker nic si? nie dzieje.
Odrazu dodam ?e 2 pozosta?e markery dzia?aj? poprawnie a ten ktory nie dziala jest zrobiony dokladnie tak samo jak te 2 pozosta?e.
Kod: local markerSM = createMarker(370, 167.3, 1008.38-1, "cylinder", 1, 0, 170, 255, 175)
setElementInterior(markerSM, 3)
function PokazOknoSM (source)
outputChatBox("TEST", source, 255, 255, 255)
end
addEventHandler( "onMarkerHit", markerSM, PokazOknoSM, false )
9. onMarkerHit
Czemu ten kod mi nie dzia?a, pomo?e mi kto??
local MarkerGS = createMarker ( 2491.43359375 , - 1674.310546875 , 12.101721763611 , "cylinder" , 2.0 , 100 , 100 , 100 , 150 )
local x , y = guiGetScreenSize ()
local GUIsizeX = 200
local GUIsizeY = 300
GS = guiCreateWindow ( 100 , 100 , 200 , 200 , "Grove Street" , false )
guiWindowSetSizable ( GS , false )
guiSetVisible ( GS , false )
buttonGS = guiCreateButton ( 0.8 , 0.85 , 0.15 , 0.1 , "OFF" , true , GS )
guiSetProperty ( buttonGS , "NormalTextColour" , "FFAAAAAA" )
guiSetVisible ( GS , false )
function wlaczokno ( hitElement )
if getElementType ( hitElement ) == "player" then
guiSetVisible ( GS , true )
guiSetVisible ( buttonGS , true )
showCursor ( true )
end
end
addEventHandler ( "onMarkerHit" , MarkerGS , wlaczokno )
function wylaczokno ()
guiSetVisible ( GS , false )
guiSetVisible ( buttonGS , false )
showCursor ( false )
end
addEventHandler ( "onClientGUIClick" , buttonGS , wylaczokno )