Wysłany: 2016-02-29, 17:58
EseJax
Wiek: 31 Na forum: 4085 dni Posty: 67
Nick w MP: Toffy.
Piwa : 982
Witam, posiadam kod splita na leczenie sprayem, odkry?em bug ?e je?li medyk jest za blisko gracza, mo?e po prostu bi? go ramieniem i otrzymywa? ca?y czas pieni?dze za ka?de uderzenie.
Client:
local koszt = 5 -- tutaj ustawiamy koszt za uleczonego gracza .
-- Leczenie sprayem
addEventHandler ( "onClientPlayerDamage" , root , function( attacker , weapon )
if getElementData ( el , "player:faction" ) ~= 6 then
if weapon == 41 then cancelEvent () end -- blokujemy zabijanie
if weapon == 41 and attacker then -- sprawdzamy bro ?
local hp = getElementHealth ( localPlayer ) -- pobieramy hp
local health = hp + math . random ( 2 , 3 ) -- losujemy ilo ? c hp
if health > hp and health <= 100 then -- sprawdza hp
setElementHealth ( localPlayer , health ) -- ulecza gracza
if health > 80 then triggerServerEvent ( "givePlayerMoney" , attacker , koszt ) end -- otrzymuje kas ?
end
end
end
end )
Za pomoc b?d? piffka
Wysłany: 2016-02-29, 18:17
luki123luki123
Place Game
Wiek: 28 Na forum: 5275 dni Posty: 1948
Nick w MP: LuKiO
Piwa : 6101
EseJax , spr?buj tak:
local koszt = 5 -- tutaj ustawiamy koszt za uleczonego gracza .
-- Leczenie sprayem
addEventHandler ( "onClientPlayerDamage" , root , function( attacker , weapon )
if getElementData ( el , "player:faction" ) ~= 6 then
if weapon == 41 then cancelEvent () end -- blokujemy zabijanie
if weapon == 0 then cancelEvent () end -- blokuje bicie r ? kami
if weapon == 41 and attacker then -- sprawdzamy bro ?
local hp = getElementHealth ( localPlayer ) -- pobieramy hp
local health = hp + math . random ( 2 , 3 ) -- losujemy ilo ? c hp
if health > hp and health <= 100 then -- sprawdza hp
setElementHealth ( localPlayer , health ) -- ulecza gracza
if health > 80 then triggerServerEvent ( "givePlayerMoney" , attacker , koszt ) end -- otrzymuje kas ?
end
end
end
end )
Wysłany: 2016-02-29, 18:34
#404
Wiek: 26 Na forum: 4771 dni Posty: 1438
Piwa : 2512
luki123luki123 , ale on b?dzie mia? przecie? w d?oni spray, wi?c nadal b?dzie 41...
Spr?buj tego:
local koszt = 5 -- tutaj ustawiamy koszt za uleczonego gracza .
-- Leczenie sprayem
addEventHandler ( "onClientPlayerDamage" , root , function( attacker , weapon )
if getElementData ( el , "player:faction" ) ~= 6 then
if weapon == 41 then cancelEvent () end -- blokujemy zabijanie
if weapon == 41 and attacker then -- sprawdzamy bro ?
x1 , x2 , x3 = getElementPosition ( localPlayer )
y1 , y2 , y3 = getElementPosition ( attacker )
dystans = getDistanceBetweenPoints3D ( x1 , x2 , x3 , y1 , y2 , y3 (
if dystans < 0.5 then return end
local hp = getElementHealth ( localPlayer ) -- pobieramy hp
local health = hp + math . random ( 2 , 3 ) -- losujemy ilo ? c hp
if health > hp and health <= 100 then -- sprawdza hp
setElementHealth ( localPlayer , health ) -- ulecza gracza
if health > 80 then triggerServerEvent ( "givePlayerMoney" , attacker , koszt ) end -- otrzymuje kas ?
end
end
end
end )
Musisz tylko dostosowa? dystans, bo nie jestem pewien czy taki jest odpowiedni.
Wysłany: 2016-02-29, 20:22
Emm
***** ***
Wiek: 32 Na forum: 3880 dni Posty: 3191
Nick w MP: Emm
Piwa : 6162
Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .
DestroY , ma?e niedopatrzenie:
dystans = getDistanceBetweenPoints3D ( x1 , x2 , x3 , y1 , y2 , y3 (
Chodzi o ostatni nawias ko?cz?cy ;>
local koszt = 5 -- tutaj ustawiamy koszt za uleczonego gracza .
-- Leczenie sprayem
addEventHandler ( "onClientPlayerDamage" , root , function( attacker , weapon )
if getElementData ( el , "player:faction" ) ~= 6 then
if weapon == 41 then cancelEvent () end -- blokujemy zabijanie
if weapon == 41 and attacker then -- sprawdzamy bro ?
x1 , x2 , x3 = getElementPosition ( localPlayer )
y1 , y2 , y3 = getElementPosition ( attacker )
dystans = getDistanceBetweenPoints3D ( x1 , x2 , x3 , y1 , y2 , y3 )
if dystans < 0.5 then return end
local hp = getElementHealth ( localPlayer ) -- pobieramy hp
local health = hp + math . random ( 2 , 3 ) -- losujemy ilo ? c hp
if health > hp and health <= 100 then -- sprawdza hp
setElementHealth ( localPlayer , health ) -- ulecza gracza
if health > 80 then triggerServerEvent ( "givePlayerMoney" , attacker , koszt ) end -- otrzymuje kas ?
end
end
end
end )
Podpis
Użytkownik : 20.10.2015r
GTAO Member : 06.03.2016r
Support-Team : 20.01.2016r
Moderator : 30.03.2016r
Mod-Team : 08.10.2016r
Vice Admin : 04.05.2018r
Administrator : 03.05.2022r
[you]
! Koniecznie zapoznaj się z
regulaminem forum .
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również
regulaminy działów , w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez
Administrację , przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w
tym dziale .
Najważniejsze informacje od
Administracji możesz przeczytać
tutaj oraz
tutaj .
Tagi: leczenie :: sprayem :: łokieć
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: