Jump to content

attachPatriot BF69 mod


Guest kr0tchy

Recommended Posts

The BF69 mod there is a script like that that when you press it it R letter alights on the car (partiot) then and there is a weapon there in his hand.

Would get this little script over with to write somebody for me?

plz

I was able to take this out:

specialevents.lua:

function mountPatriot () 
    local target = getPlayerTarget ( getLocalPlayer() ) 
    if ( status == true ) then 
        status = false 
        triggerServerEvent ("detachPatriot", getLocalPlayer(), target) 
    else 
        if ( target ) then 
            if getElementType ( target ) == "vehicle" then 
                    triggerServerEvent ("attachPatriot", getLocalPlayer(), target) 
                    status = true 
            end 
        end 
    end 
end 
addEvent("mountPatriot", true) 
addEventHandler("mountPatriot", getLocalPlayer(), mountPatriot) 
  
addEventHandler("onClientPlayerWeaponFire", getLocalPlayer(), function (weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) 
    if weapon == 38 then 
        if miniLastShot > getTickCount() then 
            toggleControl ( "fire", false ) 
            setTimer (toggleControl, 800, 1, "fire", true ) 
        else 
            miniLastShot = getTickCount() + 800 
        end 
    end 
end) 

stuntplane.lua

root = getRootElement() 
  
function attachPatriot (target) 
    local status = getElementAttachedTo( target ) 
    if ( status ) then 
    else 
        if ( target ) then 
            if getElementType ( target ) == "vehicle" then 
                if getVehicleID(target) == 513 then 
                    attachElementToElement (source, target, 0, -2.1, 0.
                    giveWeapon (source, 38, 500, true) 
                elseif getVehicleID(target) == 455 then 
                    local driver = getVehicleController(target) 
                    if driver then 
                        setCameraTarget (source, driver) 
                        attachElementToElement (source, target, math.random(-0.9,0.9), math.random(-4, 0), 0.
                    else 
                        triggerClientEvent(source, "displayGUItext", source, 0.45, 0.3, "You need someone to drive!", "default-bold-small", 255, 255, 255, 3000) 
                    end 
                elseif getVehicleID(target) == 548 then 
                    local driver = getVehicleController(target) 
                    if driver then 
                        setCameraTarget (source, driver) 
                        attachElementToElement (source, target, math.random(-0.6, 0.6), math.random(-2, 3), -0.
                    else 
                        triggerClientEvent(source, "displayGUItext", source, 0.45, 0.3, "You need someone to drive!", "default-bold-small", 255, 255, 255, 3000) 
                    end 
                end 
            end 
        end 
    end 
  
end 
addEvent ("attachPatriot", true) 
addEventHandler ("attachPatriot", root, attachPatriot) 
  
function detachPatriot (target) 
    detachElementFromElement ( source ) 
    setCameraTarget (source, source) 
    takeWeapon (source, 38) 
    if ( skinID[source] == 4 ) then 
        giveWeapon ( source, 35, 20 ) 
    end 
end 
addEvent ("detachPatriot", true) 
addEventHandler ("detachPatriot", root, detachPatriot) 

meta.xml:

<meta> 
    <info author="Kr0tcHy" name="Stuntplane" version="1" type="script"/> 
    <script src="stuntplane.lua" type="server" /> 
    <script src="specialevents.lua" type="client" /> 
</meta> 

--------------------------------

Sorry, I do not speak in English :oops:

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...