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

Wysłany: 2017-03-05, 16:38


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

Witam, mam problem:

WARNING: test/server.lua:41: Bad argument @ 'isPedInVehicle' [Expected ped at argument 1, got vehicle] - taki b??d wyskakuje bo wjechaniu w marker, a kod;

server:



addEvent('GuiMech',true)

local MarkerMech = createMarker(0, 0, 10-0.9, "cylinder", 4, 255, 255, 255, 30)
local MarkerMech2 = createMarker(0, 0, 10-0.9,"cylinder", 4, 255, 255, 255, 30)

addEventHandler('onMarkerHit',MarkerMech,function(Player)
if not isPedInVehicle (Player) then
return
end
if isElementWithinMarker(Player,MarkerMech) then
triggerClientEvent(Player,"PokazGuiNaprawa",root)
triggerClientEvent(Player,"PokazButony",root)
showCursor(Player,true)
end
end)

function NaprawaPojazdu(source)
if isElementWithinMarker(source,MarkerMech) then
local Pojazd = getPedOccupiedVehicle(source)
local Nazwa = getVehicleName(Pojazd)
local Kasa = getPlayerMoney(source)
  if (Kasa > 51) then
  takePlayerMoney(source, 50)
  fixVehicle(Pojazd, true)
end
end
end
addEventHandler('GuiMech',root,NaprawaPojazdu)

addEventHandler('onMarkerHit',MarkerMech2,function(Player)
if not isPedInVehicle (Player) then
return
end
if isElementWithinMarker(Player,MarkerMech2) then
triggerClientEvent(Player,"PokazGuiNaprawa",root)
triggerClientEvent(Player,"PokazButony",root)
showCursor(Player,true)
end
end)

function NaprawaPojazdu2(source)
if isElementWithinMarker(source,MarkerMech2) then
local Pojazd = getPedOccupiedVehicle(source)
local Nazwa = getVehicleName(Pojazd)
local Kasa = getPlayerMoney(source)
  if (Kasa > 51) then
  takePlayerMoney(source, 50)
  fixVehicle(Pojazd, true)
end
end
end
addEventHandler('GuiMech',root,NaprawaPojazdu2)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-05, 17:11


_Haze

Peace Yo!






Wiek: 25
Na forum: 4325 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

Kalizman, argument 1 to nie player tylko element. Je?li wejdziesz w marker samochodem to samoch?d b?dzie elementem a nie gracz. Mo?esz zrobi? takiego ifa:
if getElementType(el) == "player" then


Postaw piwo autorowi tego posta
 

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