noonbr Posted October 14, 2019 Share Posted October 14, 2019 Olá. Estou enfrentando um problema: mesmo que eu coloque local theVehicle = getPedOccupiedVehicle(player) aparece esse erro: 'getPedOccupiedVehicle' [expected ped at argument 1, got number '0']. local barraquinha = createMarker(1496.7198486328, -1668.0712890625, 13.2, "cylinder", 1.5, 255,0,0, 50) local etapa1 = createMarker(1480.9332275391,-1592.8000488281,13.3828125, "checkpoint", 0, 255,0,0, 40) local etapa2 = createMarker(1503.5780029297,-1592.3562011719,13.3828125, "checkpoint", 0, 255,0,0, 40) local etapa3 = createMarker(1524.7191162109,-1592.5400390625,13.3906097, "checkpoint", 0, 255,0,0, 40) local etapa4 = createMarker(1529.5085449219,-1631.9686279297,13.3828125, "checkpoint", 0, 255,0,0, 40) local etapa5 = createMarker(1529.6260986328,-1721.9729003906,13.3828125, "checkpoint", 0, 255,0,0, 40) function msg1( player ) outputChatBox("- PROMOÇÃO DE OUTUBRO!", player) outputChatBox("- Seja bem-vindo a barraquinha da CNH.", player) outputChatBox("- Digite /cnh para fazer a sua carteira por $ 25,00.", player) end addEventHandler("onMarkerHit", barraquinha, msg1) function CNH( player ) local ped = isPedInVehicle(player) local gM = getPlayerMoney(player) local x,y,z = getElementPosition(player) local spawnVeh = createVehicle(411, 0,0,0) if isElementWithinMarker(player, barraquinha) then if (ped == false ) then if (gM >= 25) then if getElementData(player, "cnh-carro") == false then takePlayerMoney(player, 25) outputChatBox("- Siga os marcadores para terminar sua prova.", player) setElementPosition(player, 1481.0557861328,-1601.6010742188,13.546875) spawnVehicle (spawnVeh, 1481.0557861328,-1601.6010742188,13.546875) warpPedIntoVehicle(player, spawnVeh) setMarkerSize(etapa1, 3) else outputChatBox("- Você já possui CNH.", player) end else outputChatBox("- Você não tem dinheiro suficiente para isso.", player) end else outputChatBox("- Você deve sair do veículo para fazer a CNH.", player) end else outputChatBox("- Você precisa estar no marcador para digitar esse comando.", player) end end addCommandHandler("cnh", CNH) function etapa1s( player ) setMarkerSize(etapa1, 0) setMarkerSize(etapa2, 3) end addEventHandler("onMarkerHit", etapa1, etapa1s) function etapa2s( player ) setMarkerSize(etapa2, 0) setMarkerSize(etapa3, 3) end addEventHandler("onMarkerHit", etapa2, etapa2s) function etapa3s( player ) setMarkerSize(etapa3, 0) setMarkerSize(etapa4, 3) end addEventHandler("onMarkerHit", etapa3, etapa3s) function etapa4s( player ) setMarkerSize(etapa4, 0) setMarkerSize(etapa5, 3) end addEventHandler("onMarkerHit", etapa4, etapa4s) function etapa5s( player, theVehicle ) destroyElement(etapa5) destroyElement(theVehicle) outputChatBox("- Parabéns, você concluiu o teste.", player) setElementData(player, "cnh-carro", true) setElementPosition(thePlayer, 1499.0535888672,-1678.1215820313,14.046875) end addEventHandler("onMarkerHit", etapa5, etapa5s) function sairVeh(vehicle, player) local vehicle = getPedOccupiedVehicle(player) if (vehicle == 411 ) then outputChatBox("- Você saiu do veículo e foi reprovado.") setElementPosition(player, 1481.0557861328,-1601.6010742188,13.546875) destroyElement(vehicle) end end addEventHandler("onPlayerVehicleExit", getRootElement(), sairVeh) function re( player ) removeElementData(player, "cnh-carro") end addCommandHandler("force", re) Selecionei uma imagem também sobre o erro: https://prnt.sc/pjaufb Link to comment
root. Posted October 14, 2019 Share Posted October 14, 2019 O primeiro argumento do evento onPlayerVehicleExit é o veículo e o terceiro, o jogador; portanto, se o jogador deixar um veículo, será o ocupante. Se você deseja condicionar o motorista, deve condicionar o argumento "assento". function sairVeh(vehicle, seat, jacked) if (getElementModel(vehicle) == 411 ) then outputChatBox("- Você saiu do veículo e foi reprovado.") setElementPosition(player, 1481.0557861328,-1601.6010742188,13.546875) destroyElement(vehicle) end end addEventHandler("onPlayerVehicleExit", getRootElement(), sairVeh) 1 Link to comment
Other Languages Moderators Lord Henry Posted October 15, 2019 Other Languages Moderators Share Posted October 15, 2019 function sairVeh (theVehicle) if (getElementModel (theVehicle) == 411) then outputChatBox ("- Você saiu do veículo e foi reprovado.", source) setElementPosition (source, 1481.06, -1601.6, 13.55) destroyElement (theVehicle) end end addEventHandler ("onPlayerVehicleExit", root, sairVeh) 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now