Wysłany: 2019-01-20, 21:10
Pyrek24
Wiek: 25 Na forum: 3438 dni Posty: 546
Nick w MP: Pyrek
Piwa : 10
Witam ot?? chcia?bym by kto? pom?g?, chcia?bym co? w tym stylu, jak rozpoczn? prac?, to wje?d?am do punktu, po czym teleportuje mnie na miejsce, ja bym chcia?, by np trzeba by?o do 10 punkt?w wjecha? i dopiero teleportacja na baz?.
kod
c.lua
-- PRACA DORYWCZA BY ADIKOO1302 --
-- Autorem skryptu jest Adikoo1302 --
-- Pomagali mi nanKy , NeQ .--
-- Zakazuj ? udost ? pniania oraz zmiany autora --
-- Zakazuj ? edycji kodu do 5 linijki --
-- SKALOWANIE GUI --
local screenW , screenH = guiGetScreenSize ()
local w , h = ( screenW / 1280 ), ( screenH / 1024 )
--------------------------------------------
local job_marker = createMarker (- 2520.834960937 , - 623.51525878906 , 131.75 , "cylinder" , 1 , 252 , 69 , 45 )
--------------------------------------------
local guion = false
job_activate = false
--------------------------------------------
local target_possition = {
{- 2106.9226074219 , - 757.84686279297 , 31.75 },
{- 2286.3168945313 , - 13.998096466064 , 34.75 },
{- 2098.3623046875 , 855.49481201172 , 68.75 }
}
function isMouseInPosition ( x , y , width , height )
if ( not isCursorShowing ( ) ) then
return false
end
local sx , sy = guiGetScreenSize ( )
local cx , cy = getCursorPosition ( )
local cx , cy = ( cx * sx ), ( cy * sy )
if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
return true
else
return false
end
end
function job_gui ()
dxDrawImage ( 450 * w , 300 * h , 453 * w , 420 * h , "images/background.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawImage ( 575 * w , 630 * h , 187 * w , 58 * h , "images/button.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawImage ( 880 * w , 305 * h , 16 * w , 16 * h , "images/exit.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
end
addEventHandler ( "onClientMarkerHit" , job_marker , function()
guion = true
addEventHandler ( "onClientRender" , root , job_gui )
showCursor ( true )
end )
addEventHandler ( "onClientClick" , root , function( button , state )
if state == 'down' then
if guion == true then
if isMouseInPosition ( 880 * w , 305 * h , 16 * w , 16 * h ) then
removeEventHandler ( "onClientRender" , root , job_gui )
showCursor ( false )
guion = false
end
if isMouseInPosition ( 575 * w , 630 * h , 187 * w , 58 * h ) then
if job_activate == false then
removeEventHandler ( "onClientRender" , root , job_gui )
showCursor ( false )
guion = false
job_activate = true
local Possition = target_possition [ math . random ( #target_possition)]
job_blip = createBlip ( Possition [ 1 ], Possition [ 2 ], Possition [ 3 ], 56 )
job_marker_target = createMarker ( Possition [ 1 ], Possition [ 2 ], Possition [ 3 ], "cylinder" , 1 , 252 , 69 , 45 )
addEventHandler ( "onClientMarkerHit" , job_marker_target , function()
local job_pay = math . random ( 500 , 2500 )
outputChatBox ( "Gratulacje ! Zako?czy?e? prac? pomy?lnie !" )
outputChatBox ( "Twoje wynagrodzenie to " .. job_pay .. "$ !" )
setElementPosition ( localPlayer , - 2520.8732910156 , - 621.10137939453 , 132.72 )
givePlayerMoney ( job_pay )
job_activate = false
destroyElement ( job_marker_target )
destroyElement ( job_blip )
triggerServerEvent ( "deleteJobCar" , localPlayer )
end )
triggerServerEvent ( "createJobCar" , localPlayer )
outputChatBox ( "Pami?taj, ?e w punkt docelowy musisz wej?? postaci? !" )
else
outputChatBox ( "Ju? pracujesz !" )
end
end
end
end
end )
addEvent ( "damageCarClient" , true )
addEventHandler ( "damageCarClient" , root , function()
if job_activate == true then
job_activate = false
outputChatBox ( "Tw?j pojazd odni?s? zbyt wielkie uszkodzenia." )
outputChatBox ( "Praca zako?czona niepowodzeniem !" )
destroyElement ( job_blip )
destroyElement ( job_marker_target )
end
end )
s.lua
addEvent ( "createJobCar" , true )
addEventHandler ( "createJobCar" , root , function()
job_car = createVehicle ( 482 , - 2534.052734375 , - 614.11260986328 , 132.54760742188 )
end )
addEvent ( "deleteJobCar" , true )
addEventHandler ( "deleteJobCar" , root , function()
destroyElement ( job_car )
end )
addEventHandler ( "onVehicleDamage" , root , function()
if source == job_car then
if getElementHealth ( source ) <= 350 then
local thePlayer = getVehicleController ( source )
triggerClientEvent ( thePlayer , "damageCarClient" , thePlayer )
destroyElement ( job_car )
setElementPosition ( thePlayer , - 2520.8732910156 , - 621.10137939453 , 132.72 )
end
end
end )
Za pomoc daj? zimne piwko oraz repsekt !
Wysłany: 2019-01-20, 21:31
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
Z ka?dym oddaniem listu dodawaj do zmiennej np. "oddaneListy" 1.
Z ka?dym oddanym listem sprawdzaj, czy zmienna "oddaneListy" r?wna si? 10, je?li b?dzie si? r?wna?a wyznacz tras? do bazy - je?li nie, r?b dalej markery w miejscu, gdzie pracownik ma dojecha?.
Przyk?ad:
local oddaneListy = 0
addEventHandler ( "onClientMarkerHit" , getResourceRootElement (), function( plr , md )
if ( plr ~= getLocalPlayer ()) or ( not md ) then return end
if oddaneListy == 10 then
outputChatBox ( "Odda?e? ju? 10 list?w, wr?? do bazy." )
return
end
oddaneListy = oddaneListy + 1
createMarker ( pozycjaX , pozycjaY , pozycjaZ )
end )
Wysłany: 2019-01-22, 12:10
Pyrek24
Wiek: 25 Na forum: 3438 dni Posty: 546
Nick w MP: Pyrek
Piwa : 10
Mordko poniek?d niezbyt kumam m?g?by? mi to w kod wstawi? bardzo prosz?.
[ Dodano : 2019-01-22, 16:45 ]
Wilq m?g?by? mi to jako? podstawi? do kodu bardzo prosz?.
Tagi: punkty :: listonoszu
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: