Сейчас на сайте
Всего онлайн: 545
16
250
279
Пользователи онлайнВсе (16)
Смотрит публикацию
только что
Смотрит публикацию
1 мин
Смотрит публикацию
3 мин
Смотрит публикацию
3 мин
Смотрит раздел
5 мин
Показать всех онлайн

NRP realdamage

Описание

При ударе машина разбивается ,чтоб починить только через команду


---настройки---

local cenapochinki = 0 --цена полной починки авто командой /repveh
local commandn = "repair" --команда, чтобы полностью починить машину
local commandn2 = "belt" --команда, чтобы пристегнуть/отстегнуть ремень безопасности
local shp = 20 --сколько ед.здоровья снимается у игрока при сильном и самом сильном ударах
local shp2 = 100 --Потерянное здоровье авто / shp2 = число Н. При любом ударе: Здоровье игрока - число Н
local bolshechem1 = 100 --Если потерянное здоровье авто больше Этого числа, трескается лобовое стекло
local bolshechem2 = 150 --Если потерянное здоровье авто больше Этого числа, отлетает передний бампер
local bolshechem3 = 200 --Если потерянное здоровье авто больше Этого числа, машина глохнет, открывается...
local bolshechem4 = 250 --Если потерянное здоровье авто больше Этого числа, у машины отлетает колесо...
local bolshechem5 = 300 --Если потерянное здоровье авто больше Этого числа, возможно у машины отлетает 2-е колесо...
local mes1 = "Удар был сильный, машина заглохла, открылась, вы пострадали"
local mes2 = "Удар был сильный, машина заглохла, открылась, вы НЕ пострадали"
local mes3 = "Удар был еще сильнее. У автомобиля отлетело колесо"
local mes33 = "Самый сильный удар. Возможно, у автомобиля отлетело второе колесо"
local mes4 = "Автомобиль починен."
local mes5 = "Вы должны находиться в тс"
local mes6 = "Недостаточно средств. Не хватает $"
local mes7 = "* Ремень безопасности пристегнут"
local mes8 = "* Ремень безопасности отстегнут"
local mes9 = "* Ремень безопасности не был пристегнут"

---переменные ниже не изменять---

local remenPristegnut = "false"

---когда игрок сел в авто---

function onenter1()
if source == localPlayer then
remenPristegnut = "false"
outputChatBox(mes9,255,255,255,true)
end
end
addEventHandler("onClientPlayerVehicleEnter",getRootElement(),onenter1)

---когда игрок вышел из авто---

function onexit1()
if source == localPlayer then
remenPristegnut = "false"
outputChatBox(mes8,255,255,255,true)
end
end
addEventHandler("onClientPlayerVehicleExit",getRootElement(),onexit1)

---если машина повреждается---

function damage1(attacker, weapon, loss, x0, y0, z0, tyre)
local theVeh = getPedOccupiedVehicle(localPlayer)
local getComponent = getVehicleComponents(theVeh)
if (source == theVeh) then
for k in pairs (getComponent) do
local x, y, z = getVehicleComponentPosition(theVeh, k)
local rx, ry, rz = getVehicleComponentRotation(theVeh, k)
local rand1 = math.random(0,3)
if rand1 == 0 then
setVehicleComponentPosition(theVeh, k, x-(loss/12000), y-(loss/10000), z-(loss/8000))
setVehicleComponentRotation(theVeh, k, rx-(loss/80), ry-(loss/100), rz-(loss/140))
elseif rand1 == 1 then
setVehicleComponentPosition(theVeh, k, x+(loss/12000), y+(loss/10000), z+(loss/8000))
setVehicleComponentRotation(theVeh, k, rx-(loss/80), ry-(loss/100), rz-(loss/140))
elseif rand1 == 2 then
setVehicleComponentPosition(theVeh, k, x-(loss/12000), y-(loss/10000), z-(loss/8000))
setVehicleComponentRotation(theVeh, k, rx+(loss/80), ry+(loss/100), rz+(loss/140))
elseif rand1 == 3 then
setVehicleComponentPosition(theVeh, k, x+(loss/12000), y+(loss/10000), z+(loss/8000))
setVehicleComponentRotation(theVeh, k, rx+(loss/80), ry+(loss/100), rz+(loss/140))
end
end
end
if loss >= bolshechem1 then
setVehicleComponentVisible(theVeh, "windscreen_dummy", false)
end
if loss >= bolshechem2 then
setVehicleComponentVisible(theVeh, "bump_front_dummy", false)
end
if loss >= bolshechem3 then
setVehicleEngineState(theVeh,false)
setVehicleLocked ( theVeh, false )
if isPedInVehicle ( localPlayer ) then
if remenPristegnut == "false" then
setElementHealth ( localPlayer, getElementHealth(localPlayer) - shp )
outputChatBox(mes1,255,255,255,true)
else
outputChatBox(mes2,255,255,255,true)
end
else
outputChatBox(mes2,255,255,255,true)
end
end
if loss >= bolshechem4 then
local frontLeft, rearLeft, frontRight, rearRight = getVehicleWheelStates ( theVeh )
local rand2 = math.random(0,3)
if rand2 == 0 then
setVehicleWheelStates ( theVeh, 2, rearLeft, frontRight, rearRight )
elseif rand2 == 1 then
setVehicleWheelStates ( theVeh, frontLeft, 2, frontRight, rearRight )
elseif rand2 == 2 then
setVehicleWheelStates ( theVeh, frontLeft, rearLeft, 2, rearRight )
elseif rand2 == 3 then
setVehicleWheelStates ( theVeh, frontLeft, rearLeft, frontRight, 2 )
end
outputChatBox(mes3,255,255,255,true)
if isPedInVehicle ( localPlayer ) then
if remenPristegnut == "false" then
setElementHealth ( localPlayer, getElementHealth(localPlayer) - shp)
end
end
end
if loss >= bolshechem5 then
local frontLeft, rearLeft, frontRight, rearRight = getVehicleWheelStates ( theVeh )
local rand20 = math.random(0,3)
if rand20 == 0 then
setVehicleWheelStates ( theVeh, 2, rearLeft, frontRight, rearRight )
elseif rand20 == 1 then
setVehicleWheelStates ( theVeh, frontLeft, 2, frontRight, rearRight )
elseif rand20 == 2 then
setVehicleWheelStates ( theVeh, frontLeft, rearLeft, 2, rearRight )
elseif rand20 == 3 then
setVehicleWheelStates ( theVeh, frontLeft, rearLeft, frontRight, 2 )
end
outputChatBox(mes33,255,255,255,true)
if isPedInVehicle ( localPlayer ) then
--if remenPristegnut == "false" then
setElementHealth ( localPlayer, getElementHealth(localPlayer) - (shp / 2))
--end
end
end
if isPedInVehicle ( localPlayer ) then
if remenPristegnut == "false" then
setElementHealth ( localPlayer, getElementHealth(localPlayer) - (loss/shp2) )
end
end
end
addEventHandler("onClientVehicleDamage", getRootElement(), damage1)

---добавление новой команды---

function repair1 ( command )
if getPlayerMoney() >= cenapochinki then
local theVeh = getPedOccupiedVehicle(localPlayer)
local getComponent = getVehicleComponents(theVeh)
if (theVeh) then
for k in pairs (getComponent) do
resetVehicleComponentPosition(theVeh, k)
resetVehicleComponentRotation(theVeh, k)
end
setVehicleComponentVisible(theVeh, "windscreen_dummy", true)
setVehicleComponentVisible(theVeh, "bump_front_dummy", true)
fixVehicle(theVeh)
setVehicleEngineState(theVeh,true)
-- outputChatBox(mes4..cenapochinki,255,0,0,true)
outputChatBox(mes4,255,0,0,true)
takePlayerMoney(cenapochinki)
else
outputChatBox(mes5,255,50,50,true)
end
else
local nehv = cenapochinki - getPlayerMoney()
outputChatBox(mes6..nehv,255,50,50,true)
end
end
addCommandHandler ( commandn, repair1 )

---добавление новой команды---

function belt1 ( command )
local theVeh = getPedOccupiedVehicle(localPlayer)
if theVeh then
if remenPristegnut == "false" then
remenPristegnut = "true"
outputChatBox(mes7,50,255,255,true)
elseif remenPristegnut == "true" then
remenPristegnut = "false"
outputChatBox(mes8,255,50,50,true)
end
else
outputChatBox(mes5,255,50,50,true)
end
end
addCommandHandler ( commandn2, belt1 )





Автор публикации:

Diva987siti Моника Дива

Скачать:

Скачать

Категория :

Все для MTA / Скрипты Мта

Дата:
Автор ресурса:

Автор Слива Diva987Siti

Пока никто не оставил комментарий — станьте первым.

Добавление комментария

Вы комментируете как гость — создайте аккаунт, чтобы получить аватар и уведомления.

Соблюдайте правила — будьте вежливы.