Wysłany: 2015-01-07, 20:54
michal982010
Wiek: 29 Na forum: 4445 dni Posty: 69
Piwa : 1
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
function createSniperPed ( x , y , z )
local ped = createPed ( 285 , x , y , z )
setTimer (
function()
if isElement ( ped ) then
giveWeapon ( ped , 34 , 10000 , true )
setElementHealth ( test , 1000 )
setPedWeaponSlot ( ped , 6 )
setElementData ( ped , "type" , "ped.sniper.npc" )
setElementFrozen ( ped , true )
end
end
, 5000 , 1 )
return ped
end
*skrypty wstawiamy w [lua] ~ Shuffle
Ostatnio zmieniony przez MeeShuffle 2015-01-07, 21:03, w całości zmieniany 1 raz
Wysłany: 2015-01-07, 21:25
Piorun
Wiek: 32 Na forum: 6712 dni Posty: 1837
Nick w MP: Piorun
Piwa : 516
Nada?e? mu 1000 HP to jak si? spodziewasz go zabi? ?
Wysłany: 2015-01-07, 21:43
michal982010
Wiek: 29 Na forum: 4445 dni Posty: 69
Piwa : 1
Czyli zmniejszyc hp czy ca?kowicie usun?? linijke setElementHealth ?
Wysłany: 2015-01-07, 22:27
Fanciak
BOT
Wiek: 25 Na forum: 4446 dni Posty: 728
Nick w MP: Fanciak
Piwa : 1572
michal982010 , najlepiej ca?kowicie,
Wysłany: 2015-01-08, 16:33
michal982010
Wiek: 29 Na forum: 4445 dni Posty: 69
Piwa : 1
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( thePlayer , command )
local x , y , z = getElementPosition ( thePlayer )
local int = getElementInterior ( thePlayer )
local ped = createSniperPed ( x , y , z )
setElementInterior ( ped , int )
end
)
function createSniperPed ( x , y , z )
local ped = createPed ( 285 , x , y , z )
setTimer (
function()
if isElement ( ped ) then
giveWeapon ( ped , 34 , 10000 , true )
setPedWeaponSlot ( ped , 6 )
setElementData ( ped , "type" , "ped.sniper.npc" )
setElementFrozen ( ped , true )
end
end
, 5000 , 1 )
return ped
end
addEventHandler ( "sniperTakeDecision" , getRootElement (),
function( sniperPedID , aimPlayer )
setElementData ( sniperPedID , "target" , aimPlayer )
triggerClientEvent ( "sniperTakeDecisionClient" , getRootElement (), sniperPedID , aimPlayer )
end
)
client
function isMyPingTheLowest ()
local players = getElementsByType ( "player" )
local yes = true
for i , player in ipairs ( players ) do
if getPlayerPing ( getLocalPlayer ()) > getPlayerPing ( player ) then
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 t < 0 then t = 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 i , peds in ipairs ( getElementsByType ( "ped" )) do
if getElementData ( peds , "type" ) == "ped.sniper.npc" then
local x , y , z = getElementPosition ( peds )
local lowest = nil
local player = nil
for i , players in ipairs ( getElementsByType ( "player" )) do
local px , py , pz = getElementPosition ( players )
if getDistanceBetweenPoints3D ( x , y , z , px , py , pz ) < 100 then
if lowest == nil then
lowest = getDistanceBetweenPoints3D ( x , y , z , px , py , pz )
player = players
else
if getDistanceBetweenPoints3D ( x , y , z , px , py , pz ) < lowest then
lowest = getDistanceBetweenPoints3D ( x , y , z , px , py , pz )
player = players
end
end
end
end
if isElement ( player ) then
triggerServerEvent ( "sniperTakeDecision" , getRootElement (), peds , player )
end
end
end
end
end
, 1500 , 0 )
addEvent ( "sniperTakeDecisionClient" , true )
addEventHandler ( "sniperTakeDecisionClient" , getRootElement (),
function( sniperPedID , aimPlayer )
local x , y , z = getElementPosition ( sniperPedID )
local px , py , pz = getElementPosition ( aimPlayer )
setPedAimTarget ( sniperPedID , px , py , pz )
local rotZ = findRotation ( x , y , px , py )
setPedRotation ( sniperPedID , rotZ )
setPedControlState ( sniperPedID , "aim_weapon" , true )
setPedControlState ( sniperPedID , "fire" , true )
setTimer (
function()
if isElement ( sniperPedID ) then
setPedControlState ( sniperPedID , "fire" , false )
setPedControlState ( sniperPedID , "aim_weapon" , false )
end
end
, 500 , 1 )
end
)
Wysłany: 2015-01-09, 09:25
markob0
Wiek: 27 Na forum: 4248 dni Posty: 151
Nick w MP: Markob
Piwa : 939
Masz linijk? z setElementHealth ( test , 1000 ) . Zmie? to na setElementHealth ( test , 100 ) , albo setElementHealth ( test , 50 ) bo jak napiszesz setElementHealth ( test , 0 ) , to ca?kiem ci si? zbuguje.
Tagi: ped
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: