Flipi Posted August 17, 2013 Share Posted August 17, 2013 Hola necesito ayuda con mi script, no me funciona el flip.. function flip(thePlayer) local Vehiculo = getPedOccupiedVehicle(thePlayer) if Vehiculo then outputChatBox("#0080FFVehiculo volteado!",thePlayer, 0,128,255, true) flip(Vehiculo) playSoundFrontEnd ( thePlayer, 101 ) else outputChatBox("#0080FFNo tienes un vehiculo para voltearlo!",thePlayer, 0,128,255, true) end end addEventHandler("onPlayerJoin",root,function() bindKey(source,"3", "down", flip) end) function onStart() for id, players in ipairs(getElementsByType("player")) do bindKey(players ,"3", "down", flip) end end Link to comment
Castillo Posted August 17, 2013 Share Posted August 17, 2013 Eso es porque no tiene sentido, estas ejecutando la misma funcion que ejecuta a esa. Tenes que usar setElementRotation para voltearlo. Link to comment
Flipi Posted August 17, 2013 Author Share Posted August 17, 2013 Eso es porque no tiene sentido, estas ejecutando la misma funcion que ejecuta a esa.Tenes que usar setElementRotation para voltearlo. y como seria entonces?, que soy novato Link to comment
BorderLine Posted August 17, 2013 Share Posted August 17, 2013 function buyFlip(p) if (isPedInVehicle(p)) then local v = getPedOccupiedVehicle(p) local x, y, z = getElementRotation (v) setElementRotation (v, 0, 0, (x > 90 and x < 270) and (z + 180) or z) end end addCommandHandler("flip", buyFlip) hazte una idea con eso Link to comment
Flipi Posted August 17, 2013 Author Share Posted August 17, 2013 function buyFlip(p) if (isPedInVehicle(p)) then local v = getPedOccupiedVehicle(p) local x, y, z = getElementRotation (v) setElementRotation (v, 0, 0, (x > 90 and x < 270) and (z + 180) or z) end end addCommandHandler("flip", buyFlip) hazte una idea con eso funciona pero tira error un error en la parte de la linea 2 function flip(thePlayer) local Vehiculo = getPedOccupiedVehicle(thePlayer) if Vehiculo then outputChatBox("#0080FFVehiculo volteado!",thePlayer, 0,128,255, true) flip(Vehiculo) local x, y, z = getElementRotation (Vehiculo) setElementRotation (Vehiculo, 0, 0, (x > 90 and x < 270) and (z + 180) or z) playSoundFrontEnd ( thePlayer, 101 ) else outputChatBox("#0080FFNo tienes un vehiculo para voltearlo!",thePlayer, 0,128,255, true) end end addEventHandler("onPlayerJoin",root,function() bindKey(source,"3", "down", flip) end) function onStart() for id, players in ipairs(getElementsByType("player")) do bindKey(players ,"3", "down", flip) end end Link to comment
FraN-724 Posted August 17, 2013 Share Posted August 17, 2013 function flip(thePlayer) local Vehiculo = getPedOccupiedVehicle(thePlayer) if Vehiculo then local x, y, z = getElementRotation (Vehiculo) setElementRotation (Vehiculo, 0, 0, (x > 90 and x < 270) and (z + 180) or z) playSoundFrontEnd ( thePlayer, 101 ) outputChatBox("#0080FFVehiculo volteado!",thePlayer, 0,128,255, true) else outputChatBox("#0080FFNo tienes un vehiculo para voltearlo!",thePlayer, 0,128,255, true) end end addEventHandler("onPlayerJoin",root,function() bindKey(source,"3", "down", flip) end) function onStart() for id, players in ipairs(getElementsByType("player")) do bindKey(players ,"3", "down", flip) end end Link to comment
Flipi Posted August 17, 2013 Author Share Posted August 17, 2013 function flip(thePlayer) local Vehiculo = getPedOccupiedVehicle(thePlayer) if Vehiculo then local x, y, z = getElementRotation (Vehiculo) setElementRotation (Vehiculo, 0, 0, (x > 90 and x < 270) and (z + 180) or z) playSoundFrontEnd ( thePlayer, 101 ) outputChatBox("#0080FFVehiculo volteado!",thePlayer, 0,128,255, true) else outputChatBox("#0080FFNo tienes un vehiculo para voltearlo!",thePlayer, 0,128,255, true) end end addEventHandler("onPlayerJoin",root,function() bindKey(source,"3", "down", flip) end) function onStart() for id, players in ipairs(getElementsByType("player")) do bindKey(players ,"3", "down", flip) end end WOW! gracias!! ! Link to comment
Recommended Posts