Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2018-11-26, 23:50


SebixonMaciasze







Wiek: 32
Na forum: 3059 dni
Posty: 14
Nick w MP: Karmelowy

Piwa: 1

Respekt: 50

Siema, mam serwer MTA i jak dodac zeby bronie mogly zabierac HP? Bo jest organizacja taka i bronie nie zabieraja hp jak zrobic zeby zabieraly ale tylko bronie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-11-27, 16:01


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Znajd? w swoim gamemodzie miejsce, gdzie te obra?enia s? blokowane przez skrypt i odpowiednio go zmodyfikuj.
Por?wnujesz drugi parametr eventu z ID broni dozwolonymi do obra?e?.

Więcej informacji znajdziesz w Wikipedii MTA:

Weapons


Jak to znale???
W notepadzie++ szukaj w plikach frazy 'onClientPlayerDamage'.
Je?li nie b?dziesz wiedzia? co zrobi?, pode?lij ten kod znaleziony powy?ej.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-11-27, 21:37


SebixonMaciasze







Wiek: 32
Na forum: 3059 dni
Posty: 14
Nick w MP: Karmelowy

Piwa: 1

Respekt: 50

addEventHandler( "onClientElementStreamIn", root,
function ( )
if getElementType( source ) == "object" then
setObjectBreakable(source, false)
end
end)
addEvent("setBreakable",true)
addEventHandler("setBreakable",root,function(obj)
setObjectBreakable(obj, false)
end)

addEvent("addNotification",true)
addEventHandler("addNotification",root,function(tekst,typ)
if not tekst then return end
if not typ then return end
outputChatBox(tekst)
end)

addEvent("addNotificatione",true)
addEventHandler("addNotificatione",root,function(tekst,typ)
if not tekst then return end
if not typ then return end
exports['notices']:addNotification(tekst,typ)
end)


function stopMinigunDamage ( attacker, weapon, bodypart )
if ( weapon == 0 ) then
cancelEvent()
end
end
addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopMinigunDamage )

function nodamage(attacker, bodypart)
if not attacker then return end
if getElementType(attacker) == 'vehicle' then
cancelEvent()
end
end
addEventHandler("onClientPlayerDamage", getLocalPlayer(),nodamage)

function blokada ( prevSlot, newSlot )
if getPedWeapon(getLocalPlayer(),newSlot) == 0 and getElementData(getLocalPlayer(),"player:admin") == true then
toggleControl ( "fire", true )
toggleControl("aim_weapon", true)
elseif getPedWeapon(getLocalPlayer(),newSlot) == 7 then
toggleControl ("fire", false )
toggleControl("aim_weapon", false)
return false
elseif getPedWeapon(getLocalPlayer(),newSlot) ~= 0 and getPedWeapon(getLocalPlayer(),newSlot) ~= 22 then
toggleControl ("fire", true )
toggleControl("aim_weapon", true)
elseif getPedWeapon(getLocalPlayer(),newSlot) == 22 and getElementData(getLocalPlayer(),"player:admin") == true then
toggleControl ("fire", false )
toggleControl("aim_weapon", true)
elseif getPedWeapon(getLocalPlayer(),newSlot) == 22 and getElementData(getLocalPlayer(),"player:admin") == false then
toggleControl ("fire", true )
toggleControl("aim_weapon", true)
else
toggleControl ( "fire", false )
toggleControl("aim_weapon", false)
end
end
addEventHandler ( "onClientPlayerWeaponSwitch", getRootElement(), blokada )

setTimer(function()
local czas=tonumber(getElementData(localPlayer, "player:online"))
if not czas then return end
setElementData(localPlayer, "player:online", czas+1)
end, 60000, 0)


function chat()
if isChatVisible() then --Check or the chat is visible.
showChat(false) --If it is, hide it.
else
showChat(true) --If it is not, show it.
end
end
addCommandHandler('chat', chat)

addEvent("core:blipyaut", true)
addEventHandler("core:blipyaut", root, function(plr)
if plr ~= localPlayer then return end
local sid=getElementData(plr,"player:sid")
for id, veh in ipairs( getElementsByType ( "vehicle" ) ) do
if sid == getElementData(veh,"vehicle:ownedPlayer") then
createBlipAttachedTo(veh,0,0,5000,0,0.3,0,255,0,255,1,99999)
end
end
end)
function destroyBlipsAttachedTo(elemente)
local attached = getAttachedElements ( elemente )
if ( attached ) then
for k,element in ipairs(attached) do
if getElementType ( element ) == "blip" then
destroyElement ( element )
end
end
end
end
function veh_blips()
for i,v in pairs(getElementsByType("vehicle")) do
if getElementData(v,"vehicle:spawn") == true then
if getElementData(v,"vehicle:ownedPlayer") == getElementData(localPlayer,"player:sid") then
createBlipAttachedTo(v,0,1,255,0,0,255,1,9999)
end
local rent = getElementData(v,"vehicle:rent")
if rent and (type(rent) == "table") then
for i,s in pairs(rent) do
if tonumber(s) == getElementData(localPlayer,"player:sid") then
createBlipAttachedTo(v,0,1,0,0,255,255,1,9999)
end
end
end
end
end
end
setTimer(veh_blips,10000,0)
addEventHandler("onClientElementDestroy", root, function ()
if getElementType(source) == "vehicle" then
destroyBlipsAttachedTo(source)
end
end)
addEventHandler ( "onClientElementDataChange", root,
function ( dataName )
if getElementType ( source ) == "vehicle" and dataName == "vehicle:ownedPlayer" then
destroyBlipsAttachedTo(source)
end
if getElementType ( source ) == "vehicle" and dataName == "vehicle:rent" then
destroyBlipsAttachedTo(source)
end
end )


Kod pomoze ktos jak zmienic?

Podpis
.DiverseRPG
Wlasciciele: TheShark, sg12
Discord:https://discord.gg/TUhTU7
Data otwarcia: 01-05-2019
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-11-27, 21:48


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Ta organizacja jest na elementDat??
Czy w organizacji mo?esz strzela? ale nie zadajesz obra?e?, czy nawet nie mo?esz celowa? / strzela??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-11-27, 21:55


SebixonMaciasze







Wiek: 32
Na forum: 3059 dni
Posty: 14
Nick w MP: Karmelowy

Piwa: 1

Respekt: 50

Nie moge zadawac obrazen.

Podpis
.DiverseRPG
Wlasciciele: TheShark, sg12
Discord:https://discord.gg/TUhTU7
Data otwarcia: 01-05-2019
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-11-27, 22:05


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Tak wi?c musisz szuka? dalej, tutaj masz tylko blokad? obra?e? przy biciu r?k? i obra?e? od pojazdu.

PS. Stosuj znaczniki [.lua] i [./lua] bez kropek.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-11-27, 23:22


SebixonMaciasze







Wiek: 32
Na forum: 3059 dni
Posty: 14
Nick w MP: Karmelowy

Piwa: 1

Respekt: 50

Przeszuka?em wszystko nwm gdzie to moze byc.

Podpis
.DiverseRPG
Wlasciciele: TheShark, sg12
Discord:https://discord.gg/TUhTU7
Data otwarcia: 01-05-2019
Postaw piwo autorowi tego posta
 

 
Tagi: zabieranie
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Zabieranie HP Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

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
Dodaj temat do Ulubionych
Wersja do druku