Wysłany: 2016-07-17, 23:49
STOPseba
Emeryt na scenie MTA
Wiek: 25 Na forum: 3771 dni Posty: 448
Nick w MP: STOPseba
Piwa : 5014
Witam mam taki problem ze po wgraniu skryptu na nie rozwalanie auta bez kierowcy
nadal auta mo?na rozwala? chocia? w nim nikogo niema
Kod: local function bezkierowcy(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 (bezkierowcy(v)) then
setVehicleDamageProof(v,true)
else
if getElementData(v,"damageproof") then setVehicleDamageProof(v, true) return end
setVehicleDamageProof(v,false)
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 (bezkierowcy(source)) then
setVehicleDamageProof(source, true)
else
if getElementData(source,"damageproof") then setVehicleDamageProof(source, true) return end
setVehicleDamageProof(source, false)
end
end)
Wysłany: 2016-07-18, 10:00
GabWas
Wiek: 24 Na forum: 3881 dni Posty: 289
Nick w MP: GabWas
Piwa : 65
Wed?ug mnie wystarczy co? takiego:
addEventHandler ( "onVehicleExit" , root ,
function( plr , s )
if s == 0 then
setVehicleDamageProof ( source , true )
end
end )
addEventHandler ( "onVehicleEnter" , root ,
function( plr , s )
if s == 0 then
setVehicleDamageProof ( source , false )
end
end )
Ale je?eli ju? tak bardzo chcesz na elementDat?:
for _ , v in pairs ( getElementsByType ( "vehicle" )) do
if getElementData ( v , "damageproof" )== 1 then
setVehicleDamageProof ( source , true )
else
setVehicleDamageProof ( source , false )
end
end
addEventHandler ( "onVehicleExit" , root ,
function( plr , s )
if s == 0 then
setVehicleDamageProof ( source , true )
setElementData ( source , "damageproof" , 1 )
end
end )
addEventHandler ( "onVehicleEnter" , root ,
function( plr , s )
if s == 0 then
setVehicleDamageProof ( source , false )
setElementData ( source , "damageproof" , 0 )
end
end )
Ostatnio zmieniony przez GabWas 2016-07-18, 10:03, w całości zmieniany 2 razy
Wysłany: 2016-07-18, 10:13
STOPseba
Emeryt na scenie MTA
Wiek: 25 Na forum: 3771 dni Posty: 448
Nick w MP: STOPseba
Piwa : 5014
Tagi: pojazdu
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: