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

Wysłany: 2015-11-02, 07:13


Vxen







Wiek: 27
Na forum: 4086 dni
Posty: 293

Piwa: 1299

Respekt: 130,5
Respekt: 130,5

Siemanko chc? si? si? powiedzie? jak dzia?a if itp Mam tu kod:

addEventHandler ("onClientResourceStart"getResourceRootElement(getThisResource()), 
function()
createMarker ( -725.2596969.447411.2028 ,"cylinder"60102255170 )
end
)

function MarkerHit (hitPlayermatchingDimension )
       if  and then
        
        else
      
      end   
    --outputChatBox (getPlayerName(hitPlayer) .. " jeste? w mrk")
    --addEventHandler ("onClientRender"getRootElement(), panelek)
    --showCursor (true)

    end
addEventHandler "onClientMarkerHit"getRootElement(), MarkerHit )

I chc? uzyska? co? takiego ?e jak wjad? autem w marker to powie mi ?e jestem w poje?dzie i nic nie wyskoczy,
a jak wejd? bez auta to ma si? pojawi? panelek i powie ?e jestem bez auta.


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-02, 07:26


Fanciak

BOT






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

Piwa: 1572

Respekt: 500
Respekt: 500

Sk?d masz te "if and then"? Owszem, mo?e tak by?, ale and musi by? zdefiniowane wy??j.


np. local cos = getElementData.....

if cos then

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-02, 11:21


#404







Wiek: 26
Na forum: 4772 dni
Posty: 1438

Piwa: 2512

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

Ostrzeżeń: 60%
if - je?eli
and - i
then - wtedy, r??nie si? t?umaczy, mniejsza



function funkcja(plr,cmd)

if plr and getPlayerName(plr) == "DestroY^" then -- JE?ELI ISTNIEJE GRACZ w tym przypadku praktycznie niemo?liwe aby by?o inaczejale... - I jego nick to DestroYprzepu?ci dalej.
outputChatBox("Ram pam pam"plr)
end

if plr and not getPlayerName(plr) == "DestroY^" then -- Znowu je?eli jest gracz I jego nazwa jest inna ni"DestroY^" przepu?ci dalej.

end


end
addCommandHandler("komenda"funkcja)


Najpro?ciej
AND s?u?y do dodania kolejnych warunk?w, kt?re aby "przepu?ci?o dalej" musz? by? spe?nione w odr??nieniu od OR gdy musi by? spe?niony tylko jeden.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-03, 00:09


Vxen







Wiek: 27
Na forum: 4086 dni
Posty: 293

Piwa: 1299

Respekt: 130,5
Respekt: 130,5

addEventHandler ("onClientResourceStart"getResourceRootElement(getThisResource()), 
function(plr)
createMarker ( -725.2596969.447411.2028 ,"cylinder"60102255170 )
end
)

function MarkerHit hitPlayermatchingDimension )
if hitPlayer and onClientVehicleStartEnter(hitPlayerthen
outputChatBox("Ram pam pam"plr)
end
    outputChatBox getPlayerName(hitPlayer) .. " entered a marker" )
end
addEventHandler "onClientMarkerHit"getRootElement(), MarkerHit )
Chc? co? takiego zrobi? i nic. :(


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-03, 00:16


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4134 dni
Posty: 445
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1033

Respekt: 240
Respekt: 240Respekt: 240

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

addEventHandler ("onClientResourceStart"getResourceRootElement(getThisResource()), 
function(plr)
createMarker ( -725.2596969.447411.2028 ,"cylinder"60102255170 )
end
)

function MarkerHit hitPlayermatchingDimension )
if hitPlayer and onClientVehicleStartEnter(hitPlayerthen
outputChatBox("Ram pam pam"plr)
end
    outputChatBox getPlayerName(hitPlayer) .. " entered a marker" )
