Jump to content

NovaCrew

Members
  • Posts

    14
  • Joined

  • Last visited

Everything posted by NovaCrew

  1. Does anyone have a script that allows vehicle to swim when they drive into water?
  2. So I have an error that says Bad argument @ "getPedOccupiedVehicle" [Expected ped at argument 1, got nil] and I have no idea how to fix it. If someone could help me I would really appreciate it. local speed = 20 local buoyancy = 1.5 local drag = 1 function swimVehicle (vehicle, seat, jacked) local id = getPedOccupiedVehicle (vehicle) if id == 407 then local x, y, z = getElementPosition ( vehicle ) local level = getWaterLevel ( x, y, z ) if id == 407 and level and z < level then setElementData(vehicle, "buoyancy", 1.5) setElementData(vehicle, "vehicleDrag", 1) setElementData(vehicle, "centerOfMass", {0,0,-1}) setVehicleHandling(vehicle, "engineAcceleration", 20) else setElementData(vehicle, "buoyancy", 0) setElementData(vehicle, "vehicleDrag", 0) setVehicleHandling(vehicle, "engineAcceleration", 0) end end end addEventHandler("onClientRender", root, swimVehicle)
  3. well, I really don't know what to type there xd (it's that server-side script)
  4. Hello, I want to make a amphibious vehicle like for example AAV7. Is it possible to make a vehicle "swim" in mta? And if yes, then how to make it?
  5. So, I'm looking for a GPS that looks like the one from Arma, I saw it on some DayZ servers but I can't find it anywhere.
  6. Is there a way to attach a moving object to a vehicle? For example a ramp that will move up and/or down when you press a button.
  7. Hi, is it possible to add VTOL (just like the Hydra has) to any other aircraft? And if yes, how?
  8. Is creating a new custom tracks for trains possible and if yes, how to make them?
  9. Yes, the password and username are correct
  10. So, I wanted to connect my server with a database BUT: WARNING: DB2/sql.lua:16: Bad usage @ 'dbConnect' [Access denied for user '813466'@'%' to database '809080_'] WARNING: rpg_database/s_db.lua:33: Bad usage @ 'dbConnect' [Access denied for user '813466'@'%' to database '809080_'] And here are my setting: DBHandler=nil DBName="809080_" -- NAZWA BAZY DANYCH | WAŻNE DBUser="xxxx" -- LOGIN DO BAZY DANYCH | WAŻNE DBPass="xxxx" -- HASLO DO BAZY DANYCH | WAŻNE DBHost="sql.pukawka.pl" -- IP BAZY DANYCH | WAŻNE and SQL = dbConnect("mysql", "dbname=809080_;host=sql.pukawka.pl","herelogin","herepassword","share=1") This is my first time dealing with mysql so I don't know where i've made a mistake. Help would be very appreciated.
  11. I am making a WW2 server and I have one major problem. There's only 1 AK but i want to add multiple mods for it so every side has it's own gun (for example i want to replace AK with DP-28, MG-42 and BAR machine guns). Is this even possible, and if it is, how do I make it? I would really appreciate the help : )
  12. I have 3 errors: barierki/barierki.lua:4: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil] barierki/barierki.lua:5: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean] barierki/barierki.lua:6: attempt to concatenate local 'accName' (a boolean value) I've tried to fix it but it's still not working. How to fix this? Here's the code: barierki = {} addCommandHandler ( "barierka", function(plr) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Policja" ) ) then x,y,z = getElementPosition ( plr ) r1,r2,r3 = getElementRotation ( plr ) barierka = createObject ( 1459, x, y, z, r1, r2, r3 ) table.insert ( barierki, barierka ) end end ) addCommandHandler ( "busun", function(plr) local account = getPlayerAccount(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Policja" ) ) then for k,v in ipairs ( barierki ) do destroyElement ( v ) end end end )
  13. So there are two errors: WARNING: pozarynew/synced_fire.lua:2: Bad argument @ 'addEventHandler' [Expected function at argument 3, got nil] and ERROR: Client (USAR|Plk.NovaCrew) triggered serverside event doCreateFire, but event is not added serverside. I'm new so i'm not sure what to do. I've try to fix it on my on but i don't know how. What's wrong and how to fix it? This is server side: addEvent("fireExtinguished", true) addEventHandler("fireExtinguished", root, fireExtinguishedHandler) local fireModel = 2023 local fires = {} addEvent("onFireExtinguished",true) addEvent("onFireCreate",true) function createFire(x,y,z) local fireElem = createObject(fireModel,x,y,z) setElementCollisionsEnabled(fireElem,false) local col = createColSphere(x,y,z+1,2) fires[fireElem] = {fireElem,col} addEventHandler("onColShapeHit",col,setFire) return fireElem end function setFire(elem,dim) if not dim then return end if not elem or not isElement(elem) then return end if getElementType(elem) == "player" then setPedOnFire(elem,true) end end function fireExtinguished(fireElem) triggerEvent("onFireExtinguished",source,fireElem) destroyElement(fires[fireElem][1]) destroyElement(fires[fireElem][2]) fires[fireElem] = nil end and this is client side: addEvent("makeSmokeAppear",true) local fireModel = 2023 function applyFire() local fire = engineLoadDFF("fire.dff",2023) engineReplaceModel(fire,fireModel) end addEventHandler("onClientResourceStart",resourceRoot,applyFire) local allSmokes = { "smoke30lit", "smoke60lit", "smoke50m" } addEventHandler("makeSmokeAppear",root,function (obj) local x,y,z = getElementPosition(obj) for key, value in ipairs(allSmokes) do local effect = createEffect( value, x, y, z+0.5,0,0,0,500) setElementParent(effect,obj) end end) function createExtinguisher(wep,_,_,hitX,hitY,hitZ) if wep == 42 and math.random(1,5)==1 or wep == 24 and math.random(1,2)==1 then for k, v in ipairs(getElementsByType("object",resourceRoot)) do if getElementModel(v) == fireModel then local fX,fY,fZ = getElementPosition(v) local dist = getDistanceBetweenPoints2D(hitX,hitY,fX,fY) if wep == 42 and dist < 2 or wep == 24 and dist < 10 then triggerServerEvent("fireExtinguished",localPlayer,v) end end end end if wep == 37 and math.random(1,3)==1 then -- tworzymy ogien! triggerServerEvent("doCreateFire", root, hitX, hitY, hitZ, getElementDimension(localPlayer), getElementInterior(localPlayer)) end end addEventHandler("onClientPlayerWeaponFire",localPlayer,createExtinguisher) addEventHandler("onClientRender", root, function() local rootx,rooty,rootz=getCameraMatrix() for k,col in ipairs(getElementsByType("object",resourceRoot)) do if getElementModel(col) == fireModel then if not getElementData(col,"fire:Endvalue") then return end local x,y,z=getElementPosition(col) local sx,sy =getScreenFromWorldPosition(x, y, z+1) if sx and sy then local distance = getDistanceBetweenPoints3D(rootx,rooty,rootz,x,y,z) end end end end) local waterTick = getTickCount( ) addEventHandler("onClientRender",root,function () for key, value in ipairs(getElementsByType("vehicle")) do if getElementData(value,"waterpouring") then if (getTickCount( )-waterTick)>=500 then waterTick = getTickCount() local x,y,z = getElementPosition(value) local effect = createEffect( "watersplash",x,y,z-3) setTimer(function () destroyElement(effect) end, 500,1) end end end end) local watercost = 10 addEventHandler("onClientRender",root,function () if not getPedOccupiedVehicle( localPlayer ) then return end if isPedInVehicle( localPlayer ) and getElementModel(getPedOccupiedVehicle( localPlayer ))==512 then if button == "left" then if state == "down" then local plane = getPedOccupiedVehicle( localPlayer ) if getVehicleController( plane ) and getVehicleController( plane )==localPlayer then if getElementData(plane,"waterpouring") then local col = getElementData(plane,"watercol") for key, value in ipairs(getElementsWithinColShape( col,"colshape" )) do if getElementData(value,"fire") then if not getElementData(value,"ext") then setElementData(value,"ext") setTimer(function () triggerServerEvent("fireExtinguished",localPlayer,getElementParent(value)) end, 3000, 1 ) end end end end end end end end end) addEventHandler("onClientClick",root,function (button,state) if isPedInVehicle( localPlayer ) and getElementModel(getPedOccupiedVehicle( localPlayer ))==512 then if button == "left" then if state == "down" then local plane = getPedOccupiedVehicle( localPlayer ) if getVehicleController( plane ) and getVehicleController( plane )==localPlayer then if not getElementData(plane,"waterpouring") then if getElementData(plane,"waterlevel") >= 10 then setElementData(plane,"waterlevel",getElementData(plane,"waterlevel")-10) setElementData(plane,"waterpouring",true) setTimer(function () setElementData(plane,"waterpouring",false) end,4500,1 ) end end end end end end end) function enterTruck(veh,seat) if getElementModel(veh) ~= 407 or seat > 0 then return end if not rendering then addEventHandler("onClientRender",root,checkTurret) end end addEventHandler("onClientPlayerVehicleEnter",localPlayer,enterTruck) function exitTruck() if rendering then removeEventHandler("onClientRender",root,checkTurret) end end addEventHandler("onClientPlayerVehicleExit",localPlayer,exitTruck) addEventHandler("onClientPlayerWasted",localPlayer,exitTruck) function checkTurret() if not getControlState("vehicle_fire") and not getControlState("vehicle_secondary_fire") then return end local veh = getPedOccupiedVehicle(localPlayer) if not veh then return end local fX,fY,fZ = getElementPosition(veh) local turretPosX,turretPosY = getVehicleTurretPosition(veh) local turretPosX = math.deg(turretPosX) if turretPosX < 0 then turretPosX = turretPosX+360 end local rotX,rotY,rotZ = getVehicleRotation(veh) local turretPosX = turretPosX+rotZ-360 if turretPosX < 0 then turretPosX = turretPosX+360 end outputDebugString(fX.."x"..fY) local firetruckShape = createColSphere(fX,fY,fZ,20) local burningVehicles = getElementsWithinColShape(firetruckShape,"object") outputDebugString("elementow "..#burningVehicles) local burningVehicles=getElementsByType("object", resourceRoot, true) for k, v in pairs(burningVehicles) do local bX,bY,bZ = getElementPosition(v) if getDistanceBetweenPoints2D(bX,bY,fX, fY)<30 then local neededRot = findRotation(fX,fY,bX,bY) if turretPosX > neededRot-10 and turretPosX < neededRot+10 and math.random(1,5)==1 then triggerServerEvent("fireExtinguished",localPlayer,v) --setTimer break end end end destroyElement(firetruckShape) end function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t+360 end return t end
×
×
  • Create New...