скрипты для мта



Mta lua

Автор Мда задал вопрос в разделе Другие языки и технологии

Как написать скрипт на Луа для МТА? Я сделал объекты, хочу их запустить как ресурс. и получил лучший ответ

Ответ от NAGIBATOR[гуру]
function payCheck(job, pay, vol) -- String, Base Pay, Volatility (vol*eco_points)
local bonus = 1
if self:IsPremium() then
bonus = 1.50
end
-- [[ NEW! Random bonuses for flourishing economies. if eco is above 30/50 (black line), there is a 1/60 chance to receive a bonus of anywhere between 1k-10k. 40 paychecks per hour, so on average this will happen every hour and a half.]]
if GetGlobalInt("Eco_points") >= 30 and self:Team() != CLASS_CITIZEN then
math.randomseed(os.time())
if math.random(60) == 21 then
local bonusPay = math.random(1000, 10000) * bonus
self:AddMoney(BANK, bonusPay)
self:Hint("The economy is booming! As a result your boss has given you a bonus of "..bonusPay)
end
end
-- paycheck function
if pay >= 1 then
self:AddMoney(BANK, math.Round(( (pay * bonus) + math.Round(GetGlobalInt("Eco_points") * vol) ))
self:Hint("You have received $"..math.Round(( (pay * bonus) + math.Round(GetGlobalInt("Eco_points") * vol) )).." for being "..job..". It has been sent to your bank account.")
end
-- failsafe in case any checks go below 0. dont want people losing money for working...
if pay <= 0 then
self:Hint("The economy is severely crippled and cannot afford to pay your wages.")
end
function PLAYER:PayWage()
if (not self:IsValid()) then return end
if (not self.Loaded) then return false end
-- MAX hourly for growing w/ prem ~55,000
if self:Team() == CLASS_CITIZEN then
payCheck("a Citizen", 60, 1) -- MAX hourly w/ prem 5,600 REALISTIC 4,480
elseif self:Team() == CLASS_POLICE then
payCheck("a Policeman", 350, 7) -- MAX hourly w/ prem 35,000 REALISTIC 26,800
elseif self:Team() == CLASS_MEDIC then
payCheck("a Medic", 325, 7) -- MAX hourly w/ prem 33,500 REALISTIC 26,800
elseif self:Team() == CLASS_FIREMAN then
payCheck("a Firefighter", 325, 7) -- MAX hourly w/ prem 33,500 REALISTIC 26,800
elseif self:Team() == CLASS_SWAT then
payCheck("a member of the Swat Team", 350, 7) -- MAX hourly w/ prem 35,000 REALISTIC 28,000
elseif self:Team() == CLASS_CHIEF then
payCheck("the Police Chief", 400, 8) -- MAX hourly w/ prem 40,000 REALISTIC 32,000
elseif self:Team() == CLASS_MAYOR then
payCheck("the Mayor of Evocity", 500, 9) -- MAX hourly w/ prem 48,000 REALISTIC 38,000
end
end

Ответ от 22 ответа[гуру]
Привет! Вот подборка тем с похожими вопросами и ответами на Ваш вопрос: Как написать скрипт на Луа для МТА? Я сделал объекты, хочу их запустить как ресурс.
 

Ответить на вопрос:

Имя*

E-mail:*

Текст ответа:*
Проверочный код(введите 22):*