Diablomta Posted January 24, 2017 Share Posted January 24, 2017 (edited) Se puede colocar un vehiculo volador?... Quiero hacer que halla un vehiculo volador pero que no sea con ningun comando, solo cuando se suba y este listo empieze a arrancar y vuele. Quiero hacer que el vehiculo Bullet sea el vehiculo volador. gracias por su ayuda! Edited January 24, 2017 by Diablomta Link to comment
#Dv^ Posted January 24, 2017 Share Posted January 24, 2017 (edited) Usa SetWorldSpecialPropertyEnabled para que el vehículo, y el evento onClientVehicleEnter para cuando el jugador se suba al vehículo se inicie la función, y para comprobar el vehículo usa getElementModel Edited January 24, 2017 by #Dv^ Link to comment
Rose Posted January 24, 2017 Share Posted January 24, 2017 Prueba addEventHandler("onClientVehicleEnter", root, function(player) if player == getLocalPlayer() then local id = getElementModel(source) if id == 402 and not isWorldSpecialPropertyEnabled("aircars") then setWorldSpecialPropertyEnabled( "aircars", true ) end end end ) Link to comment
Diablomta Posted January 24, 2017 Author Share Posted January 24, 2017 (edited) tengo un problema, se me ponen a volar todos los vehiculos, no me sale ningun error en la consola ni en el debugscript :v ahora a cualquier vehiculo que me suba vuela! ayuda Edited January 24, 2017 by Diablomta Link to comment
Rose Posted January 24, 2017 Share Posted January 24, 2017 addEventHandler("onClientVehicleEnter", root, function(player) if player == getLocalPlayer() then local id = getElementModel(source) if id == 402 and not isWorldSpecialPropertyEnabled("aircars") then setWorldSpecialPropertyEnabled( "aircars", true ) end end end ) addEventHandler("onClientVehicleExit", root, function(player) if player == getLocalPlayer() then local id = getElementModel(source) if id == 402 and isWorldSpecialPropertyEnabled("aircars") then setWorldSpecialPropertyEnabled( "aircars", false ) end end end ) Link to comment
Diablomta Posted January 24, 2017 Author Share Posted January 24, 2017 em... sirvio pero solo cuando se baja con el "enter". no hay otro evento? de Destroy Vehicle algo asi? porque cuando se destruye el vehiculo por panel "P" los demas vehiculos quedan volando igual ? otro addEventHandler ? para cuando el vehiculo es destruido? Link to comment
Rose Posted January 24, 2017 Share Posted January 24, 2017 Si, usa onElementDestroy, mira el ejemplo de la wiki y intenta. Link to comment
Diablomta Posted January 24, 2017 Author Share Posted January 24, 2017 Algo asi? addEventHandler("onElementDestroy", getRootElement(), function () if getElementType(source) == "vehicle" then local nPassengers = getVehicleMaxPassengers(source) local id = getElementModel(source) for i=0,nPassengers-1 do local occupant = getVehicleOccupant(source, i) if occupant then if id == 506 and isWorldSpecialPropertyEnabled("aircars") then setWorldSpecialPropertyEnabled( "aircars", false ) outputChatBox("The vehicle that you were in has been destroyed by the script", occupant) end end end end Link to comment
#Dv^ Posted January 24, 2017 Share Posted January 24, 2017 (edited) Te faltó un end y cerrar el evento, pero el evento es sólo "server-side", tendrías que triggear addEventHandler("onElementDestroy", getRootElement(), function () if getElementType(source) == "vehicle" then local nPassengers = getVehicleMaxPassengers(source) local id = getElementModel(source) for i=0,nPassengers-1 do local occupant = getVehicleOccupant(source, i) if occupant then if id == 506 then --triggerClientEvent() outputChatBox("The vehicle that you were in has been destroyed by the script", occupant) end end end end end ) Edited January 24, 2017 by #Dv^ Link to comment
Diablomta Posted January 24, 2017 Author Share Posted January 24, 2017 (edited) si lo destruyo vuela igual :V creo que no se puede Edited January 24, 2017 by Diablomta Link to comment
#Dv^ Posted January 24, 2017 Share Posted January 24, 2017 (edited) Em sí, si se puede si haces el trigger cómo te lo dije anteriormente 15 minutes ago, #Dv^ said: Te faltó un end y cerrar el evento, pero el evento es sólo "server-side", tendrías que triggear addEventHandler("onElementDestroy", getRootElement(), function () if getElementType(source) == "vehicle" then local nPassengers = getVehicleMaxPassengers(source) local id = getElementModel(source) for i=0,nPassengers-1 do local occupant = getVehicleOccupant(source, i) if occupant then if id == 506 then --triggerClientEvent() outputChatBox("The vehicle that you were in has been destroyed by the script", occupant) end end end end end ) Edited January 24, 2017 by #Dv^ Link to comment
Diablomta Posted January 24, 2017 Author Share Posted January 24, 2017 aqui es donde no se mucho usar el triggerClientEvent :v Link to comment
#Dv^ Posted January 24, 2017 Share Posted January 24, 2017 (edited) Leé la Wiki y sabrás cómo se usa triggerClientEvent Quote https://wiki.multitheftauto.com/wiki/TriggerClientEvent Edited January 24, 2017 by #Dv^ Link to comment
Recommended Posts