end
addEventHandler "onClientMarkerHit"getRootElement(), MarkerHit )
Chc? co? takiego zrobi? i nic. :(


onClientVehicleStartEnter - z tego co wiem to jest to event, wi?c nie wiem jak mia?o ci to zadzia?a? z if'em :)

Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-03, 00:19


Vxen







Wiek: 27
Na forum: 4086 dni
Posty: 293

Piwa: 1299

Respekt: 130,5
Respekt: 130,5

A jak mam zrobi? tak ?e, jak gracz siedzi w pojezdzie to ma si? pojawi? mu text???

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-03, 00:24


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4134 dni
Posty: 445
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1033

Respekt: 240
Respekt: 240Respekt: 240

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

A jak mam zrobi? tak ?e, jak gracz siedzi w pojezdzie to ma si? pojawi? mu text???


function cos_tam (el)
if isPedInVehicle (elthen
    outputChatBox ("Jeste? w aucie xD"el)
else
     ohtputChatBox ("Nie ma cie w aucie xD"el)
end
end
addEventHandler ("onMarkerHit"getRootElement (), cos_tam)


O co? takiego ci chodzi?o?

W eventHandlerze zmien getRoota na defibicje markera :)

Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-03, 00:37


Vxen







Wiek: 27
Na forum: 4086 dni
Posty: 293

Piwa: 1299

Respekt: 130,5
Respekt: 130,5

Nie. Chem zrobi? co? takiego ?e jak wejde w marker to ?e mi si? pojawi"" jeste? bez auta"" i gui a jak wjad? pojazdem ""jeste? w aucie""i gui ma nie by?. A ten tw kod nie dzia?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-03, 00:44


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4134 dni
Posty: 445
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1033

Respekt: 240
Respekt: 240Respekt: 240

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

Nie. Chem zrobi? co? takiego ?e jak wejde w marker to ?e mi si? pojawi"" jeste? bez auta"" i gui a jak wjad? pojazdem ""jeste? w aucie""i gui ma nie by?. A ten tw kod nie dzia?.


Szczerze m?wi?c to nie mia? dzia?a?. Da?em przyk?ad u?ycia IF.

To mo?e spr?buj czego? na wz?r tego:

function pokaz (source)
       if not isPedInVehicle (sourcethen
           guiSetVisible (nazwa_tego_guitrue)
           outputChatBox ("Jeste? bez auta")
       else
            outputChatBox ("Jeste? w aucie, wysi?d? z niego!")
       end
end
addEventHandler ("onMarkerHit"jakis_tam_markerpokaz)


Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-03, 00:50


Vxen







Wiek: 27
Na forum: 4086 dni
Posty: 293

Piwa: 1299

Respekt: 130,5
Respekt: 130,5

Nie dzia?a.
addEventHandler ("onClientResourceStart"getResourceRootElement(getThisResource()), 
function qwerty
createMarker ( -725.2596969.447411.2028 ,"cylinder"60102255170 )
end
)

function pokaz (source)
       if not isPedInVehicle (sourcethen
           --guiSetVisible (nazwa_tego_guitrue)
           outputChatBox ("Jeste? bez auta")
       else
            outputChatBox ("Jeste? w aucie, wysi?d? z niego!")
       end
end
addEventHandler ("onMarkerHit"qwertypokaz)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-03, 06:44


Fanciak

BOT






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

Piwa: 1572

Respekt: 500
Respekt: 500

A gdzie masz

local marker createMarker(.....)



? Marker musi by? zdefiniowany w evencie, je?eli to chcesz zrobi?.

I na co Ci dwie funkcje? Ch?opie....



local marker createMarker ( -725.2596969.447411.2028 ,"cylinder"60102255170 )


No sam powiedz, nie ?atwiej?

addEventHandler ("onMarkerHit"markerpokaz)



Strona servera oczywi?cie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-03, 07:48


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4134 dni
Posty: 445
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1033

Respekt: 240
Respekt: 240Respekt: 240

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

A gdzie masz

local marker createMarker(.....)



? Marker musi by? zdefiniowany w evencie, je?eli to chcesz zrobi?.

I na co Ci dwie funkcje? Ch?opie....



local marker createMarker ( -725.2596969.447411.2028 ,"cylinder"60102255170 )


No sam powiedz, nie ?atwiej?

addEventHandler ("onMarkerHit"markerpokaz)



Strona servera oczywi?cie.


addEventHandler ("ocClientMarkerHit"markerpokaz)


Jak strona serwera skoro on chcia? ?eby si? gui pokazywa?o? :o

Vxen, ty w drugim argumencie addEvent'a masz poda? definicj? markera a nie nazw? funkcji w kt?rej zosta? stworzony lol

Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-03, 09:55


#404







Wiek: 26
Na forum: 4772 dni
Posty: 1438

Piwa: 2512

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

Ostrzeżeń: 60%

mk1 createMarker ( -725.2596969.447411.2028 ,"cylinder"60102255170 )


function MarkerHit (hitElementmd)
if not md then return end
if source ~= mk1 then return end

if getElementType(hitElement) == "player" then
 if isPedInVehicle(hitElementthen

 outputChatBox("Jeste? w poje?dzie")

 else
 
 outputChatBox("Nie jeste? w poje?dzie")

 end
end
end
addEventHandler "onClientMarkerHit"getRootElement(), MarkerHit )


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-03, 10:46


Tostuch







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

Piwa: 137

Respekt: 110
Respekt: 110

Jeszcze musisz doda? argument, aby gracz kt?ry "dotkn??" markera by? docelowym graczem, poniewa? wy?wietli si? to ka?demu wtedy, ot taka podpowied? :D

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-03, 22:42


Vxen







Wiek: 27
Na forum: 4086 dni
Posty: 293

Piwa: 1299

Respekt: 130,5
Respekt: 130,5

A jak to mam zrobi??


[00:10] restart: Requested by Console
[00:10] restart: Resource restarting...
[00:10] Stopping r
[00:10] Resource 'r' changed, reloading and starting
[00:10] WARNING: r/c-r.lua [Client] is encoded in ANSI instead of UTF-8. Please convert your file to UTF-8.
[00:10] Some files in 'r' use deprecated functions.
[00:10] Use the 'upgrade' command to perform a basic upgrade of resources.
[00:10] Starting r
[00:10] r restarted successfully

Postaw piwo autorowi tego posta
 

 
Tagi: else
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