Szerző Téma: Frakció fizetés  (Megtekintve 991 alkalommal)

Frakció fizetés
« Dátum: 2016. Szeptember 01. - 14:00:11 »
0
Sziasztok! A problémám a Frakció fizetéssel lenne.
Zero mod.
 
c_payday:
function cPayDay(faction, pay, profit, interest, donatormoney, tax, incomeTax, vtax, ptax, rent, grossincome, kamat, kiszamol)
local sound = playSound(\"mission_accomplished.mp3\")
setSoundVolume(sound, 0.5)
outputChatBox(\"-------------------------- Fizetés --------------------------\", 255, 194, 14)
if (faction) then
if (pay + tax > 0) then
   outputChatBox(\"    Fizetésed: #00FF00\" .. pay+tax .. \"Ft\", 255, 194, 14, true)
end
end
if (profit > 0) then
outputChatBox(\"    Biznisz Profit: #00FF00\" .. profit .. \"Ft\", 255, 194, 14, true)
end
if (vtax > 0) then
outputChatBox(\"    Jármu adó: #FF0000\" .. vtax .. \"Ft\", 255, 194, 14, true)
end
if (ptax > 0) then
outputChatBox(\"    Ingatlan költségek: #FF0000\" .. ptax .. \"Ft\", 255, 194, 14, true )
end
if (rent > 0) then
outputChatBox(\"    Szállás bérlés: #FF0000\" .. rent .. \"Ft\", 255, 194, 14, true)
end
outputChatBox(\"------------------------------------------------------------------\", 255, 194, 14)
if (kamat == true) then
outputChatBox(\"  Kamat: 2%\",255, 194, 14, true)
outputChatBox(\"  Kamat: \".. kiszamol ..\" Ft\",255, 194, 14, true)
else
outputChatBox(\"  Kamat: 1%\",255, 194, 14, true)
outputChatBox(\"  Kamat: \".. kiszamol ..\" Ft\",255, 194, 14, true)
end
if (grossincome > 0) then
outputChatBox(\"  Bruttó jövedelem: #00FF00\" .. grossincome .. \"Ft\",255, 194, 14, true)
else
outputChatBox(\"  Bruttó jövedelem: #FF0000\" .. grossincome .. \"Ft\", 255, 194, 14, true)
end
if (rent == -1) then
outputChatBox(\"    Ki lettél rúgva a szálláshelyedrol. Nem tudtad kifizetni a számlákat.\", 255, 0, 0)
end
outputChatBox(\"------------------------------------------------------------------\", 255, 194, 14)
triggerEvent(\"updateWaves\", getLocalPlayer())
end
addEvent(\"cPayDay\", true)
addEventHandler(\"cPayDay\", getRootElement(), cPayDay)

 

s_payday:
local mysql = exports.mysql
local incomeTax = 0
local taxVehicles = {}
local vehicleCount = {}
local taxHouses = {}
local threads = { }
local threadTimer = nil
local govAmount = 0
local unemployedPay = 150
function payWage(player, pay, faction, tax)
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 = math.ceil(0.003 * bankmoney)
if (interest >  74999) then
interest = 75000
end
if interest ~= 0 then
mysql:query_free( \"INSERT INTO wiretransfers (`from`, `to`, `amount`, `reason`, `type`) VALUES (-57, \" .. getElementData(player, \"dbid\") .. \", \" .. interest .. \", \'BANKINTEREST\', 6)\" )
end
-- business money
local profit = getElementData(player, \"businessprofit\")
exports[\'anticheat-system\']: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
local dbid = tonumber(getElementData(player, \"dbid\"))
for key, value in ipairs(getElementsByType(\"interior\")) do
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, \" .. getElementData(player, \"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 .. \", \" .. getElementData(player, \"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 (\" .. getElementData(player, \"dbid\") .. \", -3, \" .. tax .. \", \'INCOMETAX\', 6)\" )
end
local vtax = taxVehicles[ getElementData(player, \"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 (\" .. getElementData(player, \"dbid\") .. \", -3, \" .. vtax .. \", \'VEHICLETAX\', 6)\" )
end
local ptax = taxHouses[ getElementData(player, \"dbid\") ] or 0
if ptax > 0 then
ptax = math.floor( ptax * 0.5 )
ptax = math.min( ptax, bankmoney )
bankmoney = bankmoney - ptax
governmentIncome = governmentIncome + ptax
mysql:query_free( \"INSERT INTO wiretransfers (`from`, `to`, `amount`, `reason`, `type`) VALUES (\" .. getElementData(player, \"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 (\" .. getElementData(player, \"dbid\") .. \", 0, \" .. rent .. \", \'HOUSERENT\', 6)\" )
end
end
-- save the bankmoney
exports[\'anticheat-system\']: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)
return governmentIncome
end
function payAllWages(timer)
if timer then
local mins = getRealTime().minute
local minutes = 60 - mins
if (minutes < 15) then
   minutes = minutes + 60
end
setTimer(payAllWages, 60000*minutes, 1, true)
end
loadWelfare( )
threads = { }
taxVehicles = {}
vehicleCount = {}
for _, veh in pairs(getElementsByType(\"vehicle\")) do
if isElement(veh) then
   local owner, faction = tonumber(getElementData(veh, \"owner\")) or 0, tonumber(getElementData(veh, \"faction\")) or 0
   if faction < 0 and owner > 0 then -- non-faction vehicles
      local tax = vehicleTaxes[getElementModel(veh)-399] or 25
      if tax > 0 then
         taxVehicles[owner] = ( taxVehicles[owner] or 0 ) + ( tax * 2 )
         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] + 75
         --end
      end
   end
end
end
-- count all player props
taxHouses = { }
for _, property in pairs( getElementsByType( \"interior\" ) ) do
local interiorStatus = getElementData(property, \"status\")
if interiorStatus[5] and interiorStatus[4] > 0 and interiorStatus[1] < 2 then
   -- businesses pay more
   local factor = 0.015
   if interiorStatus[1] == 1 then
      factor = 0.03
   end
   taxHouses[ interiorStatus[4] ] = ( taxHouses[ interiorStatus[4] ] or 0 ) + factor * interiorStatus[5]
end
end
-- Get some data
local players = exports.pool:getPoolElementsByType(\"player\")
govAmount = exports.global:getMoney(getTeamFromName(\"Önkormányzat\"))
incomeTax = exports.global:getIncomeTaxAmount()
-- Pay Check tooltip
if(getResourceFromName(\"tooltips-system\"))then
triggerClientEvent(\"tooltips:showHelp\", getRootElement(),12)
end
for _, value in ipairs(players) do
local co = coroutine.create(doPayDayPlayer)
coroutine.resume(co, value, true)
table.insert(threads, co)
end
threadTimer = setTimer(resumeThreads, 100, 0)
end
function resumeThreads()
local inFor = false
--outputDebugString(\"resumeThreadsCalled\")
for threadRow, threadValue in ipairs(threads) do
inFor = true
coroutine.resume(threadValue)
table.remove(threads,threadRow)
break
end
if not inFor then   
-- Store the government money
exports.global:setMoney(getTeamFromName(\"Önkormányzat\"), govAmount)
killTimer(threadTimer)
end
end
function doPayDayPlayer(value, hourly)
if hourly then
coroutine.yield()
end
--exports.global:sendMessageToAdmins(\"Payday: Processing thread for \" .. getPlayerName(value))
local sqlupdate = \"\"
local logged = getElementData(value, \"loggedin\")
local timeinserver = getElementData(value, \"timeinserver\")
local dbid = getElementData( value, \"dbid\" )
if (logged==1) and (timeinserver>=58) and (getPlayerIdleTime(value) < 600000) then
mysql:query_free( \"UPDATE characters SET jobcontract = jobcontract - 1 WHERE id = \" .. dbid .. \" AND jobcontract > 0\" )
local carLicense = getElementData(value, \"license.car\")         
if carLicense and carLicense < 0 then
   exports[\'anticheat-system\']:changeProtectedElementDataEx(value, \"license.car\", carLicense + 1, false)
   sqlupdate = sqlupdate .. \", car_license = car_license + 1\"
end
local gunLicense = getElementData(value, \"license.gun\")
if gunLicense and gunLicense < 0 then
   exports[\'anticheat-system\']:changeProtectedElementDataEx(value, \"license.gun\", gunLicense + 1, false)
   sqlupdate = sqlupdate .. \", gun_license = gun_license + 1\"
end
local playerFaction = getElementData(value, \"faction\")
if (playerFaction~=-1) then
   local theTeam = getPlayerTeam(value)
   local factionType = getElementData(theTeam, \"type\")
   if (factionType==2) or (factionType==3) or (factionType==4) or (factionType==5) or (factionType==6) then -- Factions with wages
      local wages = getElementData(theTeam,\"wages\")
      local factionRank = getElementData(value, \"factionrank\")
      local rankWage = tonumber( wages[factionRank] )
      local taxes = 0
      if not exports.global:takeMoney(theTeam, rankWage) then
         rankWage = -1
      else
         taxes = math.ceil( incomeTax * rankWage )
      end
      govAmount = govAmount + payWage( value, rankWage, true, taxes )
   else
      if unemployedPay >= govAmount then
         unemployedPay = -1
      end
      govAmount = govAmount + payWage( value, unemployedPay, false, 0 )
   end
else
   if unemployedPay >= govAmount then
      unemployedPay = -1
   end
   govAmount = govAmount + payWage( value, unemployedPay, false, 0 )
end
exports[\'anticheat-system\']:changeProtectedElementDataEx(value, \"timeinserver\", math.max(0, timeinserver-60), false, true)
local hoursplayed = getElementData(value, \"hoursplayed\") or 0
exports[\'anticheat-system\']:changeProtectedElementDataEx(value, \"hoursplayed\", hoursplayed+1, false, true)
mysql:query_free( \"UPDATE characters SET hoursplayed = hoursplayed + 1, bankmoney = \" .. getElementData( value, \"bankmoney\" ) .. sqlupdate .. \" WHERE id = \" .. dbid )
elseif (getPlayerIdleTime(value) > 600000) then
exports.global:sendMessageToAdmins(\"[Payday] \"..getPlayerName(value):gsub(\"_\", \" \")..\"\' nem kapta meg a fizetést, mert nem játszott 1 órát.\")
elseif (logged==1) and (timeinserver) and (timeinserver<60) then
outputChatBox(\"Nem játszottál eleget, hogy fizetést kapj! (Még \" .. 60-timeinserver .. \" perc.)\", value, 255, 0, 0)
end
end
function adminDoPayday(thePlayer)
local logged = getElementData(thePlayer, \"loggedin\")
if (logged==1) then
if (exports.global:isPlayerLeadAdmin(thePlayer)) then
   payAllWages(false)
end
end
end
addCommandHandler(\"dopayday\", adminDoPayday)
function adminDoPaydayOne(thePlayer, commandName, targetPlayerName)
local logged = getElementData(thePlayer, \"loggedin\")
if (logged==1) then
if (exports.global:isPlayerHeadAdmin(thePlayer)) then
   targetPlayer = exports.global:findPlayerByPartialNick(thePlayer, targetPlayerName)
   if targetPlayer then
      if getElementData(targetPlayer, \"loggedin\") == 1 then
         doPayDayPlayer(targetPlayer)
      else
         outputChatBox(\"Player is not logged in.\", showPlayer, 255, 0, 0)
         return
      end
   else
      outputChatBox(\"Fail.\", showPlayer, 255, 0, 0)
      return
   end
end
end
end
addCommandHandler(\"dopaydayone\", adminDoPaydayOne)
 
function loadWelfare( )
local result = mysql:query_fetch_assoc( \"SELECT value FROM settings WHERE name = \'welfare\'\" )
if result then
if not result.value then
   mysql:query_free( \"INSERT INTO settings (name, value) VALUES (\'welfare\', \" .. unemployedPay .. \")\" )
else
   unemployedPay = tonumber( result.value ) or 150
end
end
end
function startResource()
local mins = getRealTime().minute
local minutes = 60 - mins
setTimer(payAllWages, 60000*minutes, 1, true)
loadWelfare( )
end
addEventHandler(\"onResourceStart\", getResourceRootElement(), startResource)

Frakció fizetés
« Válasz #1 Dátum: 2016. Szeptember 01. - 20:29:56 »
0
Tulajdonképpen mi a gond vele?

Frakció fizetés
« Válasz #2 Dátum: 2016. Szeptember 02. - 12:33:50 »
0
Míg nem írod le a hiba jelenségét nem tudunk neked segíteni, a szerveren használj /debugscript 3 parancsot, így te is és mi is többet tudunk meg amely növeli annak esélyét hogy tudunk segíteni.

Frakció fizetés
« Válasz #3 Dátum: 2016. Szeptember 02. - 15:17:38 »
0
írnák és szívesen debugscript 3 at de nem tudok /registerezni azaz nem tudok debugscript 3 azni.....

Frakció fizetés
« Válasz #4 Dátum: 2016. Szeptember 02. - 15:30:10 »
0
acl ben engedélyezd

Frakció fizetés
« Válasz #5 Dátum: 2016. Szeptember 02. - 16:45:20 »
0
Majd megpróbálom de most nem jó az FTP a clansnal....

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal