marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
Witam u?ywam
s- side
--[[
Praca rybaka
@ copyright 2013 - 2014 Split < split @ go - life . pl >
@ author Split < split @ go - life . pl >
Nie masz prawa u ? ywac tego kodu bez mojej zgody .
Napisz do mnie by ? mo ? e si ? zgodz ? na u ? ycie kodu .
]]--
local m1 = createMarker (- 1974.14 , 160.63 , 27.69 - 0.8 , "cylinder" , 2.0 , 255 , 0 , 0 )
local blip = createBlip (- 1974.14 , 160.63 , 27.69 - 0.8 , 52 )
vehs = {}
function removePreviousVehicles ( plr )
for i , v in ipairs ( getElementsByType ( "vehicle" , resourceRoot )) do
local sby = getElementData ( v , "zrespilGracz" )
if sby and sby == plr and getPedOccupiedVehicle ( plr ) ~= v then
destroyElement ( v )
end
end
end
addEventHandler ( "onMarkerHit" , m1 , function( el , md )
if getElementData ( el , "zrespilGracz" ) then
outputChatBox ( "praca w trakcie poprawek" , el )
return
end
if not md or getElementType ( el ) ~= "player" or getPedOccupiedVehicle ( el ) then return end
local x , y , z = getElementPosition ( el )
local bus = createVehicle ( 537 , x , y , z , 180 , 0.0 , 0.4 )
setElementData ( bus , "zrespilGracz" , el )
setElementData ( bus , "pojazd_paliwo" , 100 )
setElementData ( bus , "pojazd_przebieg" , 14564 )
warpPedIntoVehicle ( el , bus )
removePreviousVehicles ( el )
triggerClientEvent ( el , "STARTJobBus" , resourceRoot , bus )
vehs [ el ] = bus
end )
addEvent ( "STOPJobBus" , true )
addEventHandler ( "STOPJobBus" , resourceRoot , function()
local pojazd = getPedOccupiedVehicle ( localPlayer )
if pojazd then
destroyElement ( pojazd )
end
end )
addEvent ( "destroyVeh" , true )
addEventHandler ( "destroyVeh" , getRootElement (),
function()
if vehs [ source ] then
if isElement ( vehs [ source ]) then destroyElement ( vehs [ source ]) end
end
end )
c-side
--[[
Praca busa
@ copyright 2013 - 2014 Split < split @ go - life . pl >
@ author Split < split @ go - life . pl >
@ version 1.0 beta
@ changelog :
* Poprawiono prac ?.
Nie masz prawa u ? ywac tego kodu bez mojej zgody .
Napisz do mnie by ? mo ? e si ? zgodz ? na u ? ycie kodu .
]]--
local districtsBus = {
{- 1944.00 ,- 68.59 , 27.76 },
{- 1951.20 ,- 241.22 , 27.76 },
{- 1979.62 ,- 584.51 , 27.97 },
{- 1176.12 ,- 1517.47 , 42.79 },
{- 801.06 ,- 1185.03 , 68.30 },
{- 386.50 ,- 1244.08 , 43.85 },
{ 55.67 ,- 1017.64 , 23.55 },
{ 808.23 ,- 1360.02 , 0.56 },
{ 1741.79 ,- 1953.31 , 15.63 },
{ 2198.16 ,- 1865.81 , 15.88 },
{ 2284.35 ,- 1380.21 , 26.17 },
{ 2155.51 ,- 673.78 , 54.08 },
{ 2170.56 ,- 357.12 , 54.32 },
{ 2765.57 ,- 244.33 , 23.66 },
{ 2806.56 , 163.45 , 19.20 },
{ 2764.29 , 918.25 , 13.01 },
{ 2856.62 , 1527.66 , 12.88 },
{ 2780.54 , 1906.59 , 7.98 },
{ 2548.28 , 2521.18 , 12.88 },
{ 2385.43 , 2689.66 , 12.88 },
{ 2086.06 , 2693.66 , 13.10 },
{ 1583.99 , 2631.79 , 12.88 },
{ 1241.35 , 2631.79 , 12.88 },
{ 746.40 , 2489.46 , 22.63 },
{ 735.76 , 2241.82 , 20.02 },
{ 742.23 , 1881.28 , 8.00 },
{ 660.89 , 1320.52 , 13.88 },
{ 187.18 , 1249.83 , 24.88 },
{- 299.47 , 1255.29 , 31.57 },
{- 688.91 , 1164.05 , 31.69 },
{- 946.82 , 986.62 , 36.63 },
{- 1343.01 , 698.75 , 36.63 },
{- 1684.21 , 450.90 , 16.28 },
{- 1942.97 , 155.63 , 27.76 },
}
local jobTarget
local jobMarker
local jobVehicle
local maxTarget = #districtsBus
function finishJob ()
if jobMarker and isElement ( jobMarker ) then
destroyElement ( jobMarker )
jobMarker = nil
end
if jobTarget and isElement ( jobTarget ) then
destroyElement ( jobTarget )
jobTarget = nil
jobTarget = 0
end
triggerServerEvent ( "destroyVeh" , localPlayer )
end
function busDriver ( el , md )
if el ~= localPlayer or not md then return end
if jobTarget > maxTarget and getPedOccupiedVehicle ( el ) then return end
if jobTarget == maxTarget and not getPedOccupiedVehicle ( el ) then return end
if jobTarget == #districtsBus then
finishJob ()
playSoundFrontEnd ( 5 )
outputChatBox ( "* Zako?czy?e?/-a? prac?." )
else
showMarker ()
playSoundFrontEnd ( 12 )
triggerServerEvent ( "givePlayerMoney" , localPlayer , 2 , 0 )
end
end
function showMarker ()
if jobMarker and isElement ( jobMarker ) then
destroyElement ( jobMarker )
jobMarker = nil
end
jobTarget = jobTarget + 1
jobMarker = createMarker ( districtsBus [ jobTarget ][ 1 ], districtsBus [ jobTarget ][ 2 ], districtsBus [ jobTarget ][ 3 ], "checkpoint" , 4 , 0 , 0 , 255 )
if districtsBus [ jobTarget + 1 ] then
ile = districtsBus [ jobTarget + 1 ]
setMarkerTarget ( jobMarker , ile [ 1 ], ile [ 2 ], ile [ 3 ])
end
addEventHandler ( "onClientMarkerHit" , jobMarker , busDriver )
end
addEvent ( "STARTJobBus" , true )
addEventHandler ( "STARTJobBus" , resourceRoot , function( veh )
outputChatBox ( "* Rozpocz??e?/-a? prac?." )
jobVehicle = veh
jobTarget = 0
showMarker ()
end )
addEventHandler ( "onClientResourceStop" , resourceRoot , function()
if jobVehicle and getElementData ( localPlayer , "gracz_praca" ) then
setElementData ( localPlayer , "gracz_praca" , false )
end
end )
addEventHandler ( "onClientVehicleExit" , resourceRoot , function( plr , seat )
if seat == 0 then
if plr == localPlayer then
finishJob ()
outputChatBox ( "* Zako?czy?e?/-a? prac?" )
end
end
end )
Jest to praca maszynisty pociagu a problem jest taki, ze ani w tej ani zadnej innej nie daje pieniedzy za prace.
DB:
[2016-03-06 22:07] ERROR: Client (|PSP|Ml.Bryg|Marcin) triggered serverside event givePlayerMoney, but event is not added serverside