Jump to content

DzMG-LV

Members
  • Posts

    58
  • Joined

  • Last visited

Everything posted by DzMG-LV

  1. DzMG-LV

    Miner job.

    Hey, yea i have idea to make it bit different, work is in progress and if everything will work, i will post some screens
  2. DzMG-LV

    Miner job.

    Hey, today i watched SeeMTA video, their Miner job. Can you guys help me to create something similiar to this? What functions should i use?
  3. With shaders it's possible to create clothes to every character?
  4. DzMG-LV

    GTA V on MTA?

    Hey, i just want to ask if it's planned to create the GTA V on MTA?
  5. Thanks, works perfect.
  6. Hey, how to make if number is from -> to then Example: 3-5 then my code.
  7. Try this(Idk if it works): addEventHandler("onPlayerJoin", resourceRoot, function() loadFactions() for i,v in ipairs(getElementsByType("player")) do bindf1() setTimer(bindf1, 3500, 1) end end )
  8. Okey new problem, when i open that ramp it opens only for player who use's cmd /rampdown, only he can see when its open.
  9. Hmm nope it isnt that what i need. Heres my script: Client addEvent( "rampdown", true ) addEventHandler( "rampdown", localPlayer, function ( theVeh ) setTimer( function() theVeh = getPedOccupiedVehicle(localPlayer) x, y, z = getVehicleComponentPosition( theVeh, "boot_dummy") rx, ry, rz = getVehicleComponentRotation(theVeh, "boot_dummy" ) --setVehicleComponentPosition( theVeh, "boot_dummy", x, y, z+0.1 ) setVehicleComponentRotation(theVeh, "boot_dummy", rx-0.8, 0, 0 ) end, 50, 113) end ) Server: addCommandHandler("rampdown", function ( thePlayer ) if isPedInVehicle ( thePlayer ) then local veh = getPedOccupiedVehicle ( thePlayer ) for i, player in ipairs ( getElementsByType("player") ) do triggerClientEvent ( player, "rampdown", player, veh ) end end end )
  10. Okey but how can i make it, when i use cmd /rampdown it will moves with ramp in same position?
  11. Okey, i've see'n on SeeMTA when them have trucker job, when u can lift up/down truck's ramp. I've made when u can lift up/down ramp with cmd using setVehicleComponentVisible, setVehicleComponentPosition/Rotation, but that ramp, i can't stay on it, it's like a just texture. What would i need to do, to ramp is like object. Heres video:
  12. DzMG-LV

    Objects.

    Is it possible to make when if u drop object on vehicle, its stays there? Example: Flatbed and u have Object-Bed, when u drop it on flatbed it will stay there even u driving.
  13. [quote name=..&G:..] exports['anticheat-system']:changeProtectedElementDataEx(veh, "lights", 0, true) Seems like a Valhalla roleplay script And? Why i can't add new features to it? +its my local server not public.
  14. [quote name=..&G:..] Its not leaked, i used Dynamic_Lighting and Dynamic_Lighting_Vehicles.
  15. I can switch from Tilting down to tilting up, but i can't switch them off. thats my problem Tilting Down: Tilting Up: It needs work like this. First when u press L u have TIlting Down state, when u press again L u have Tilting Up state but when u press third time ur lights switches off, but i cant switch them off.
  16. So i made script when vehicle have headlight states 1-Tilting down 2-Tilting up 3-Off It switches from 1 to 2, but i can't switch them off (to 3) function toggleLights(source, key, keystate) local veh = getPedOccupiedVehicle(source) local inVehicle = getElementData(source, "realinvehicle") if (veh) and (inVehicle==1) then local model = getElementModel(veh) if not (lightlessVehicle[model]) then local lights = getVehicleOverrideLights(veh) local seat = getPedOccupiedVehicleSeat(source) if (seat==0) then if (lights~=3) then setVehicleOverrideLights(veh, 2) exports['anticheat-system']:changeProtectedElementDataEx(veh, "lights", 2, true) if (lights~=2) then setVehicleOverrideLights(veh, 2) exports['anticheat-system']:changeProtectedElementDataEx(veh, "lights", 1, true) if (lights~=1) then setVehicleOverrideLights(veh, 1) exports['anticheat-system']:changeProtectedElementDataEx(veh, "lights", 0, true) end end end end end end end addCommandHandler("lights", toggleLights, true) addEvent('togLightsVehicle', true) addEventHandler('togLightsVehicle', root, function() toggleLights(client) end)
  17. Okey, so i maked script when vehicle is locked all doors closes, but when i trigger it, it doesn't work. function closeAllDoor( playerSource ) local vehicle = getPedOccupiedVehicle ( playerSource ) if vehicle then for i=0,5 do setVehicleDoorOpenRatio ( vehicle, i, 0 - getVehicleDoorOpenRatio ( vehicle, i ), 100 ) end end end addEvent("closeAllDoor", true) addEventHandler( "closeAllDoor", getRootElement(), closeAllDoor ) Trigger: triggerServerEvent ( 'closeAllDoor', source, 'closeAllDoor' )
  18. Yes it could be good when if u have lights on then battery drains, but how to make the battery and when its drain.
  19. It is possible to make it like function example: getBatter() and u can add it to any resources so u can get easy battery level.
  20. So i have insurance script, if u are customer every payday u need to pay about insurance, insurance works fine, but it doesnt take money from player when its payday. Insurance: local function formatVehIds(table) local ids = "" for i, vehid in pairs(table) do ids = ids..ids..", " end return string.sub(ids, 1, string.len(ids)) -- remove 2 last characters from string ", " end function analyzeInsurance(data, playerId) -- edit in payday resource to pass playerId here too local totalFee = 0 local totalFeePerVehicles = {} local totalFeePerFactions = {} if data then for vehid, insurance in pairs(data) do for iFaction, fee in pairs(insurance) do if not totalFeePerVehicles[vehid] then totalFeePerVehicles[vehid] = {} end if not totalFeePerVehicles[vehid]['ifaction'] then totalFeePerVehicles[vehid]['ifaction'] = iFaction end if not totalFeePerVehicles[vehid]['fee'] then totalFeePerVehicles[vehid]['fee'] = 0 end totalFeePerVehicles[vehid]['fee'] = totalFeePerVehicles[vehid]['fee'] + fee if not datatable[vehid]['cashout'] then datatable[vehid]['cashout'] = 0 end datatable[vehid]['cashout'] = datatable[vehid]['cashout'] + fee if not totalFeePerFactions[iFaction] then totalFeePerFactions[iFaction] = {} end if not totalFeePerFactions[iFaction]['fee'] then totalFeePerFactions[iFaction]['fee'] = 0 end if not totalFeePerFactions[iFaction]['vehs'] then totalFeePerFactions[iFaction]['vehs'] = {} end totalFeePerFactions[iFaction]['fee'] = totalFeePerFactions[iFaction]['fee'] + fee table.insert(totalFeePerFactions[iFaction]['vehs'], vehid) totalFee = totalFee + fee end end end for factionId, data in pairs(totalFeePerFactions) do local theInsurer = exports.pool:getElement("team", factionId) if exports.bank:giveBankMoney(theInsurer, data.fee) then exports.bank:addBankTransactionLog(playerId, -getElementData(theInsurer, "id") , data.fee, 2, "Insurance fee for vehicles with VINS: "..formatVehIds(data.vehs) ) end end return totalFee, totalFeePerVehicles, totalFeePerFactions end Payday: local mysql = exports.mysql local incomeTax = 0 local taxVehicles = {} local insuranceVehicles = {} local vehicleCount = {} local taxHouses = {} local threads = { } local threadTimer = nil local govAmount = 10000000 local unemployedPay = 200 function payWage(player, pay, faction, tax) local dbid = tonumber(getElementData(player, "dbid")) local governmentIncome = 0 local bankmoney = getElementData(player, "bankmoney") local noWage = pay == 0 local donatormoney = 0 local startmoney = bankmoney if (exports.donators:hasPlayerPerk(player, 4)) then donatormoney = donatormoney + 25 end if (exports.donators:hasPlayerPerk(player, 5)) then donatormoney = donatormoney + 75 end local interest = 0 local cP = 0 if bankmoney > 0 then interest = math.min(5000, math.floor(3 * math.sqrt(bankmoney))) cP = interest / bankmoney * 100 end if interest ~= 0 then mysql:query_free( "INSERT INTO wiretransfers (`from`, `to`, `amount`, `reason`, `type`) VALUES (-57, " .. dbid .. ", " .. interest .. ", 'BANKINTEREST', 6)" ) end -- business money local profit = getElementData(player, "businessprofit") exports.anticheat:changeProtectedElementDataEx(player, "businessprofit", 0, false) bankmoney = bankmoney + math.max( 0, pay ) + interest + profit + donatormoney -- rentable houses local rent = 0 local rented = nil -- store id in here for key, value in ipairs(getElementsByType("interior")) do -- Who the hell made this bullsit lol / MAXIME local interiorStatus = getElementData(value, "status") local owner = tonumber( interiorStatus[4] ) if (owner) and (owner == dbid) and (getElementData(value, "status")) and (tonumber(interiorStatus[1]) == 3) and (tonumber(interiorStatus[5]) > 0) then rent = rent + tonumber(interiorStatus[5]) rented = tonumber(getElementData(value, "dbid")) end end if not faction then if bankmoney > 25000 then noWage = true pay = 0 elseif pay > 0 then governmentIncome = governmentIncome - pay mysql:query_free( "INSERT INTO wiretransfers (`from`, `to`, `amount`, `reason`, `type`) VALUES (-3, " .. dbid .. ", " .. pay .. ", 'STATEBENEFITS', 6)" ) else pay = 0 end else if pay > 0 then local teamid = getElementData(player, "faction") if teamid <= 0 then teamid = 0 else teamid = -teamid end mysql:query_free( "INSERT INTO wiretransfers (`from`, `to`, `amount`, `reason`, `type`) VALUES (" .. teamid .. ", " .. dbid .. ", " .. pay .. ", 'WAGE', 6)" ) else pay = 0 end end if tax > 0 then pay = pay - tax bankmoney = bankmoney - tax governmentIncome = governmentIncome + tax mysql:query_free( "INSERT INTO wiretransfers (`from`, `to`, `amount`, `reason`, `type`) VALUES (" .. dbid .. ", -3, " .. tax .. ", 'INCOMETAX', 6)" ) end local vtax = taxVehicles[ dbid ] or 0 if vtax > 0 then vtax = math.min( vtax, bankmoney ) bankmoney = bankmoney - vtax governmentIncome = governmentIncome + vtax mysql:query_free( "INSERT INTO wiretransfers (`from`, `to`, `amount`, `reason`, `type`) VALUES (" .. dbid .. ", -3, " .. vtax .. ", 'VEHICLETAX', 6)" ) end --vehicle insurance local totalInsFee, totalInsFeePerVehicles, totalInsFeePerFactions = 0, {}, {} if exports.global:isResourceRunning("insurance") and exports.global:isResourceRunning("factions") then --outputDebugString("Payday insurance running") totalInsFee, totalInsFeePerVehicles, totalInsFeePerFactions = exports.insurance:analyzeInsurance(insuranceVehicles[ dbid ], getElementData(player, "dbid")) if totalInsFee > 0 then if bankmoney >= totalInsFee then bankmoney = bankmoney - totalInsFee for factionId, data in pairs(totalInsFeePerFactions) do if data.fee > 0 then local theFaction = exports.factions:getTeamFromFactionID(factionId) if exports.bank:giveBankMoney(theFaction, data.fee) then exports.bank:addBankTransactionLog(dbid, -factionId, data.fee, 2, "Insurance fees for "..(#(data.vehs)).." vehicles.") end end end else if exports.global:isResourceRunning("announcement") then local customerName = getPlayerName(player):gsub("_", " ") for factionId, data in pairs(totalInsFeePerFactions) do local details = 'List of insuranced vehicles from customer '..customerName..":\n\n" for i, vehid in pairs(data.vehs) do details = details..'Vehicle VIN #'..vehid.."\n" end details = details.."\nTotal: $"..exports.global:formatMoney(data.fee) exports.factions:sendNotiToAllFactionMembers(factionId, customerName.." has failed to pay his total insurance fees of $"..exports.global:formatMoney(data.fee).." over his "..(#(data.vehs)).." vehicles.", details) end end end end end local ptax = taxHouses[ dbid ] or 0 if ptax > 0 then ptax = math.floor( ptax ) ptax = math.min( ptax, bankmoney ) bankmoney = bankmoney - ptax governmentIncome = governmentIncome + ptax mysql:query_free( "INSERT INTO wiretransfers (`from`, `to`, `amount`, `reason`, `type`) VALUES (" .. dbid .. ", -3, " .. ptax .. ", 'PROPERTYTAX', 6)" ) end if (rent > 0) then if (rent > bankmoney) then rent = -1 call( getResourceFromName( "interior-system" ), "publicSellProperty", player, rented, false, true ) else bankmoney = bankmoney - rent mysql:query_free( "INSERT INTO wiretransfers (`from`, `to`, `amount`, `reason`, `type`) VALUES (" .. dbid .. ", 0, " .. rent .. ", 'HOUSERENT', 6)" ) end end -- save the bankmoney exports.anticheat:changeProtectedElementDataEx(player, "bankmoney", bankmoney, true) -- let the client tell them the (bad) news local grossincome = pay+profit+interest+donatormoney-rent-vtax-ptax triggerClientEvent(player, "cPayDay", player, faction, noWage and -1 or pay, profit, interest, donatormoney, tax, incomeTax, vtax, ptax, rent, grossincome, cP) return governmentIncome end function payAllWages(isForcePayday) if not isForcePayday then local mins = getRealTime().minute local minutes = 60 - mins if (minutes < 15) then minutes = minutes + 60 end setTimer(payAllWages, 60000*minutes, 1, false) end loadWelfare( ) threads = { } taxVehicles = {} vehicleCount = {} insuranceVehicles = {} for _, veh in pairs(getElementsByType("vehicle")) do if isElement(veh) then local owner, faction, registered = tonumber(getElementData(veh, "owner")) or 0, tonumber(getElementData(veh, "faction")) or 0, tonumber(getElementData(veh, "registered")) or 0 local vehid = getElementData(veh, "dbid") or 0 if vehid >0 and faction <= 0 and owner > 0 then -- Vehicle inactivity scanner / MAXIME / 2015.1.11 local deletedByScanner = nil local active, reason = exports['vehicle-system']:isActive(veh) if not active and not exports['vehicle-system']:isProtected(veh) then local name = exports.global:getVehicleName(veh) if exports['vehicle-manager']:systemDeleteVehicle(vehid, "Deleted by Inactivity Scanner. Reason: "..reason) then local account = exports.cache:getAccountFromCharacterId(owner) or {id = 0, username="No-one"} local characterName = exports.cache:getCharacterNameFromID(owner) or "No-one" if owner > 0 and account then exports.announcement:makePlayerNotification(account.id, "Vehicle ID #"..vehid.." ("..name..") was taken away from "..characterName.."'s possession by the vehicle inactivity scanner.", "Reason: "..reason..". Your vehicle was marked as inactive because your character hasn't been logged in game for longer than 30 days or no body has ever started its engine for longer than 14 days while parking outdoor. \n\nAn inactive vehicle is a waste of resources and thus far the vehicle's ownership was removed or stripped from your possession to give other players opportunities to buy and use it more efficiently.\n\nThis vehicle wasn't unprotected. To prevent this to happen again to other vehicles of yours, you may want to spend your GC(s) to protect it from the inactive vehicle scanner on UCP.") end exports.global:sendMessageToAdmins("[VEHICLE] Vehicle ID #"..vehid.." ("..name..", owner: "..characterName.." - "..account.username..") has been deleted by the vehicle inactivity scanner. "..reason) deletedByScanner = true end end if registered == 1 and not deletedByScanner then --Taxes local tax = tonumber(getElementData(veh, "carshop:taxcost")) or 25 if tax > 0 then taxVehicles[owner] = ( taxVehicles[owner] or 0 ) + ( tax * 1 ) --[[vehicleCount[owner] = ( vehicleCount[owner] or 0 ) + 1 if vehicleCount[owner] > 3 then -- $75 for having too much vehicles, per vehicle more than 3 taxVehicles[owner] = taxVehicles[owner] + 50 end]] end --Insurance if exports.global:isResourceRunning("insurance") then local insuranceFee = getElementData(veh, "insurance:fee") or 0 insurancefee = tonumber(insurancefee) local insuranceFaction = getElementData(veh, "insurance:faction") or 0 insuranceFaction = tonumber(insuranceFaction) if insuranceFee > 0 and insuranceFaction > 0 then if not insuranceVehicles[owner] then insuranceVehicles[owner] = {} end if not insuranceVehicles[owner][vehid] then insuranceVehicles[owner][vehid] = {} end if not insuranceVehicles[owner][vehid][insuranceFaction] then insuranceVehicles[owner][vehid][insuranceFaction] = 0 end insuranceVehicles[owner][vehid][insuranceFaction] = insuranceVehicles[owner][vehid][insuranceFaction] + insuranceFee end end end end end end -- count all player props taxHouses = { } for _, property in pairs( getElementsByType( "interior" ) ) do local interiorStatus = getElementData(property, "status") local cost = tonumber(interiorStatus[5]) or 0 local owner = tonumber(interiorStatus[4]) or 0 local type = tonumber(interiorStatus[1]) local intid = getElementData(property, "dbid") local name = getElementData(property, "name") if cost > 0 and owner > 0 and type < 2 then -- MAXIME local propertyTax = getPropertyTaxRate(interiorStatus[1]) taxHouses[ interiorStatus[4] ] = ( taxHouses[ interiorStatus[4] ] or 0 ) + propertyTax * interiorStatus[5] end -- Interior inactivity scanner / MAXIME / 2015.1.11 local active, reason = exports['interior-system']:isActive(property) if not active and not exports['interior-system']:isProtected(property) then if exports['interior-system']:unownProperty(intid, "Forcesold by Inactivity Scanner. Reason: "..reason) then local account = exports.cache:getAccountFromCharacterId(owner) or {id = 0, username="No-one"} local characterName = exports.cache:getCharacterNameFromID(owner) or "No-one" if owner > 0 and account then exports.announcement:makePlayerNotification(account.id, "Interior ID #"..intid.." ("..name..") was taken away from "..characterName.."'s possession by the interior inactivity scanner.", "Reason: "..reason..". Your interior was marked as inactive because no body has ever entered it for the last 14 days or your character(who owns it) hasn't been logged in game for 30 days.\n\nAn inactive interior is a waste of resources and thus far the interior's ownership was stripped from your possession to give other players opportunities to buy and use it more efficiently.\n\nThis interior wasn't unprotected. To prevent this to happen again to other interiors of yours, you may want to spend your GC(s) to protect it from the inactive interior scanner on UCP.") end exports.
  21. So i would like to make vehicle engine battery for my Roleplay server, when u drive its drowns, when its empty u need to buy new one. What would i need to use or maybe someone can make small start for script? When u buy/spawn car its 100%, when its 0% car won't start and headlights too, then u need go to store and buy new acumulator.
×
×
  • Create New...