Wysłany: 2016-11-06, 19:42
Przegryw
Wiek: 23 Na forum: 3509 dni Posty: 9
Siema . Og?lnie staram si? napisa? sw?j skrypt , lecz nie wiem wiem jak zrobi? pasek ?adowania . Ma to polega? na tym ?e je?eli nasza posta? wykonuje animacj? przez 5 sekund to ?aduje si? pasek i ma si? za?adowa? w przeci?gu tych 5 sekund . Pr?bowa?em na wszelkie sposoby i mi si? nie udawa?o . Licz? na szybk? pomoc
Wysłany: 2016-11-06, 22:12
Wittx
8===D
Wiek: 26 Na forum: 4794 dni Posty: 121
Nick w MP: wittula
Piwa : 1905
local sw , sh = guiGetScreenSize ()
local function fillBar ( seconds , r , g , b )
local startTime = getTickCount ()
local fillTime = seconds * 1000
local func = function()
local elapsedTime = getTickCount () - startTime ;
local progress = elapsedTime / fillTime ;
barLevel , _ , _ = interpolateBetween (
0 , 0 , 0 ,
100 , 0 , 0 ,
progress , 'Linear' );
dxDrawRectangle ( sw / 4 , sh / 2 - 50 , sw / 2 , 100 , tocolor ( 10 , 10 , 10 , 180 ), true )
dxDrawRectangle ( sw / 4 + 5 , sh / 2 - 45 , sw / 2 - 10 , 90 , tocolor ( r , g , b , 150 ), true )
dxDrawRectangle ( sw / 4 + 5 , sh / 2 - 45 , ( sw / 2 - 10 )*( progress ), 90 , tocolor ( r , g , b , 255 ), true )
dxDrawText ( math . floor ( progress * 100 ).. "%" , sw / 4 + 5 , sh / 2 - 45 , sw * .75 , sh / 2 + 45 , tocolor ( 60 , 60 , 60 , 150 ), 1 , "pricedown" , "center" , "center" , false , false , true )
end
addEventHandler ( 'onClientRender' , root , func );
setTimer (function()
removeEventHandler ( 'onClientRender' , root , func );
outputChatBox ( "Na?adowano!" )
end , fillTime , 1 );
end
fillBar ( 15 , 90 , 90 , 255 ) -- rozpoczyna ? adowa ? niebieski pasek przez 15 sekund :)
Mam nadziej?, ?e pomog?em.
Kiedy odpalisz kilka pask?w jednocze?nie to po prostu si? na siebie na?o??. Ka?dy pasek ma swoj? osobn? lokaln? funkcj? kt?ra jest podpinana pod event i po na?adowaniu odpinana od eventu. Po prostu wybra?em mniejsze z?o - lepiej pokazywa? pasek na pasku ni? nie pokazywa? ?adnego. Oczywi?cie mo?esz pokombinowa? ze zmian? wysoko?ci pask?w jesli jest ich wi?cej ni? 1, ja da?em tylko rozwi?zanie na wype?nianie paska wzgl?dem czasu. Powodzenia.
Wysłany: 2016-11-07, 19:03
Pawel5321
Szkrypter
Wiek: 36 Na forum: 3809 dni Posty: 237
Nick w MP: Pawell
Piwa : 2315
local pracaM = createMarker (- 2855.96 ,- 1605.35 , 13.90 , "cylinder" , 2.0 , 0 , 71 , 255 , 100 )
-- local pracaablip = createBlip (- 2855.96 ,- 1605.35 , 14.90 , 20 , 52 )
local blip = createBlip (- 2855.96 ,- 1605.35 , 14.90 , 46 , 0 , 0 , 0 , 0 , 0 , 0 , 600 )
local miejscaelektryk = {
{- 2841.65 , - 1605.68 , 14.90 },
{- 2829.48 , - 1598.92 , 14.90 },
{- 2820.62 , - 1611.40 , 14.90 },
{- 2829.52 , - 1631.95 , 14.90 },
}
local sw , sh = guiGetScreenSize ()
local function fillBar ( seconds , r , g , b )
local startTime = getTickCount ()
local fillTime = seconds * 1000
local func = function()
local elapsedTime = getTickCount () - startTime ;
local progress = elapsedTime / fillTime ;
barLevel , _ , _ = interpolateBetween (
0 , 0 , 0 ,
100 , 0 , 0 ,
progress , 'Linear' );
dxDrawRectangle ( sw / 4 , sh / 2 - 50 , sw / 2 , 100 , tocolor ( 10 , 10 , 10 , 180 ), true )
dxDrawRectangle ( sw / 4 + 5 , sh / 2 - 45 , sw / 2 - 10 , 90 , tocolor ( r , g , b , 150 ), true )
dxDrawRectangle ( sw / 4 + 5 , sh / 2 - 45 , ( sw / 2 - 10 )*( progress ), 90 , tocolor ( r , g , b , 255 ), true )
dxDrawText ( math . floor ( progress * 100 ).. "%" , sw / 4 + 5 , sh / 2 - 45 , sw * .75 , sh / 2 + 45 , tocolor ( 60 , 60 , 60 , 150 ), 1 , "pricedown" , "center" , "center" , false , false , true )
end
addEventHandler ( 'onClientRender' , root , func );
addEventHandler ( "onClientMarkerHit" , pracaM , function( el , md )
if not md or getElementType ( el ) ~= "player" then return end
if el ~= localPlayer then return end
outputChatBox ( "#0053FF[#919191Informacja#0053FF] #919191Aby rozpocz?? prac? kopalni wci?nij #0053FF'E'#919191." , 255 , 255 , 255 , true )
end )
bindKey ( "e" , "down" , function()
if not isElementWithinMarker ( localPlayer , pracaM ) then return end
if not getElementData ( localPlayer , "gracz_pracaM" ) then
local losuj = math . random ( 2 , #miejscaelektryk)
setElementData ( localPlayer , "gracz_pracaM" , true )
triggerServerEvent ( "bron" , localPlayer )
outputChatBox ( "#0053FF[#919191Informacja#0053FF] #919191Wzi??e? kilof. Id? wykopa? #0053FFkamie?#919191." , 255 , 255 , 255 , true )
toggleControl ( "sprint" , false )
toggleControl ( "jump" , false )
toggleControl ( "crouch" , false )
local skrzynia = createObject ( 335 , 0 , 0 , 0 )
local cel = createMarker ( miejscaelektryk [ losuj ][ 1 ], miejscaelektryk [ losuj ][ 2 ], miejscaelektryk [ losuj ][ 3 ]- 1.0 , "checkpoint" , 1.0 , 255 , 0 , 0 )
local blip = createBlipAttachedTo ( cel , 41 )
addEventHandler ( "onClientMarkerHit" , cel , function( el , md )
if not md or getElementType ( el ) ~= "player" then return end
if el ~= localPlayer then return end
if getPedOccupiedVehicle ( el ) then
outputChatBox ( "#0053FF[#919191Informacja#0053FF] #919191Nie mo?esz kopa? b?d?c w #0053FFpoje?dzie#919191." , 255 , 255 , 255 , true )
return
end
destroyElement ( blip )
setElementFrozen ( el , true )
outputChatBox ( "#0053FF[#919191Informacja#0053FF] #919191Wykopujesz #0053FFkamie?#919191." , 255 , 255 , 255 , true )
triggerServerEvent ( "animka" , localPlayer )
fillBar ( 5 , 90 , 90 , 255 )
setTimer (function()
setElementFrozen ( el , false )
setPedAnimation ( ped , "bat_4" )
outputChatBox ( "#0053FF[#919191Informacja#0053FF] #919191Za wykonanie pracy otrzymujesz #0053FF83$#919191." , 255 , 255 , 255 , true )
destroyElement ( cel )
destroyElement ( skrzynia )
triggerServerEvent ( "zb" , localPlayer )
triggerServerEvent ( "zanimka" , localPlayer )
setElementData ( el , "gracz_pracaM" , false )
triggerServerEvent ( "magwyp" , root , localPlayer )
toggleControl ( "sprint" , true )
toggleControl ( "jump" , true )
toggleControl ( "crouch" , true )
showMsg ( "xD" , "Test" )
triggerServerEvent ( "skonczPraceM" , localPlayer )
removeEventHandler ( 'onClientRender' , root , func );
end , 5000 , 1 )
end )
else
outputChatBox ( "#0053FF[#919191Informacja#0053FF] #919191Posiadasz ju? #0053FFaktywn?#919191 prac?." , 255 , 255 , 255 , true )
end
end )
Wysłany: 2016-11-07, 21:52
Przegryw
Wiek: 23 Na forum: 3509 dni Posty: 9
Blad w 97linijce . Chodzi o enda bodajze .
Wysłany: 2016-11-07, 22:24
PapaSmerf
Wiek: 25 Na forum: 3525 dni Posty: 237
Piwa : 3857
Wysłany: 2016-11-07, 22:26
Wittx
8===D
Wiek: 26 Na forum: 4794 dni Posty: 121
Nick w MP: wittula
Piwa : 1905
local sw , sh = guiGetScreenSize ()
local function fillBar ( seconds , r , g , b )
local startTime = getTickCount ()
local fillTime = seconds * 1000
local func = function()
local elapsedTime = getTickCount () - startTime ;
local progress = elapsedTime / fillTime ;
barLevel , _ , _ = interpolateBetween (
0 , 0 , 0 ,
100 , 0 , 0 ,
progress , 'Linear' );
dxDrawRectangle ( sw / 4 , sh / 2 - 50 , sw / 2 , 100 , tocolor ( 10 , 10 , 10 , 180 ), true )
dxDrawRectangle ( sw / 4 + 5 , sh / 2 - 45 , sw / 2 - 10 , 90 , tocolor ( r , g , b , 150 ), true )
dxDrawRectangle ( sw / 4 + 5 , sh / 2 - 45 , ( sw / 2 - 10 )*( progress ), 90 , tocolor ( r , g , b , 255 ), true )
dxDrawText ( math . floor ( progress * 100 ).. "%" , sw / 4 + 5 , sh / 2 - 45 , sw * .75 , sh / 2 + 45 , tocolor ( 60 , 60 , 60 , 150 ), 1 , "pricedown" , "center" , "center" , false , false , true )
end
addEventHandler ( 'onClientRender' , root , func );
setTimer (function()
removeEventHandler ( 'onClientRender' , root , func );
outputChatBox ( "Na?adowano!" )
end , fillTime , 1 );
end
---
local pracaM = createMarker (- 2855.96 ,- 1605.35 , 13.90 , "cylinder" , 2.0 , 0 , 71 , 255 , 100 )
-- local pracaablip = createBlip (- 2855.96 ,- 1605.35 , 14.90 , 20 , 52 )
local blip = createBlip (- 2855.96 ,- 1605.35 , 14.90 , 46 , 0 , 0 , 0 , 0 , 0 , 0 , 600 )
local miejscaelektryk = {
{- 2841.65 , - 1605.68 , 14.90 },
{- 2829.48 , - 1598.92 , 14.90 },
{- 2820.62 , - 1611.40 , 14.90 },
{- 2829.52 , - 1631.95 , 14.90 },
}
addEventHandler ( "onClientMarkerHit" , pracaM , function( el , md )
if not md or getElementType ( el ) ~= "player" then return end
if el ~= localPlayer then return end
outputChatBox ( "#0053FF[#919191Informacja#0053FF] #919191Aby rozpocz?? prac? kopalni wci?nij #0053FF'E'#919191." , 255 , 255 , 255 , true )
end )
bindKey ( "e" , "down" , function()
if not isElementWithinMarker ( localPlayer , pracaM ) then return end
if not getElementData ( localPlayer , "gracz_pracaM" ) then
local losuj = math . random ( 2 , #miejscaelektryk)
setElementData ( localPlayer , "gracz_pracaM" , true )
triggerServerEvent ( "bron" , localPlayer )
outputChatBox ( "#0053FF[#919191Informacja#0053FF] #919191Wzi??e? kilof. Id? wykopa? #0053FFkamie?#919191." , 255 , 255 , 255 , true )
toggleControl ( "sprint" , false )
toggleControl ( "jump" , false )
toggleControl ( "crouch" , false )
local skrzynia = createObject ( 335 , 0 , 0 , 0 )
local cel = createMarker ( miejscaelektryk [ losuj ][ 1 ], miejscaelektryk [ losuj ][ 2 ], miejscaelektryk [ losuj ][ 3 ]- 1.0 , "checkpoint" , 1.0 , 255 , 0 , 0 )
local blip = createBlipAttachedTo ( cel , 41 )
addEventHandler ( "onClientMarkerHit" , cel , function( el , md )
if not md or getElementType ( el ) ~= "player" then return end
if el ~= localPlayer then return end
if getPedOccupiedVehicle ( el ) then
outputChatBox ( "#0053FF[#919191Informacja#0053FF] #919191Nie mo?esz kopa? b?d?c w #0053FFpoje?dzie#919191." , 255 , 255 , 255 , true )
return
end
destroyElement ( blip )
setElementFrozen ( el , true )
outputChatBox ( "#0053FF[#919191Informacja#0053FF] #919191Wykopujesz #0053FFkamie?#919191." , 255 , 255 , 255 , true )
triggerServerEvent ( "animka" , localPlayer )
fillBar ( 5 , 255 , 255 , 0 )
setTimer (function()
setElementFrozen ( el , false )
setPedAnimation ( ped , "bat_4" )
outputChatBox ( "#0053FF[#919191Informacja#0053FF] #919191Za wykonanie pracy otrzymujesz #0053FF83$#919191." , 255 , 255 , 255 , true )
destroyElement ( cel )
destroyElement ( skrzynia )
triggerServerEvent ( "zb" , localPlayer )
triggerServerEvent ( "zanimka" , localPlayer )
setElementData ( el , "gracz_pracaM" , false )
triggerServerEvent ( "magwyp" , root , localPlayer )
toggleControl ( "sprint" , true )
toggleControl ( "jump" , true )
toggleControl ( "crouch" , true )
showMsg ( "xD" , "Test" )
triggerServerEvent ( "skonczPraceM" , localPlayer )
end , 5000 , 1 )
end )
else
outputChatBox ( "#0053FF[#919191Informacja#0053FF] #919191Posiadasz ju? #0053FFaktywn?#919191 prac?." , 255 , 255 , 255 , true )
end
end )
Jedyne co zrobi?em w tym kodzie to doda?em ca?kiem na pocz?tku sw?j kod, potem doda?em tylko wywo?anie funkcji fillBar() przed setTimer. Pasek ustawi?em na 5 sekund. Je?li co? nie b?dzie dzia?a? to wina le?y po stronie Twojego kodu.
Wysłany: 2016-11-08, 08:51
Przegryw
Wiek: 23 Na forum: 3509 dni Posty: 9
Dzi?ki wszystko dzia?? . Op?aca?o si? pisa? tutaj ten post. Dzi?ki wszystkim , kt?rzy mi pomogli . Mo?na zamkna? .
Tagi: pasek :: ładowania
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: