Mam rozumie? ?e zdm to skrypt kt?ry Ci poda?em?
sprawd? czy przy kopiowaniu kodu z mojego posta nie omin??e? ?adnego znaku.
sprawd? met?, oraz spr?buj debugu
Mam rozumie? ?e zdm to skrypt kt?ry Ci poda?em?
sprawd? czy przy kopiowaniu kodu z mojego posta nie omin??e? ?adnego znaku.
sprawd? met?, oraz spr?buj debugu
Takie cos w konsoli, jutro zobacze czy dziala bo juz kompa wylaczylem
AA, dobra... PRZEPRASZAM Z G?RY, ?LE PRZECZYTA?EM TROSZK?, MOJA WINA;)
Tobie chodzi?o o skrypt kt?ry uniemo?liwia rozwalanie pojazd?w, gdy nie ma w nim grczy, a ja poda?em Ci kod kt?ry uniemo?liwia wybuch gdy nikogo nie ma w poje?dzie:D Przepraszam z g?ry
Anty damage
local function pojazdPusty(veh)
local occupants = getVehicleOccupants(veh)
local seats = getVehicleMaxPassengers(veh)
if (not seats) then return true end
for i=0,seats do
local occupant = occupants[seat]
if occupant and (getElementType(occupant)=="player" or getElementType(occupant)=="ped") then
return false
end
end
return true
end
for i,v in ipairs(getElementsByType("vehicle")) do
if (pojazdPusty(v)) then
setVehicleDamageProof(v,true)
else
if getElementData(v,"damageproof") then setVehicleDamageProof(v, true) return end
end
end
addEventHandler ( "onVehicleEnter", root, function()
if getElementData(source,"damageproof") then setVehicleDamageProof(source, true) return end
setVehicleDamageProof(source, false)
end)
addEventHandler ( "onVehicleExit", root, function()
if (pojazdPusty(source)) then
setVehicleDamageProof(source, true)
else
if getElementData(source,"damageproof") then setVehicleDamageProof(source, true) return end
setVehicleDamageProof(source, false)
end
end)
BONUS:Anty blow
local vehTimers = { };
setTimer(
function ( )
for _, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do
if getElementHealth(vehicle) < 260 then
setElementHealth( vehicle, 250 ); -- set vehicle health to "fire" health which is ~250
if not vehTimers[ vehicle ] then -- if we haven't set the timer 1 second earlier then:
setVehicleDamageProof( vehicle, true) -- it only need to be called once so set the bulletproof property
vehTimers[ vehicle ] = setTimer( setVehicleDamageProof, 120000, 1, vehicle, false); -- 5mins = 5 * 60sec = 300sec = 300000ms! It's NOT 500000ms
end
elseif vehTimers[ vehicle ] and isTimer( vehTimers[ vehicle ] ) then -- if we set a timer earlier but the vehicle was repaired within the 5mins then:
setVehicleDamageProof( vehicle, false) -- disable bulletproof property
killTimer( vehTimers[ vehicle ] ); -- kill the timer
vehTimers[ vehicle ] = nil; -- remove the variable from the memory since we killed the timer and it's no longer timer variable
end
end
end,1000, 0
)
AA, dobra... PRZEPRASZAM Z G?RY, ?LE PRZECZYTA?EM TROSZK?, MOJA WINA;)
Tobie chodzi?o o skrypt kt?ry uniemo?liwia rozwalanie pojazd?w, gdy nie ma w nim grczy, a ja poda?em Ci kod kt?ry uniemo?liwia wybuch gdy nikogo nie ma w poje?dzie:D Przepraszam z g?ry
Anty damage
local function pojazdPusty(veh)
local occupants = getVehicleOccupants(veh)
local seats = getVehicleMaxPassengers(veh)
if (not seats) then return true end
for i=0,seats do
local occupant = occupants[seat]
if occupant and (getElementType(occupant)=="player" or getElementType(occupant)=="ped") then
return false
end
end
return true
end
for i,v in ipairs(getElementsByType("vehicle")) do
if (pojazdPusty(v)) then
setVehicleDamageProof(v,true)
else
if getElementData(v,"damageproof") then setVehicleDamageProof(v, true) return end
end
end
addEventHandler ( "onVehicleEnter", root, function()
if getElementData(source,"damageproof") then setVehicleDamageProof(source, true) return end
setVehicleDamageProof(source, false)
end)
addEventHandler ( "onVehicleExit", root, function()
if (pojazdPusty(source)) then
setVehicleDamageProof(source, true)
else
if getElementData(source,"damageproof") then setVehicleDamageProof(source, true) return end
setVehicleDamageProof(source, false)
end
end)
BONUS:Anty blow
local vehTimers = { };
setTimer(
function ( )
for _, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do
if getElementHealth(vehicle) < 260 then
setElementHealth( vehicle, 250 ); -- set vehicle health to "fire" health which is ~250
if not vehTimers[ vehicle ] then -- if we haven't set the timer 1 second earlier then:
setVehicleDamageProof( vehicle, true) -- it only need to be called once so set the bulletproof property
vehTimers[ vehicle ] = setTimer( setVehicleDamageProof, 120000, 1, vehicle, false); -- 5mins = 5 * 60sec = 300sec = 300000ms! It's NOT 500000ms
end
elseif vehTimers[ vehicle ] and isTimer( vehTimers[ vehicle ] ) then -- if we set a timer earlier but the vehicle was repaired within the 5mins then:
setVehicleDamageProof( vehicle, false) -- disable bulletproof property
killTimer( vehTimers[ vehicle ] ); -- kill the timer
vehTimers[ vehicle ] = nil; -- remove the variable from the memory since we killed the timer and it's no longer timer variable
end
end
end,1000, 0
)
typ skryptu w mecie
dla antyblowa: type="server"/>
dla damage nie podawaj tego parametru. musi dzia?a?. AntyDamage jest zrobiony bodaj?e przez AteXa, a antyblow znalaz?em na OFICJALNYM forum o MTA, wi?c musi dzia?a?
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach