Wysłany: 2018-03-09, 20:07
Pawlo3D
Wiek: 31 Na forum: 3597 dni Posty: 5
Nick w MP: xPawlo
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)
Wysłany: 2018-03-09, 21:33
Ciastuuś
Truck soon...
Wiek: 26 Na forum: 3071 dni Posty: 799
Nick w MP: Ciastuuś
Piwa : 4297
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"
Wysłany: 2018-03-10, 10:33
Pawlo3D
Wiek: 31 Na forum: 3597 dni Posty: 5
Nick w MP: xPawlo
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>
Wysłany: 2018-03-10, 15:34
Ciastuuś
Truck soon...
Wiek: 26 Na forum: 3071 dni Posty: 799
Nick w MP: Ciastuuś
Piwa : 4297
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 )
Wysłany: 2018-03-10, 16:30
Pawlo3D
Wiek: 31 Na forum: 3597 dni Posty: 5
Nick w MP: xPawlo
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.
Wysłany: 2018-03-10, 18:48
Ciastuuś
Truck soon...
Wiek: 26 Na forum: 3071 dni Posty: 799
Nick w MP: Ciastuuś
Piwa : 4297
"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?
Tagi: ispeddrivingvehicle
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: