Xwad Posted May 3, 2015 Author Posted May 3, 2015 Thanks now its working perfect!! Thanks for your help!!!!:DDD
Xwad Posted May 8, 2015 Author Posted May 8, 2015 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)
Walid Posted May 8, 2015 Posted May 8, 2015 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)
WhoAmI Posted May 8, 2015 Posted May 8, 2015 Use @Walid code but change addEventHandler("OnVehicleEnter", createAc130) to this addEventHandler("onVehicleEnter", root, createAc130)
Xwad Posted May 8, 2015 Author Posted May 8, 2015 nooo 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.
Xwad Posted May 9, 2015 Author Posted May 9, 2015 how can can i make that if i enter the andromada then i can use the guns? And no commands?
Walid Posted May 9, 2015 Posted May 9, 2015 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)
Xwad Posted May 9, 2015 Author Posted May 9, 2015 it dosent work:/ I cant use the guns when i enter the plane:(
WhoAmI Posted May 9, 2015 Posted May 9, 2015 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)
Walid Posted May 9, 2015 Posted May 9, 2015 it dosent work:/ I cant use the guns when i enter the plane:( replace "OnVehicleEnter" with "onVehicleEnter".
Xwad Posted May 10, 2015 Author Posted May 10, 2015 now if i buy the ac130 plane then i can only shoot if i write /fixAc130:/
WhoAmI Posted May 10, 2015 Posted May 10, 2015 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
Xwad Posted May 10, 2015 Author Posted May 10, 2015 its the same:/ Maybe the problem is becaouse when i buy the plane then the script warp me into the vehicle.
WhoAmI Posted May 10, 2015 Posted May 10, 2015 Yea, that's why it doesn't work. Player has to enter it.
Xwad Posted May 10, 2015 Author Posted May 10, 2015 and is there any event for that? for warping in vehicle?
Walid Posted May 10, 2015 Posted May 10, 2015 and is there any event for that? for warping in vehicle? No ,maybe you can use setTimer to check if the player is inside a plane.
Xwad Posted May 10, 2015 Author Posted May 10, 2015 Waait I have a good idea! Maybe set a bind for fixAc130 with space
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now