Flipi Posted August 15, 2013 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]
Daniel1zD Posted August 15, 2013 Posted August 15, 2013 Puedes usar esto getPedOccupiedVehicle fixVehicle outputChatBox bindKey
manawydan Posted August 15, 2013 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)
Flipi Posted August 16, 2013 Author 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?
Danii Posted August 16, 2013 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
MTA Team 0xCiBeR Posted August 16, 2013 MTA Team Posted August 16, 2013 Puedes usar playSoundFrontEnd o un Trigger con: triggerClientEvent --Y playSound Saludos!.
Flipi Posted August 16, 2013 Author 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!
Brad96 Posted September 4, 2013 Posted September 4, 2013 Porque usa onPlayerSpawn ? y porque solo funciona con ello ?
Atouk Posted September 5, 2013 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..
Recommended Posts