Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2016-06-11, 16:49


Aski







Wiek: 30
Na forum: 4123 dni
Posty: 10



Respekt: 50

Witam mam ma?y problem a mianowicie chcia? bym aby pojazd o ID wyznaczonym wje?d?aj?c w ostatni marker o numerze [22], niszczy? pojazd.


local rootElement getRootElement()
local busses = {[431] = true, [437] = true}
local busTable = {
[1]={-2090.9501277.27514.45},[2]={-2289.299801179.6131654.51567},[3]={-2477.300051200.8084736.08991},[4]={-2661.650881173.0803255.85931},[5]={-2458.847661089.9514256.03101},
[6]={-2279.136231051.4809655.98920},[7]={-2006.675661027.5286956.00063},[8]={-2007.32776819.9393345.71822},[9]={-2006.00781575.7905335.46132},[10]={-2108.33936568.4595935.45186},
[11]={-2228.92725548.6508835.44595},[12]={-2235.86646447.2400535.41224},[13]={-2256.37109348.1699833.39291},[14]={-2236.14771318.4017635.60799},[15]={-2018.66406318.2494535.44624},
[16]={-1926.19385340.2691731.87311},[17]={-1846.91760403.6918617.43918},[18]={-1726.76489323.275307.46830},[19]={-1548.17590718.315067.47321},[20]={-1525.62781908.496777.47321},
[21]={-1637.184331253.721447.46522},[22]={-1988.395631312.314097.48742},}

createBlip(1256.6, -1812.213.41553002552550250)

function getNewBusLocation(thePlayerID)
local xybusTable[ID][1], busTable[ID][2], busTable[ID][3]
triggerClientEvent(thePlayer,"bus_set_location",thePlayer,x,y,z)
end

function bustpr(thePlayer)
    local theVehicle getPedOccupiedVehicle (thePlayer)
    local id getElementModel(theVehicle)
    if id == 431 or id == 437 then
        local xygetNewBusLocation(thePlayer1)
        setElementData(thePlayer,"buszp",0)
        setElementData(thePlayer,"busData",1)
    else
    end
end
addEventHandler("onVehicleEnter",rootElement,bustpr)

function busStart(thePlayer)
    local theVehicle getPedOccupiedVehicle (thePlayer)
    local id getElementModel(theVehicle)
    if id == 431 or id == 437 then
        outputChatBox("Zaczynasz prac? kierow!cy Bus/Tpr"thePlayer2552550)
    end
end
addEventHandler("onVehicleEnter",rootElement,busStart)

addEvent("bus_finish",true)
addEventHandler("bus_finish",rootElement,
function (client)
if not isPedInVehicle(clientthen return end
if not busses[getElementModel(getPedOccupiedVehicle(client))] then return end
local zarp getElementData(client"buszp")
local money math.random(10,20)
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(clienttonumber(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) > then
            givePlayerMoney(thePlayertonumber(gpm))
            outputChatBox("Za ten przejazd zarobi?e?: " .. gpm .. "$"thePlayer0140240)
            setElementData(thePlayer"buszp"0)
        end
    end
end
addEventHandler("onVehicleExit"rootElementgiveMoney)
addEventHandler("onPlayerQuit"rootElementgiveMoney)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-11, 22:20


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4838 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

Dodaj w evencie onMarkerHit czy tam onClientMarkerHit, zale?y na kt?rej stronie to robisz

if getElementData(plejer, "busData") == 22 then
destroyElement(getPedOccupiedVehicle(plejer))
end

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-12, 17:26


Aski







Wiek: 30
Na forum: 4123 dni
Posty: 10



Respekt: 50

TAK>?


local client getLocalPlayer( )
local rootElement getRootElement()
local marker nil
local blip nil

addEvent("bus_set_location",true)
addEventHandler("bus_set_location",rootElement,
function (xyz)
marker createMarker(tostring(x), tostring(y), tostring(z)-1"checkpoint"4.000255255)
blip createBlipAttachedTomarker41300255255 )
addEventHandler("onClientMarkerHit",marker,onBusStopHit)
end)


function onBusStopHit(hitPlayer)
if not hitPlayer == client then return end
triggerServerEvent("bus_finish",client,client)
if isElement(blipthen destroyElement(blipend
if isElement(markerthen
removeEventHandler("onClientMarkerHit",marker,onBusStopHit)
destroyElement(marker) 
if getElementData(plejer"busData") == 22 then
destroyElement(getPedOccupiedVehicle(player))
end
  end
end

addEventHandler("onClientVehicleExit",rootElement,
function ()
if isElement(markerthen
removeEventHandler("onClientMarkerHit",marker,onBusStopHit)
destroyElement(markerend
if isElement(blipthen destroyElement(blipend
end)


Postaw piwo autorowi tego posta
 

 
Tagi: kończący :: marker :: destroyveh
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Kończący Marker DestroyVeh Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku