Wysłany: 2014-08-24, 16:21
PanPrezes
Wiek: 32 Na forum: 4555 dni Posty: 63
Nick w MP: PanPrezes
Piwa : 979
Witam Dzi? Mam Taki Malutki Problemik Napisa?em Skrypt Na Prace I Wszystko chodzi jak powinno ale jak jaki? gracz jedzie autobusem przejedzie tam kr?tka trase to mu marker znika nie wiem dlaczego i jeszcze chcia?em doda? strza?ki do markeru mog? pro?i? o pomoc? Daje Za To Piwko
Kod: local rootElement = getRootElement()
local busses = {[431] = true, [437] = true}
local busTable = {
[1]={-1996.4470214844,379.43576049805,35.171875},
[2]={-2007.8438720703,336.40795898438,35.008541107178},
[3]={-2009.8411865234,197.1520690918,27.5390625},
[4]={-2010.1843261719,59.520092010498,29.834575653076},
[5]={-2010.2524414063,-54.026466369629,35.164978027344},
[6]={-2067.0246582031,-67.16739654541,35.171875},
[7]={-2162.9643554688,-68.425895690918,35.171875},
[8]={-2250.7734375,-67.855659484863,35.171875},
[9]={-2260.4738769531,-185.36517333984,35.171875},
[10]={-2260.5124511719,-301.62814331055,48.613830566406},
[11]={-2233.7265625,-421.04275512695,50.8671875},
[12]={-2196.0029296875,-491.45596313477,47.895545959473},
[13]={-2226.4877929688,-602.08599853516,57.236404418945},
[14]={-2253.1630859375,-748.44152832031,72.404777526855},
[15]={-2352.8896484375,-759.8037109375,97.19506072998},
[16]={-2423.6298828125,-603.15399169922,132.5625},
[17]={-2423.6298828125,-603.15399169922,132.5625},
[18]={-2423.6298828125,-603.15399169922,132.5625},
[19]={-2470.5166015625,-486.02484130859,101.93739318848},
[20]={-2626.068359375,-493.94964599609,70.118896484375},
[21]={-2491.7160644531,-448.84432983398,76.784202575684},
[22]={-2320.28125,-454.25280761719,80.012298583984},
[23]={-2406.7470703125,-369.13330078125,74.081993103027},
[24]={-2679.62109375,-430.97918701172,31.258207321167},
[25]={-2698.3825683594,-527.51885986328,13.643754959106},
[26]={-2778.2751464844,-489.82287597656,7.1781692504883},
[27]={-2810.0668945313,-464.84555053711,7.0752429962158},
[28]={-2809.8161621094,-299.99243164063,7.03125},
[29]={-2805.8859863281,-177.39862060547,7.03125},
[30]={-2806.6481933594,-74.023094177246,7.03125},
[31]={-2769.3010253906,-72.217994689941,7.0390625},
[32]={-2620.0239257813,-72.897979736328,4.1796875},
[33]={-2480.6379394531,-73.049613952637,28.182262420654},
[34]={-2345.0307617188,-73.479095458984,35.1640625},
[35]={-2230.7770996094,-73.325637817383,35.171875},
[36]={-2165.4875488281,-70.257102966309,35.171875},
[37]={-2165.4880371094,18.041673660278,35.171875},
[38]={-2145.7492675781,143.9535369873,35.171875},
[39]={-2144.1989746094,300.56698608398,35.171875},
[40]={-2138.8798828125,471.0751953125,35.015625},
[41]={-2085.1743164063,501.44030761719,35.015625},
[42]={-2008.8236083984,502.03579711914,34.991283416748},
[43]={-2008.6317138672,388.59994506836,35.015625},
[44]={-1981.0555419922,378.69314575195,35.292011260986},
}
createBlip(1256.6, -1812.2, 13.41, 55, 3, 0, 0, 255, 255, 0, 250)
function getNewBusLocation(thePlayer, ID)
local x, y, z = busTable[ID][1], busTable[ID][2], busTable[ID][3]
triggerClientEvent(thePlayer,"bus_set_location",thePlayer,x,y,z)
end
function busJob(thePlayer)
local theVehicle = getPedOccupiedVehicle (thePlayer)
local id = getElementModel(theVehicle)
if id == 431 or id == 437 then
local x, y, z = getNewBusLocation(thePlayer, 1)
setElementData(thePlayer,"buszp",0)
setElementData(thePlayer,"busData",1)
else
end
end
addEventHandler("onVehicleEnter",rootElement,busJob)
function busStart(thePlayer)
local theVehicle = getPedOccupiedVehicle (thePlayer)
local id = getElementModel(theVehicle)
if id == 431 or id == 437 then
outputChatBox("Rozpocz?to Prace!!!",thePlayer, 255, 255, 255)
end
end
addEventHandler("onVehicleEnter",rootElement,busStart)
addEvent("bus_finish",true)
addEventHandler("bus_finish",rootElement,
function (client)
if not isPedInVehicle(client) then return end
if not busses[getElementModel(getPedOccupiedVehicle(client))] then return end
local zarp = getElementData(client, "buszp")
local money = math.random(50)
setElementData(client, "buszp", zarp + money)
if #busTable == tonumber(getElementData(client,"busData")) then
setElementData(client,"busData",1)
else
setElementData(client,"busData",tonumber(getElementData(client,"busData"))+1)
end
getNewBusLocation(client, tonumber(getElementData(client,"busData")))
end)
function giveMoney(thePlayer)
local theVehicle = getPedOccupiedVehicle (thePlayer)
local id = getElementModel(theVehicle)
if id == 431 or 437 then
local gpm = getElementData(thePlayer, "buszp")
if ((gpm) > 0 ) then
givePlayerMoney(thePlayer, tonumber(gpm))
outputChatBox("Dostajesz " .. gpm .. " Euro Za Prace", thePlayer, 255, 255, 261)
setElementData(thePlayer, "buszp", 0)
end
end
end
addEventHandler("onVehicleExit", rootElement, giveMoney)
addEventHandler("onPlayerQuit", rootElement, giveMoney)
Po Stronie Client
Kod: local client = getLocalPlayer( )
local rootElement = getRootElement()
local marker = nil
local blip = nil
addEvent("bus_set_location",true)
addEventHandler("bus_set_location",rootElement,
function (x, y, z)
marker = createMarker(tostring(x), tostring(y), tostring(z)-1, "checkpoint", 4.0, 0, 0, 255, 255)
blip = createBlipAttachedTo( marker, 41, 3, 0, 0, 255, 255 )
addEventHandler("onClientMarkerHit",marker,onBusStopHit)
end)
function onBusStopHit(hitPlayer)
if not hitPlayer == client then return end
triggerServerEvent("bus_finish",client,client)
if isElement(blip) then destroyElement(blip) end
if isElement(marker) then
removeEventHandler("onClientMarkerHit",marker,onBusStopHit)
destroyElement(marker)
end
end
addEventHandler("onClientVehicleExit",rootElement,
function ()
if isElement(marker) then
removeEventHandler("onClientMarkerHit",marker,onBusStopHit)
destroyElement(marker)
end
if isElement(blip) then destroyElement(blip) end
end)
Wysłany: 2014-08-24, 16:46
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4394 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
Przyk?ad mojego prawa jazda, zastosuj t? metod? :
addEventHandler ( "onClientMarkerHit" , root , function ( element )
if source == marker then
if element == localPlayer then
if getElementData ( element , "PrawoJazdy:B" ) then return outputChatBox ( "Posiadasz ju? Prawo Jazdy Kat.B!" , 255 , 255 , 255 ) end
if liczba == #miejsca then
hp = getElementHealth ( getPedOccupiedVehicle ( element ) )
return triggerServerEvent ( "koniecEgzaminu" , element , tonumber ( hp ) ) end
if liczba == 0 then
outputChatBox ( "Zacz??e? egzamin Prawa Jazdy Kategoria B." , 255 , 255 , 255 )
triggerServerEvent ( "onPlayerStart" , localPlayer )
end
liczba = liczba + 1
marker = createMarker ( miejsca [ liczba ][ 1 ], miejsca [ liczba ][ 2 ], miejsca [ liczba ][ 3 ], "checkpoint" , 1.5 , 255 , 0 , 0 )
destroyElement ( source )
end
end
addEvent ( "onPlayerDestroyMarker" , true )
addEventHandler ( "onPlayerDestroyMarker" , root , function ()
if source == localPlayer then
destroyElement ( marker )
liczba = 0
marker = createMarker ( - 102.2421875 , 1231.9173583984 , 21.94800567627 , "cylinder" , 5 , 255 , 255 , 255 , 0 , 0 )
end
end )
end )
Wysłany: 2014-08-24, 16:55
PanPrezes
Wiek: 32 Na forum: 4555 dni Posty: 63
Nick w MP: PanPrezes
Piwa : 979
PanMaszyna , Tu Nie Chodzi o prawo jazdy lecz o prace wiesz? tak jak na P** nie reklamuje
Podpis
Reaktywacja zapomnianego serwera YL-Games!
Prace nad serwerem 54/100%
Wysłany: 2014-08-24, 17:07
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4394 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
Nie wa?ne, struktura ta sama.
Wysłany: 2014-08-24, 17:20
PanPrezes
Wiek: 32 Na forum: 4555 dni Posty: 63
Nick w MP: PanPrezes
Piwa : 979
PanMaszyna , Co? Nic Nie Dzia?a w db 3 pisze cos takiego:: is not encoded in UTF-8 Loading as ANSI...
Podpis
Reaktywacja zapomnianego serwera YL-Games!
Prace nad serwerem 54/100%
Wysłany: 2014-08-24, 17:23
maciek3286
LUA Developer
Wiek: 26 Na forum: 5201 dni Posty: 230
Nick w MP: maciek00
Piwa : 3207
PanPrezes , zmie? jezyk na UTF-8
Podpis
"Ludzie będą zawsze dla ciebie źli, jeżeli konieczność nie zmusi ich do tego, by byli dobrzy" ~~ Niccolò Machiavelli
Wysłany: 2014-08-24, 17:44
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4394 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
Zmie? kodowanie na UTF-8. Przypominam, ?e poda?em Ci przyk?ad, wi?c nie kopiuj tego kodu na pa?e bo i tak b?d? b?edy z racji, ?e jest to tylko c-side i to jeszcze nie ca?y.
Tagi: skrypt
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: