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

Wysłany: 2018-02-13, 14:03


IgorPL222

LUA






Wiek: 26
Na forum: 3253 dni
Posty: 133
Nick w MP: mxgvr

Piwa: 746

Respekt: 55,3

Tak jak w temacie!
Zrobi?em marker, i normalnie si? stworzy?, lecz po wejsciu w marker mimo zastosowania funkcji OnClientMarkerHit nic si? nie dzieje.
Skrypt jest po Client Side
W DB3 Wyskakuje tylko b??d
Kod:


Bad argument @ addEventHandler [Expected element at argument 2, got nil]


Oto ca?y skrypt:

local cel = createMarker(255.29895, -1366.57813, 53.10938, "checkpoint", 4, 0, 0, 255)



function cele(thePlayer)
          if thePlayer == getLocalPlayer() then 
            outputChatBox("elo marker0")
          end
        end
        addEventHandler("onClientMarkerHit", cel, cele)

[/code]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-13, 14:34


Ciastuuś

As-salamu alaykum






Wiek: 27
Na forum: 3212 dni
Posty: 800
Nick w MP: Ciastuuś

Piwa: 4304

Respekt: 640
Respekt: 640Respekt: 640

Sprawd? czy na pewno masz go po stronie clienta, gdy? u mnie wszystko dzia?a, rezultat:

https://i.imgur.com/Ff86rYI.jpg

A, oto kod kt?ry u?y?em:


local cel = createMarker(-2400.62280, -580.35413, 132.76778, "checkpoint", 4, 0, 0, 255)

function cele(thePlayer)
          if thePlayer == getLocalPlayer() then 
            outputChatBox("elo marker0")
            outputDebugString("Komunikat: elo marker0")
          end
        end
        addEventHandler("onClientMarkerHit", cel, cele)


Czyli ten Tw?j. Tylko czy Ty tworzysz osobno marker po stronie clienta i osobno funckcje? Je?eli tak to zastosuj si? do tego co pokaza?em powy?ej

Podpis
As-salamu alaykum
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
IgorPL222
Wysłany: 2018-02-13, 15:00


IgorPL222

LUA






Wiek: 26
Na forum: 3253 dni
Posty: 133
Nick w MP: mxgvr

Piwa: 746

Respekt: 55,3

Ciastuu?, wydaj? mi si?, ?e to jedna funkcja, a mimo tego po wej?ciu w marker nic nie wyskakuje.

function losowanko()
local losuj = math.random(1, 3)
if losuj == 1 then    
local cel = createMarker(1762.54773, -2103.95117, 13.54688, "checkpoint", 4, 0, 0, 255)
local cel1 = createMarker(2379.85718, -1785.35425, 13.54688, "checkpoint", 4, 0, 0, 255)
local cel2 = createMarker(2485.92212, -1020.81976, 65.33580, "checkpoint", 4, 0, 0, 255)
local cel3 = createMarker(1496.94690, -690.84027, 94.75000, "checkpoint", 4, 0, 0, 255)
local cel4 = createMarker(374.57281, -77.65766, 1.38281, "checkpoint", 4, 0, 0, 255)
local blip = createBlipAttachedTo(cel, 41)
local blip1 = createBlipAttachedTo(cel1, 41)
local blip2 = createBlipAttachedTo(cel2, 41)
local blip3 = createBlipAttachedTo(cel3, 41)
local blip4 = createBlipAttachedTo(cel4, 41)
elseif
losuj == 2 then
local cel = createMarker(803.38690, -1793.66211, 13.09170, "checkpoint", 4, 0, 0, 255)
local cel1 = createMarker(1290.66272, -1870.19690, 13.54688, "checkpoint", 4, 0, 0, 255)
local cel2 = createMarker(682.21771, -475.64679, 16.33594, "checkpoint", 4, 0, 0, 255)
local cel3 = createMarker(2089.21484, 1450.86243, 10.82031, "checkpoint", 4, 0, 0, 255)
local cel4 = createMarker(-242.40549, -236.32520, 2.42969, "checkpoint", 4, 0, 0, 255)
local blip = createBlipAttachedTo(cel, 41)
local blip1 = createBlipAttachedTo(cel1, 41)
local blip2 = createBlipAttachedTo(cel2, 41)
local blip3 = createBlipAttachedTo(cel3, 41)
local blip4 = createBlipAttachedTo(cel4, 41)
elseif
losuj == 3 then
local cel = createMarker(255.29895, -1366.57813, 53.10938, "checkpoint", 4, 0, 0, 255)
local cel1 = createMarker(768.01074, -504.11118, 18.01293, "checkpoint", 4, 0, 0, 255)
local cel2 = createMarker(172.03481, -152.53413, 1.57525, "checkpoint", 4, 0, 0, 255)
local cel3 = createMarker(-508.30368, -541.35413, 25.52344, "checkpoint", 4, 0, 0, 255)
local cel4 = createMarker(-2031.92529, 156.84238, 29.04611, "checkpoint", 4, 0, 0, 255)
local blip = createBlipAttachedTo(cel, 41)
local blip1 = createBlipAttachedTo(cel1, 41)
local blip2 = createBlipAttachedTo(cel2, 41)
local blip3 = createBlipAttachedTo(cel3, 41)
local blip4 = createBlipAttachedTo(cel4, 41)

function cele(thePlayer)
          if thePlayer == getLocalPlayer() then 
            outputChatBox("elo marker0")
            outputDebugString("Komunikat: elo marker0")
          end
        end
        addEventHandler("onClientMarkerHit", cel, cele)

function cele1(thePlayer)
          if thePlayer == getLocalPlayer() then 
            outputChatBox("elo marker1")
            outputDebugString("Komunikat: elo marker1")
          end
        end
        addEventHandler("onClientMarkerHit", cel1, cele1)

function cele2(thePlayer)
          if thePlayer == getLocalPlayer() then 
            outputChatBox("elo marker2")
            outputDebugString("Komunikat: elo marker2")
          end
        end
        addEventHandler("onClientMarkerHit", cel2, cele2)

function cele3(thePlayer)
          if thePlayer == getLocalPlayer() then 
            outputChatBox("elo marker3")
            outputDebugString("Komunikat: elo marker3")
          end
        end
        addEventHandler("onClientMarkerHit", cel3, cele3)

function cele4(thePlayer)
          if thePlayer == getLocalPlayer() then 
            outputChatBox("elo marker4")
            outputDebugString("Komunikat: elo marker4")
          end
        end
        addEventHandler("onClientMarkerHit", cel4, cele4)
end
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-13, 15:08


Hades.

Łiiiiiiiiii






Wiek: 22
Na forum: 4841 dni
Posty: 372
Nick w MP: Hades

Piwa: 3218

Respekt: 337,8
Respekt: 337,8Respekt: 337,8Respekt: 337,8


function cele(el)
          if el == localPlayer then return end
            outputChatBox("elo marker0")
          end
addEventHandler("onClientMarkerHit", cel, cele)


Podpis
Skrypty/Grafiki na zamówienie!
Kontakt: Discord R35#5507

Discord związany z pomocą: https://discord.gg/ttkQTsc
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
IgorPL222
Wysłany: 2018-02-13, 15:17


IgorPL222

LUA






Wiek: 26
Na forum: 3253 dni
Posty: 133
Nick w MP: mxgvr

Piwa: 746

Respekt: 55,3

Damian2511, Nie dzia?a :(

Podpis
discord: mxgvr
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-13, 15:32


boszboszek

HEY






Wiek: 14
Na forum: 3647 dni
Posty: 146
Nick w MP: boszboszek

Piwa: 2176

Respekt: 261
Respekt: 261Respekt: 261Respekt: 261

"IgorPL222" napisał/a:

Tak jak w temacie!
Zrobi?em marker, i normalnie si? stworzy?, lecz po wejsciu w marker mimo zastosowania funkcji OnClientMarkerHit nic si? nie dzieje.
Skrypt jest po Client Side
W DB3 Wyskakuje tylko b??d
Kod:


Bad argument @ addEventHandler [Expected element at argument 2, got nil]


Oto ca?y skrypt:

local cel = createMarker(255.29895, -1366.57813, 53.10938, "checkpoint", 4, 0, 0, 255)



function cele(thePlayer)
          if thePlayer == getLocalPlayer() then 
            outputChatBox("elo marker0")
          end
        end
        addEventHandler("onClientMarkerHit", cel, cele)

[/code]



Kod:

function cele(thePlayer,Tomasz)
if Tomasz ~= cel then return end
if thePlayer == getLocalPlayer() then
outputChatBox("elo marker0")
end
end
addEventHandler("onClientMarkerHit", getRootElement(), cele)


Spr?buj tak

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
IgorPL222
Wysłany: 2018-02-13, 15:39


IgorPL222

LUA






Wiek: 26
Na forum: 3253 dni
Posty: 133
Nick w MP: mxgvr

Piwa: 746

Respekt: 55,3

boszboszek, nadal nic.

[ Dodano: 2018-02-13, 16:13 ]
Dzi?ki wszystkim za pomoc!
Uda?o mi si?.
Problemem by? math.random.
Za pomoc daj? ka?demu po piwie!

Podpis
discord: mxgvr
Postaw piwo autorowi tego posta
 

 
Tagi: onclientmarkerhit :: nie :: działa!
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