Jump to content

Help me :( in my script pls.


Andres99907

Recommended Posts

I´m creating this script :) 

This script mimics the operation of the machine Gun of Valkyrie helicopter 

is this : 

restrictedTo = 488

 
 bindKey ( "o", "down",  function ( thePlayer, seat)
 local vehicle = getPedOccupiedVehicle ( localPlayer )
 if ( vehicle and getElementModel (vehicle)  == restrictedTo ) then
 x,y,z = getElementPosition(getLocalPlayer())
 if not createProjectile(getLocalPlayer(), 19, x, y, z - 5, 1, nil, nil, nil, nil, -1, -1, -1, 0) then
 end
 end
 end
 )

 

but only the passengers can use the mg , the driver cannot >:( 

can you help me? 

only the passenger can use the mg  but it's not like that.

Link to comment

So you want to restrict the command to passengers only? If so, here's the code:

 

bindKey ( "o", "down",  function ( thePlayer, seat)
    local vehicle = getPedOccupiedVehicle ( localPlayer )
    if ( vehicle and getElementModel (vehicle) == restrictedTo and getPedOccupiedVehicle (localPlayer) ~= 0) then -- seat 0 -> driver
    x,y,z = getElementPosition(getLocalPlayer())
    if not createProjectile(getLocalPlayer(), 19, x, y, z - 5, 1, nil, nil, nil, nil, -1, -1, -1, 0) then
        end
    end
end)

I changed line 3 so it checks if the player is not the driver. 

  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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