Wysłany: 2017-07-05, 10:44
Dabet
Wiek: 26 Na forum: 3258 dni Posty: 14
Nick w MP: Dabet
Piwa : 334
Witam mam problem, poniewa? zrobi?em prace my?liwego ale nie dzia?a mi wyp?ata pieni?dzy. Na serwerze posiadam GM .newMode.
Brak DB3
Kod:
zwierzeta ={
{ 2439.99 , - 656.49 , 122.54 },
{ 2502.54 , - 564.57 , 102.93 },
{ 2561.45 , - 509.05 , 85.76 },
{ 2481.18 , - 456.53 , 83.18 },
{ 2354.08 , - 502.83 , 122.38 },
{ 2230.51 , - 448.68 , 118.57 },
{ 2176.64 , - 535.35 , 124.52 },
{ 2223.51 , - 610.03 , 123.90 },
{ 2288.64 , - 681.23 , 130.96 },
{ 2199.13 , - 732.16 , 95.57 },
{ 2111.29 , - 730.80 , 100.22 },
{ 2252.76 , - 827.40 , 125.28 },
{ 2391.54 , - 852.98 , 112.45 },
{ 2501.67 , - 822.32 , 92.00 },
{ 2584.28 , - 739.62 , 96.14 },
{ 2590.84 , - 643.41 , 135.32 },
}
typyzwierzat ={ -- kasa , pole widzenia , id
{ 1000 , 18 , 121 },
{ 2000 , 24 , 122 },
{ 4000 , 30 , 123 },
}
ilosctypow = #typyzwierzat
aktualneZwierzeta ={}
sfery ={}
zajete ={}
tablesize =function( tabela )
l = 0
for i , v in pairs ( tabela ) do
l = l + 1
end
return l
end
ilosczwierzat = tablesize ( zwierzeta )
function stworzZwierzeta ( usun , ilosc , id )
if not id then id =- 1 end
if usun then
for i , v in pairs ( aktualneZwierzeta ) do
destroyElement ( aktualneZwierzeta [ i ])
destroyElement ( sfery [ i ])
end
aktualneZwierzeta ={}
sfery ={}
zajete ={}
return
end
for i = 1 , ilosc do
liczba = math . random ( ilosczwierzat )
e = 0
while zajete [ liczba ] or aktualneZwierzeta [ liczba ] or liczba == id do
liczba = math . random ( ilosczwierzat )
e = e + 1
if e > 15 then return outputChatBox ( "e>15" ) end
end
typ = typyzwierzat [ math . random ( ilosctypow )]
pos = zwierzeta [ liczba ]
aktualneZwierzeta [ liczba ]= createPed ( typ [ 3 ], pos [ 1 ], pos [ 2 ], pos [ 3 ])
sfery [ liczba ]= createColSphere ( pos [ 1 ], pos [ 2 ], pos [ 3 ], typ [ 2 ])
attachElements ( sfery [ liczba ], aktualneZwierzeta [ liczba ])
setElementData ( aktualneZwierzeta [ liczba ], "parent" , sfery [ liczba ])
setElementData ( sfery [ liczba ], "zwierze" , true )
setElementData ( sfery [ liczba ], "id" , liczba )
setElementData ( sfery [ liczba ], "parent" , aktualneZwierzeta [ liczba ])
setElementData ( sfery [ liczba ], "kasa" , typ [ 1 ])
zajete [ liczba ]= true
end
end
addEvent ( "MysliwyStart" , true )
addEventHandler ( "MysliwyStart" , resourceRoot , function()
stworzZwierzeta ( false , 3 )
if isTimer ( timer ) then
killTimer ( timer )
end
timer = setTimer ( zwierzetaMove , 2000 , 0 )
end )
addEvent ( "MysliwyStop" , true )
addEventHandler ( "MysliwyStop" , resourceRoot , function()
stworzZwierzeta ( true )
if isTimer ( timer ) then
killTimer ( timer )
end
end )
function MarkerHit ( hitElement )
if hitElement == localPlayer then
if getElementData ( source , "zwierze" ) then
id = getElementData ( source , "id" )
destroyElement ( getElementData ( source , "parent" ))
destroyElement ( source )
stworzZwierzeta ( false , 1 , id )
aktualneZwierzeta [ id ]= nil
sfery [ id ]= nil
zajete [ id ]= nil
exports [ "nm-noti" ]: noti ( "Sp?oszy?e? zwierz?! Pami?taj, ?e nie mo?esz za blisko podchodzi? do zwierz?t!" , el )
end
end
end
addEventHandler ( "onClientColShapeHit" , resourceRoot , MarkerHit )
function zwierzetaMove ()
for i , v in pairs ( aktualneZwierzeta ) do
setPedControlState ( v , "walk" , true )
setPedControlState ( v , "forwards" , true )
setElementRotation ( v , 0 , 0 , math . random ( 0 , 360 ))
end
end
function pedDmg ( attacker )
if attacker == localPlayer then
source = getElementData ( source , "parent" )
if source and getElementData ( source , "zwierze" ) then
wyplata = getElementData ( source , "kasa" )
exports [ "nm-noti" ]: noti ( "Otrzymujesz " .. wyplata .. " PLN" , el )
triggerServerEvent ( "prace:wyplata" , getRootElement (), "mysliwy" , wyplata )
id = getElementData ( source , "id" )
destroyElement ( getElementData ( source , "parent" ))
destroyElement ( source )
stworzZwierzeta ( false , 1 , id )
aktualneZwierzeta [ id ]= nil
sfery [ id ]= nil
zajete [ id ]= nil
end
end
end
addEventHandler ( "onClientPedDamage" , resourceRoot , pedDmg )
Stawiam za pomoc!
Ostatnio zmieniony przez Dabet 2017-07-05, 11:08, w całości zmieniany 1 raz
Wysłany: 2017-07-05, 11:03
Kalizman
Wiek: 23 Na forum: 3652 dni Posty: 1394
Piwa : 4619
Podaj mi tutaj linijke ktora daje wynagrodzenie w postaci liczb
Wysłany: 2017-07-05, 11:08
Dabet
Wiek: 26 Na forum: 3258 dni Posty: 14
Nick w MP: Dabet
Piwa : 334
typyzwierzat ={ -- kasa , pole widzenia , id
{ 1000 , 18 , 121 },
{ 2000 , 24 , 122 },
{ 4000 , 30 , 123 },
}
Wysłany: 2017-07-05, 16:44
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
Masz poda? kod z server'a zdarzenie 'praca:wyplata'
Tagi: praca :: dorywcza
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: