Flipi Posted August 15, 2013 Share Posted August 15, 2013 Hola, quisiera saber como hacer un script que con la función bindKey pueda bindear una letra y reparar un vehiculo, donde tenga un OutputChatBox que indique cuando repare el vehiculo, tambien cuando no esta en el vehiculo un OutputChatBox indique que necesita un vehiculo para reparar.. Ojala me ayuden porfa D:!! [soy novato u.u] Link to comment
Daniel1zD Posted August 15, 2013 Share Posted August 15, 2013 Puedes usar esto getPedOccupiedVehicle fixVehicle outputChatBox bindKey Link to comment
manawydan Posted August 15, 2013 Share Posted August 15, 2013 try function Reparar(thePlayer) local Veiculo = getPedOccupiedVehicle(thePlayer) if Veiculo then outputChatBox("lol Reparado",thePlayer) fixVehicle(Veiculo) else outputChatBox("no tienes car",thePlayer) end end function BindSpawn() bindKey(source,"k","down",Reparar) -- k bind end addEventHandler("onPlayerSpawn",getRootElement(),BindSpawn) Link to comment
Flipi Posted August 16, 2013 Author Share Posted August 16, 2013 try function Reparar(thePlayer) local Veiculo = getPedOccupiedVehicle(thePlayer) if Veiculo then outputChatBox("lol Reparado",thePlayer) fixVehicle(Veiculo) else outputChatBox("no tienes car",thePlayer) end end function BindSpawn() bindKey(source,"k","down",Reparar) -- k bind end addEventHandler("onPlayerSpawn",getRootElement(),BindSpawn) Sirvió Gracias !, una consulta, como puedo hacer para agregarle un sonido de repair al momento de reparar el vehiculo? Link to comment
Danii Posted August 16, 2013 Share Posted August 16, 2013 function Reparar(thePlayer) local Veiculo = getPedOccupiedVehicle(thePlayer) if Veiculo then outputChatBox("Vehículo reparado.",thePlayer) fixVehicle(Veiculo) playSoundFrontEnd ( thePlayer, 46 ) else outputChatBox("No tienes un vehículo.",thePlayer) end end addEventHandler("onPlayerJoin",root,function() bindKey(source,"k", "down", Reparar) end) function onStart() for id, players in ipairs(getElementsByType("player")) do bindKey(players ,"k", "down", Reparar) end end Link to comment
MTA Team 0xCiBeR Posted August 16, 2013 MTA Team Share Posted August 16, 2013 Puedes usar playSoundFrontEnd o un Trigger con: triggerClientEvent --Y playSound Saludos!. Link to comment
Flipi Posted August 16, 2013 Author Share Posted August 16, 2013 function Reparar(thePlayer) local Veiculo = getPedOccupiedVehicle(thePlayer) if Veiculo then outputChatBox("Vehículo reparado.",thePlayer) fixVehicle(Veiculo) playSoundFrontEnd ( thePlayer, 46 ) else outputChatBox("No tienes un vehículo.",thePlayer) end end addEventHandler("onPlayerJoin",root,function() bindKey(source,"k", "down", Reparar) end) function onStart() for id, players in ipairs(getElementsByType("player")) do bindKey(players ,"k", "down", Reparar) end end WOW!! gracias ! quedo perfecto! Link to comment
Brad96 Posted September 4, 2013 Share Posted September 4, 2013 Porque usa onPlayerSpawn ? y porque solo funciona con ello ? Link to comment
Atouk Posted September 5, 2013 Share Posted September 5, 2013 Porque lo que hace es que cuando spawne bindea esa tecla... Cumple lo mismo que onPlayerJoin, nadamas que la bindea cuando entra.. Link to comment
Recommended Posts