Wysłany: 2017-08-30, 01:13
NoKill1997
Online
Wiek: 28 Na forum: 3224 dni Posty: 183
Nick w MP: Mefedroniarz.PDW
Piwa : 778
witam poiadam pewna nie dokonala prace.. Do jej doskonalosci brakuje randomowego objektu w srodku markera.. Niestety ja czegos takiego nie potrafie zrobic, dlatego zwracam sie do was z mysla, ze mi pomozecie..
O to kod na dana prace.. Mysle, ze mi z tym pomozecie
& #65279;local missionPed
local missionBlip
local missionMarker
local missionVehicle
local screenW , screenH = guiGetScreenSize ()
local code = "Praca: Wylawiania beczek z wody\n Zarobek: ?redni"
local cele = {
{- 1260.78 , 1018.87 , - 0.55 },
{- 927.69 , 733.06 , - 0.55 },
{- 1026.79 , 311.12 , - 0.55 },
{- 1072.59 , - 182.59 , - 0.55 },
{- 1110.36 , - 246.68 , - 0.55 },
}
-- local missionZaladunek = createMarker (- 1968.61 ,- 2427.98 , 30.63 , "cylinder" , 5 , 0 , 128 , 128 )
local text = createElement ( "text" )
setElementPosition ( text , - 1445.30 , 1500.87 , 1.74 )
setElementData ( text , "name" , "Praca: Wylawiania beczek z wody\n Zarobek: ?redni" )
addEvent ( "startJobek" , true )
addEventHandler ( "startJobek" , resourceRoot , function( veh )
if getElementData ( localPlayer , "player:job" ) ~= code then return end
missionVehicle = veh
showMarker ()
addEventHandler ( "onClientRender" , root , render3 )
setTimer ( renderstop3 , 1000 , 1 )
end )
function finishJob ( plr , value1 , value2 )
if plr ~= getLocalPlayer () then return end
if getElementData ( localPlayer , "player:job" ) ~= code then return end
if value1 == true then
if isElement ( missionMarker ) and missionMarker then
destroyElement ( missionMarker )
missionMarker = nil
end
if isElement ( missionBlip ) and missionBlip then
destroyElement ( missionBlip )
missionBlip = nil
end
end
if value2 == true then
if isElement ( missionVehicle ) and missionVehicle then
triggerServerEvent ( "destroyVehicle" , root , missionVehicle )
missionVehicle = nil
end
end
end
addEvent ( "onFinish" , true )
addEventHandler ( "onFinish" , resourceRoot , function( plr )
if plr ~= localPlayer then return end
finishJob ( plr , true , true )
end )
function showNextPoint ( el , md )
if not md or el ~= localPlayer then return end
local veh = getPedOccupiedVehicle ( el )
local kasa = math . random ( 370 , 740 )
if not veh then return end
if getVehicleController ( veh ) ~= localPlayer then return end
finishJob ( el , true , false )
setTimer (function()
-- playSound ( ":ogrpg-misc/misc/success.flac" )
finishJob ( true , false )
if getElementData ( veh , "praca:punkt" ) == 5 then
triggerServerEvent ( "givePlayerMoney" , el , kasa )
outputChatBox ( "* Za Wylowienie beczki otrzymujesz: " .. kasa .. " PLN" )
outputChatBox ( "* Odszukaj nast?pne beczki na GPS" )
setElementData ( veh , "praca:punkt" , 0 )
else
local xd = getElementData ( veh , "praca:punkt" ) or 0
setElementData ( veh , "praca:punkt" , xd + 1 )
triggerServerEvent ( "givePlayerMoney" , el , kasa )
outputChatBox ( "* Za Wylowienie beczki otrzymujesz: " .. kasa .. " PLN" )
outputChatBox ( "* Odszukaj nast?pne beczki na GPS" )
end
addEventHandler ( "onClientRender" , root , render4 )
setTimer ( renderstop4 , 1500 , 1 )
showMarker ()
end , 100 , 1 )
end
function showMarker ()
local losuj = math . random ( 2 , #cele)
rnd = cele
missionMarker = createMarker ( rnd [ losuj ][ 1 ], rnd [ losuj ][ 2 ], rnd [ losuj ][ 3 ]- 1 , "ring" , 5 , 255 , 255 , 255 )
missionBlip = createBlipAttachedTo ( missionMarker , 12 )
addEventHandler ( "onClientMarkerHit" , missionMarker , showNextPoint )
end
addEventHandler ( "onClientVehicleExit" , resourceRoot , function( plr , seat )
if seat ~= 0 then return end
if plr ~= localPlayer then return end
finishJob ( plr , true , true )
setElementData ( plr , "player:job" , false )
outputChatBox ( "* Zakonczyles prace" , 255 , 0 , 0 )
addEventHandler ( "onClientRender" , root , render1 )
setTimer ( renderstop1 , 500 , 1 )
end )
local zone = createColCuboid (- 1645.05 ,- 221.59 , 14.61 , 51.500002288818 )
function ucieczka ( theElement , matchingDimension )
if ( theElement == getLocalPlayer () ) then
if getElementData ( theElement , "player:job" ) ~= code then return end
finishJob ( theElement , true , true )
setElementData ( theElement , "player:job" , false )
end
end
addEventHandler ( "onClientColShapeLeave" , zone , ucieczka )
addEventHandler ( "onClientVehicleExplode" , resourceRoot , function()
if getElementModel ( source ) ~= 572 then return end
local plr = getVehicleController ( source )
if plr ~= localPlayer then return end
finishJob ( plr , true , true )
setElementData ( plr , "player:job" , false )
outputChatBox ( "* Zakonczyles prace" , 255 , 0 , 0 )
addEventHandler ( "onClientRender" , root , render1 )
setTimer ( renderstop1 , 2500 , 1 )
end )
addEventHandler ( "onClientResourceStop" , resourceRoot , function()
if getElementData ( localPlayer , "player:job" )== code then
setElementFrozen ( localPlayer , true )
setElementData ( localPlayer , "player:job" , false )
end
end , false , "high" )
local jobOnline = true -- czy praca w ?? czona
local jobMarker = createMarker (- 1445.30 , 1500.87 , 0.74 , "cylinder" , 1.2 , 96 , 96 , 96 ) -- marker
addCommandHandler ( "rozpocznij" , function( cmd )
plr = localPlayer
if isPedInVehicle ( plr ) then return end
if not isElementWithinMarker ( plr , jobMarker ) then return end
if jobOnline == false then
outputChatBox ( "* Praca jest wy??czona." , 255 , 0 , 0 )
return
end
if getElementData ( plr , "player:job" ) then
outputChatBox ( "* Ju? posiadasz aktywn? prac?." , 255 , 0 , 0 )
return
end
setElementData ( plr , "player:job" , code )
triggerServerEvent ( "startJobS" , root , localPlayer )
end )
addEventHandler ( "onClientMarkerHit" , jobMarker , function( el , md )
if el ~= localPlayer then return end
if getElementType ( el ) == "player" then
if isPedInVehicle ( el ) then return end
outputChatBox ( "* Aby rozpocz?? prac? wylawiania beczek wpisz: /rozpocznij" )
addEventHandler ( "onClientRender" , root , render2 )
setTimer ( renderstop2 , 1500 , 1 )
end
end )
function renderstop1 ()
removeEventHandler ( "onClientRender" , root , render1 )
end
function renderstop2 ()
removeEventHandler ( "onClientRender" , root , render2 )
end
function renderstop3 ()
removeEventHandler ( "onClientRender" , root , render3 )
end
function renderstop4 ()
removeEventHandler ( "onClientRender" , root , render4 )
end
function renderstop5 ()
removeEventHandler ( "onClientRender" , root , render5 )
end [/quote]
Ostatnio zmieniony przez NoKill1997 2017-08-30, 04:06, w całości zmieniany 1 raz
Wysłany: 2017-08-30, 02:57
nanKy
Wiek: 22 Na forum: 3866 dni Posty: 498
Nick w MP: nanky
Piwa : 1773
Wpakuj to w [lua] nie w [code] bo nie rozczytam..
Wysłany: 2017-09-07, 18:32
NoKill1997
Online
Wiek: 28 Na forum: 3224 dni Posty: 183
Nick w MP: Mefedroniarz.PDW
Piwa : 778
@ref
Podpis
Aktualny projekt: LSgame
Na scenie MTA od: 2015 roku.
Discord: Chwilowoo, brak
Wysłany: 2017-09-07, 19:37
mixLoLmix2
Programista
Wiek: 35 Na forum: 4113 dni Posty: 454
Nick w MP: TomeQmix
Piwa : 1915
NoKill1997 , Opisz bardziej problem gdy? nie rozumiem
[ Dodano : 2017-09-07, 19:43 ]
A Czekaj ju? chyba rozumiem chodzi o to ?e w celu ma znajdowa? sie np. beczka albo skrzynia? To czekaj ju? ci pisze:
local cele = {
{- 1260.78 , 1018.87 , - 0.55 },
{- 927.69 , 733.06 , - 0.55 },
{- 1026.79 , 311.12 , - 0.55 },
{- 1072.59 , - 182.59 , - 0.55 },
{- 1110.36 , - 246.68 , - 0.55 },
}
Do tych dopisz ID Modelu kt?re ma by? przepisane do obiektu
przyk?ad:
local cele = {
{- 1260.78 , 1018.87 , - 0.55 , 1000 },
}
Jesli chodzi aby w ka?dym by?o losowe r?znie to piszesz tak:
local obiekty = {
--{ IDObiektu },
{ 1000 },
{ 1001 },
-- I tak dalej
}
Potem:
local losuj = math . random ( 2 , #obiekty)
createObject ( Kordy , obiekty [ losuj ][ 1 ])
Do kord?w u?yj te rnd Jak wy?ej
Podpis
Zajmuję się pisaniem zaawansowanych skryptów lua na zamówienie za bardzo niską cene.
Oraz pomoc przy serwerze mta/forum i tym podobnych.
Discord: TomeQmix#7106
Wysłany: 2017-09-07, 20:16
NoKill1997
Online
Wiek: 28 Na forum: 3224 dni Posty: 183
Nick w MP: Mefedroniarz.PDW
Piwa : 778
"mixLoLmix2" napisał/a :NoKill1997 , Opisz bardziej problem gdy? nie rozumiem
[ Dodano : 2017-09-07, 19:43 ]
A Czekaj ju? chyba rozumiem chodzi o to ?e w celu ma znajdowa? sie np. beczka albo skrzynia? To czekaj ju? ci pisze:
local cele = {
{- 1260.78 , 1018.87 , - 0.55 },
{- 927.69 , 733.06 , - 0.55 },
{- 1026.79 , 311.12 , - 0.55 },
{- 1072.59 , - 182.59 , - 0.55 },
{- 1110.36 , - 246.68 , - 0.55 },
}
Do tych dopisz ID Modelu kt?re ma by? przepisane do obiektu
przyk?ad:
local cele = {
{- 1260.78 , 1018.87 , - 0.55 , 1000 },
}
Jesli chodzi aby w ka?dym by?o losowe r?znie to piszesz tak:
local obiekty = {
--{ IDObiektu },
{ 1000 },
{ 1001 },
-- I tak dalej
}
Potem:
local losuj = math . random ( 2 , #obiekty)
createObject ( Kordy , obiekty [ losuj ][ 1 ])
Do kord?w u?yj te rnd Jak wy?ej
Nie dziala ;C
Wysłany: 2017-09-07, 20:55
mixLoLmix2
Programista
Wiek: 35 Na forum: 4113 dni Posty: 454
Nick w MP: TomeQmix
Piwa : 1915
To jest przyk?ad na kt?rym mo?esz sie wzorowa?...
Jesli masz poj?cie o lua sam to sobie zrobisz z tego przyk?adu
Dam podpowiedz: Kordy dajesz z cel?w
Podpis
Zajmuję się pisaniem zaawansowanych skryptów lua na zamówienie za bardzo niską cene.
Oraz pomoc przy serwerze mta/forum i tym podobnych.
Discord: TomeQmix#7106
Tagi: objekt :: markerze
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: