Jump to content

Patriot


Xperia

Recommended Posts

Posted

¿Que funciones necesitaria para poder hacer que un Patriot tenga un arma y cuando se suba un player al pulsar por ejemplo "CTRL" dispare?

Posted

puedes usar

createProjectile 
bindKey 
getPedOccupiedVehicle 

creas la function y la bindeas con CNTRL

EDIT: olvide el getPedOccupiedVehicle :P

Posted
puedes usar
createProjectile 
bindKey 
getPedOccupiedVehicle 

creas la function y la bindeas con CNTRL

EDIT: olvide el getPedOccupiedVehicle :P

Pero createProjectile no crea balas M4 o Minigun.

Posted

Ah no especificaste!

Que quieres exactamente que el jugador se suba atras de la patriot y dispare con la M4 o que el jugador entre al auto y dispare desde adentro?

Posted (edited)

Cuando el player este ya dentro del Patriot pueda disparar como si fuese la torreta un arma como la Minigun.

EDIT: Algo como

. Edited by Guest
Posted

No hasta donde puede funcionar, pero va mas o menos asi

function checkVehicles() 
    local v = getPedOccupiedVehicle(source) 
    if getElementModel(v) == 470 then 
        w = createWeapon ( "m4", 0, 0, 0 ) 
                attachElements ( w,v) 
                       if getKeyState ( "lctrl" ) then 
                         setWeaponState ( w, "firing") 
                       end 
    end 
end 
addEventHandler("onClientPlayerVehicleEnter",getRootElement(),checkVehicles) 

Posted
No hasta donde puede funcionar, pero va mas o menos asi
function checkVehicles() 
    local v = getPedOccupiedVehicle(source) 
    if getElementModel(v) == 470 then 
        w = createWeapon ( "m4", 0, 0, 0 ) 
                attachElements ( w,v) 
                       if getKeyState ( "lctrl" ) then 
                         setWeaponState ( w, "firing") 
                       end 
    end 
end 
addEventHandler("onClientPlayerVehicleEnter",getRootElement(),checkVehicles) 

Lo que pasa es que no para de disparar lol.

Posted
function checkVehicles() 
    local v = getPedOccupiedVehicle(source) 
    if ( getElementModel( v ) == 470 ) then 
        w = createWeapon ( "minigun", 0, 0, 0 ) 
        setWeaponAmmo( w, 99999999 ) 
        attachElements ( w, v, 0, 0, 1.38, 0, 30, 90) 
        if getKeyState ( "lctrl" ) == true then 
            setWeaponState ( w, "firing") 
        end 
    end 
end 
addEventHandler( "onClientPlayerVehicleEnter", getRootElement( ), checkVehicles ) 
bindKey("lctrl","both",checkVehicles) 

Asi no funciona, y sin el bindKey, solo funciona cuando matengo pulsado lctrl al entrar.

Posted
addEventHandler("onClientVehicleEnter", root,  
function() 
    if getElementModel( source ) == 470 ) then 
        w = createWeapon ( "minigun", 0, 0, 0 ) 
        setWeaponAmmo( w, 99999999 ) 
        attachElements ( w, v, 0, 0, 1.38, 0, 30, 90) 
    end 
end 
) 
  
function checkVehicles() 
    local v = getPedOccupiedVehicle(source) 
    if ( v and getElementModel( v ) == 470 ) then 
        setWeaponState ( w, "firing") 
    end 
end 
bindKey("lctrl","both",checkVehicles) 

Posted

Da error en attachElements

addEventHandler("onClientVehicleEnter", root, 
function() 
    if ( getElementModel( source ) == 470 ) then 
        w = createWeapon ( "minigun", 0, 0, 0 ) 
    end 
end 
) 
  
function checkVehicles() 
    local v = getPedOccupiedVehicle(source) 
    if ( v and getElementModel( v ) == 470 ) then 
        setWeaponState ( w, "firing") 
    end 
end 
bindKey("lctrl","both",checkVehicles) 
  
addEventHandler("onClientVehicleEnter",root, 
function() 
attachElements ( w, v, 0, 0, 1.38, 0, 30, 90) 
end 
) 

Si lo pongo como me diste, tambien me da error.

Posted

Prueba con eso

addEventHandler("onClientVehicleEnter", root, 
function(p) 
    if getElementModel( source ) == 470 ) then 
        w = createWeapon ( "minigun", 0, 0, 0 ) 
        setWeaponAmmo( w, 99999999 ) 
        attachElements ( w, source, 0, 0, 1.38, 0, 30, 90) 
    end 
end 
) 
  
function checkVehicles() 
    local v = getPedOccupiedVehicle(getLocalPlayer()) 
    if v and getElementModel( v ) == 470 then 
        setWeaponState ( w, "firing") 
    end 
end 
bindKey("lctrl","both",checkVehicles) 

Posted
Prueba con eso
addEventHandler("onClientVehicleEnter", root, 
function(p) 
    if getElementModel( source ) == 470 ) then 
        w = createWeapon ( "minigun", 0, 0, 0 ) 
        setWeaponAmmo( w, 99999999 ) 
        attachElements ( w, source, 0, 0, 1.38, 0, 30, 90) 
    end 
end 
) 
  
function checkVehicles() 
    local v = getPedOccupiedVehicle(getLocalPlayer()) 
    if v and getElementModel( v ) == 470 then 
        setWeaponState ( w, "firing") 
    end 
end 
bindKey("lctrl","both",checkVehicles) 

Le edite un par de cosas y me sirvio, gracias a todos por la ayuda.

Posted

Si te refieres a la rotacion, puedes usar esto ( No se si funcionara ):

addEventHandler("onClientRender", root, 
function() 
if isPedInVehicle(localPlayer) and isElement(w) then 
           local rotcam = math.rad (360 - getPedCameraRotation (localPlayer)) 
           local xpos,ypos,zpos = getPedBonePosition (localPlayer,8) 
           local xlook,ylook,zlook = xpos - 300*math.sin(rotcam), ypos + 300*math.cos(rotcam), zpos 
           setElementRotation( w, xlook,ylook,zlook ) 
end 
end 
) 

Posted

Unir al player al lugar de la torreta, y entrar como si fuera un sitio del "no-conductor", que cuando estes cerca, y pulses G, entres o te posiciones en la torreta y para salir igual.

Posted

Ya entiendo para donde va tu idea Xperia.

La Patriot de XGN tiene un espacio donde cabe un player, y hay una minigun.

Tu idea es que al entrar hay se active el script para disparar? cierto?

Creo que como dices biene bien un marker usando attachElements y que quede justo en ese espacio del vehiculo

Y que al entrar se active el Bind para disparar.

Posted
Ya entiendo para donde va tu idea Xperia.

La Patriot de XGN tiene un espacio donde cabe un player, y hay una minigun.

Tu idea es que al entrar hay se active el script para disparar? cierto?

Creo que como dices biene bien un marker usando attachElements y que quede justo en ese espacio del vehiculo

Y que al entrar se active el Bind para disparar.

Exacto, lo intentare con la informacion que me habeis dado y si algo falla, publico.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...