Jump to content

Ac130 camera bug PLS HELP!


Xwad

Recommended Posts

1 fast question. I edited the script becaouse i dont like the addcomandhandle so i changed to an event for OnVehicleEnter but it does not work:/ Becaouse i have a vehicle shop and there i can buy ac130 but i can only shoot when i create the ac130 with command:/

  
function createAc130(thePlayer, cmd) 
    local x,y,z = getElementPosition(thePlayer) 
    ac130 = createVehicle(592, x+10,y,z+2) 
    setElementData(ac130, "ac130", true) 
     
    gun = createObject(2985, 0, 0, 0) 
    attachElements(gun, ac130, -2, 0, 0, 0, 180, 0) 
    setElementData(ac130, "gun", gun) 
end 
addEventHandler("OnVehicleEnter", createAc130) 
  

Link to comment

try this one

function createAc130(thePlayer) 
    local model = getElementModel(source) 
        if model == 592 then -- Andromada    
        gun = createObject(2985, 0, 0, 0) 
        attachElements(gun, source, -2, 0, 0, 0, 180, 0) 
        setElementData(source, "ac130", true) 
        setElementData(source, "gun", gun) 
    end  
end 
addEventHandler("OnVehicleEnter", createAc130) 

Link to comment

nooo xD its working but i dont want it like this becaouse its not creating the ac130 with usable guns when i buy it its just will create when i enter that plane:/ I mean when i enter an andromada then it will spawn the ac130.

Link to comment
how can can i make that if i enter the andromada then i can use the guns? And no commands?

I already gave you the code try it :

function createAc130(thePlayer) 
    local model = getElementModel(source) 
        if model == 592 then -- Andromada    
        gun = createObject(2985, 0, 0, 0) 
        attachElements(gun, source, -2, 0, 0, 0, 180, 0) 
        setElementData(source, "ac130", true) 
        setElementData(source, "gun", gun) 
    end 
end 
addEventHandler("OnVehicleEnter",root,createAc130) 

Link to comment
function createAc130(thePlayer) 
    local model = getElementModel(source) 
    if model == 592 then -- Andromada   
        gun = createObject(2985, 0, 0, 0) 
        attachElements(gun, source, -2, 0, 0, 0, 180, 0) 
        setElementData(source, "ac130", true) 
        setElementData(source, "gun", gun) 
    end 
end 
addEventHandler("onVehicleEnter",root,createAc130) 

Link to comment

server

--------------------------- 
--(c) by MazzMan/Maxim 
--------------------------- 
  
setFarClipDistance(2000) 
setCloudsEnabled(false) 
function createMissel(cx, cy, cz, x, y, z, time, ammoType) 
    if(ammoType)then 
        if(ammoType ~= "small")then 
            missel = createObject(1636, cx, cy, cz-0.2) 
            moveObject(missel, time, x, y, z) 
        end 
        if(time >= 50)then 
            triggerClientEvent("onClientCreateEffect", getRootElement(), cx, cy, cz, x, y, z, ammoType, time) 
            setTimer(function() 
                if(ammoType == "small")then 
                    createExplosion(x, y, z, 12, client) 
                elseif(ammoType == "middle")then 
                    createExplosion(x, y, z, 2, client) 
                else 
                    createExplosion(x, y, z, 10, client) 
                end 
                if(ammoType ~= "small")then 
                    destroyElement(missel) 
                end 
            end, time, 1) 
        else 
            if(ammoType ~= "small")then 
                destroyElement(missel) 
            end 
        end 
    else 
        return false 
    end 
end 
addEvent("onAc130Shoot", true) 
addEventHandler("onAc130Shoot", getRootElement(), createMissel) 
  
function createAc130(thePlayer, cmd) 
    local x,y,z = getElementPosition(thePlayer) 
    ac130 = createVehicle(592, x+10,y,z+2) 
    setElementData(ac130, "ac130", true) 
     
    gun = createObject(2985, 0, 0, 0) 
    attachElements(gun, ac130, -2, 0, 0, 0, 180, 0) 
    setElementData(ac130, "gun", gun) 
end 
addCommandHandler("ac130", createAc130) 
  
addEventHandler ( "onVehicleEnter", root, 
    function ( player, seat ) 
        if ( getElementModel ( source ) == 592 ) then 
            setElementData ( source, "ac130", true ) 
            gun = createObject ( 2985, 0, 0, 0 ) 
            attachElements ( gun, source, -2, 0, 0, 0, 180, 0 ) 
            setElementData ( source, "gun", gun ) 
            triggerServerEvent ( player, "fromserver:enter", source, player, seat ) 
        end 
    end 
) 
  
  
addEvent("getPlayerSeat", true) 
addEventHandler("getPlayerSeat", getRootElement(), function (thePlayer) 
    local seat = getPedOccupiedVehicleSeat(thePlayer) 
    setElementData(thePlayer, "seat", seat) 
end) 

client

http://pastebin.com/hLZKgUhg

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