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

Wysłany: 2015-01-07, 20:54


michal982010







Wiek: 29
Na forum: 4446 dni
Posty: 69

Piwa: 1

Respekt: 50

Witam, wkleje tu urywek kodu, chcia?bym ?eby ped m?g? zosta? zabity , lecz strzelam a on nie ginie, brakuje tu czego? mo?e ?, je?li trzeba b?dzie da? ca?y kod to piszcie ;)
Za pomoc daje :piwo:

function createSniperPed(xyz)
    local ped createPed(285xyz)
    setTimer(
        function()
            if isElement(pedthen
                giveWeapon(ped3410000true)
                setElementHealth (test1000)
                setPedWeaponSlot(ped6)
                setElementData(ped"type""ped.sniper.npc")
                setElementFrozen(pedtrue)
            end
        end
    50001)
    return ped
end




*skrypty wstawiamy w [lua] ~ Shuffle

Ostatnio zmieniony przez MeeShuffle 2015-01-07, 21:03, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-07, 21:25


Piorun







Wiek: 32
Na forum: 6712 dni
Posty: 1837
Nick w MP: Piorun

Piwa: 516

Respekt: 480,7
Respekt: 480,7

Nada?e? mu 1000 HP to jak si? spodziewasz go zabi? :shock: ?

Podpis
Możesz mnie znaleźć na: Facebook
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-07, 21:43


michal982010







Wiek: 29
Na forum: 4446 dni
Posty: 69

Piwa: 1

Respekt: 50

Czyli zmniejszyc hp czy ca?kowicie usun?? linijke setElementHealth ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-07, 22:27


Fanciak

BOT






Wiek: 25
Na forum: 4447 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

michal982010, najlepiej ca?kowicie,

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-08, 16:33


michal982010







Wiek: 29
Na forum: 4446 dni
Posty: 69

Piwa: 1

Respekt: 50

Wie kto? mo?e dlaczego ich si? nie da zabi? anie nie otrzymujemy od nich obra?e? na gamemod Dayz ?


Serwer
addEvent("sniperTakeDecision"true)
addCommandHandler("sniper",
    function(thePlayercommand)
        local xygetElementPosition(thePlayer)
        local int getElementInterior(thePlayer)
        local ped createSniperPed(xyz)
        setElementInterior(pedint)
    end
)

function createSniperPed(xyz)
    local ped createPed(285xyz)
    setTimer(
        function()
            if isElement(pedthen
                giveWeapon(ped3410000true)
                setPedWeaponSlot(ped6)
                setElementData(ped"type""ped.sniper.npc")
                setElementFrozen(pedtrue)
            end
        end
    50001)
    return ped
end
addEventHandler("sniperTakeDecision"getRootElement(),
    function(sniperPedIDaimPlayer)
        setElementData(sniperPedID"target"aimPlayer)
        triggerClientEvent("sniperTakeDecisionClient"getRootElement(), sniperPedIDaimPlayer)
    end
)


client
function isMyPingTheLowest()
    local players getElementsByType("player")
    local yes true
    for iplayer in ipairs(players) do
        if getPlayerPing(getLocalPlayer()) > getPlayerPing(playerthen
            yes false
        end
    end
    if yes == true then
        return true
    else
        return false
    end
end
function findRotation(x1,y1,x2,y2)
    local t = -math.deg(math.atan2(x2-x1,y2-y1))
    if 0 then t 360 end
    return t
end
addEventHandler("onClientPedDamage"getRootElement(),
    function(attacker)
        if getElementData(source"type") == "ped.sniper.npc" and getElementData(attacker"type") == "ped.sniper.npc" then
            cancelEvent()
        end
    end
)
setTimer(
    function()
        if isMyPingTheLowest() then
            for ipeds in ipairs(getElementsByType("ped")) do
                if getElementData(peds"type") == "ped.sniper.npc" then
                    local xygetElementPosition(peds)
                    local lowest nil
                    local player nil
                    for iplayers in ipairs(getElementsByType("player")) do
                        local pxpypz getElementPosition(players)
                        if getDistanceBetweenPoints3D(xyzpxpypz) < 100 then
                            if lowest == nil then
                                lowest getDistanceBetweenPoints3D(xyzpxpypz)
                                player players
                            else
                                if getDistanceBetweenPoints3D(xyzpxpypz) < lowest then
                                    lowest getDistanceBetweenPoints3D(xyzpxpypz)
                                    player players
                                end
                            end
                        end
                    end
                    if isElement(playerthen
                        triggerServerEvent("sniperTakeDecision"getRootElement(), pedsplayer)
                    end
                end
            end
        end
    end
15000)
addEvent("sniperTakeDecisionClient"true)
addEventHandler("sniperTakeDecisionClient"getRootElement(),
    function(sniperPedIDaimPlayer)
        local xygetElementPosition(sniperPedID)
        local pxpypz getElementPosition(aimPlayer)
        setPedAimTarget(sniperPedIDpxpypz)
        local rotZ findRotation(xypxpy)
        setPedRotation(sniperPedIDrotZ)
        setPedControlState(sniperPedID"aim_weapon"true)
        setPedControlState(sniperPedID"fire"true)
        setTimer(
            function()
                if isElement(sniperPedIDthen
                    setPedControlState(sniperPedID"fire"false)
                    setPedControlState(sniperPedID"aim_weapon"false)
                end
            end
        5001)
    end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-09, 09:25


markob0







Wiek: 27
Na forum: 4248 dni
Posty: 151
Nick w MP: Markob

Piwa: 939

Respekt: 98,2

Masz linijk? z
setElementHealth (test1000)
. Zmie? to na
setElementHealth (test100)
, albo
setElementHealth (test50)
bo jak napiszesz
setElementHealth (test0)
, to ca?kiem ci si? zbuguje.

Podpis
Postaw piwo autorowi tego posta
 

 
Tagi: ped
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA 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