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

Wysłany: 2018-03-09, 20:07


Pawlo3D







Wiek: 31
Na forum: 3738 dni
Posty: 5
Nick w MP: xPawlo



Respekt: 50

Mam problem, a mianowicie kiedy wjedziemy pojazdem w marker to wiadomo?? si? pokazuje, ale kod nie wykonuje triggerClientEvent oraz w konsoli wyrzuca b??d: ERROR: t-gm/t-gm.lua:29: Bad argument @ isPedDrivingVehicle [ped/player expected, got userdata: 0x75]. Licz? na pomoc.


Kod:

function isPedDrivingVehicle(ped)
assert(isElement(ped) and (getElementType(ped) == "ped" or getElementType(ped) == "player"), "Bad argument @ isPedDrivingVehicle [ped/player expected, got " .. tostring(ped) .. "]")
local isDriving = isPedInVehicle(ped) and getVehicleOccupant(getPedOccupiedVehicle(ped)) == ped
return isDriving, isDriving and getPedOccupiedVehicle(ped) or nil
end

addEventHandler ("onMarkerHit", zaladuj, function(plr)
if isPedDrivingVehicle(plr) then

outputChatBox("test", plr)
triggerClientEvent( "zaladujtira", plr )

end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-09, 21:33


Ciastuuś

As-salamu alaykum






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

Piwa: 4304

Respekt: 640
Respekt: 640Respekt: 640

Po pierwsze nie u?ywa si?,

function isPedDrivingVehicle(ped)
    assert(isElement(ped) and (getElementType(ped) == "ped" or getElementType(ped) == "player"), "Bad argument @ isPedDrivingVehicle [ped/player expected, got " .. tostring(ped) .. "]")
    local isDriving = isPedInVehicle(ped) and getVehicleOccupant(getPedOccupiedVehicle(ped)) == ped
    return isDriving, isDriving and getPedOccupiedVehicle(ped) or nil
end


Po drugie poka? kod po stronie clienta gdzie robisz trigger "zaladujtira"

Podpis
As-salamu alaykum
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-10, 10:33


Pawlo3D







Wiek: 31
Na forum: 3738 dni
Posty: 5
Nick w MP: xPawlo



Respekt: 50

addEvent("zaladujtira")

function loadpanel(plr)
outputChatBox("Testt", plr)

end
addEventHandler("zaladujtira", getRootElement(), loadpanel)


Jak nie u?yje tego assertu to kod wog?le nie dziala




I tu meta jeszcze:

<meta>
<info author="" version="1" type="gamemode" name="gm" description="dw" />
<script src="t-gm.lua" type="server" />
<script src="t-gm_c.lua" type="client" />
</meta>

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-10, 15:34


Ciastuuś

As-salamu alaykum






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

Piwa: 4304

Respekt: 640
Respekt: 640Respekt: 640

Proponowa?bym u?y? takiej funkcji na sprawdzanie, czy gracz znajduje si? w poje?dzie jako kierowca...

local marker = createMarker(-2413.90601, -596.53442, 132.59091-1,"cylinder",2,0,255,0) 
  
addEventHandler("onClientMarkerHit",marker, 
    function ( player ) 
        if getElementType ( player ) == "player" then  
            local vehicle =  getPedOccupiedVehicle ( player ) 
             if not vehicle then return end 
              outputChatBox("test") -- gdy gracz si? znajduje to napis wy?wietla, a gdy si? wejdzie jako ped do markera, nie wyda komunikatu 
            end
        end)


Podpis
As-salamu alaykum
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-10, 16:30


Pawlo3D







Wiek: 31
Na forum: 3738 dni
Posty: 5
Nick w MP: xPawlo



Respekt: 50

Nie wiem czemu, ale kod kt?ry da?e? nie dzia?a. Nie pokazuje ?adnych b??d?w, marker si? tworzy, ale nic si? nie dzieje po wjechaniu pojazdem.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-10, 18:48


Ciastuuś

As-salamu alaykum






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

Piwa: 4304

Respekt: 640
Respekt: 640Respekt: 640

"Pawlo3D" napisał/a:

Nie wiem czemu, ale kod kt?ry da?e? nie dzia?a. Nie pokazuje ?adnych b??d?w, marker si? tworzy, ale nic si? nie dzieje po wjechaniu pojazdem.


Da?e? go po stronie clienta?

Podpis
As-salamu alaykum
Postaw piwo autorowi tego posta
 

 
Tagi: ispeddrivingvehicle
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » isPedDrivingVehicle 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