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

Wysłany: 2014-09-14, 15:51


Dixers

No-Life






Wiek: 26
Na forum: 4312 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

Witam serdecznie. Mam wielki problem. Pr?bowa?em sam si? z nim upora?, ale moja wiedza jest zbyt ma?a :( . Chodzi o to, ?e w pracy autobus, gdy jaki? gracz na serwerze wejdzie do autobusu ka?demu wy?wietli si? info na czacie "Zacz??e? prace kierowcy autobusu (...)" A gdy kilka os?b wejdzie do autobusu, to jeden b?dzie m?g? "kra??" przystanki drugiemu. Jak zrobi? ?eby praca by?a tak jakby dla jednego gracza. Tutaj kod:

C-side:

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

addEvent("otobus_durak_loc",true)
addEventHandler("otobus_durak_loc",rootElement,
function (xyz)
marker createMarker(tostring(x), tostring(y), tostring(z)-1"cylinder"3.50255119170)
blip createBlipAttachedTomarker020255119255 )
addEventHandler("onClientMarkerHit",marker,onBusStopHit)
end)

function onBusStopHit(hitPlayer)
if not hitPlayer == client then return end
triggerServerEvent("gorev_bitir",client,client)
if isElement(blipthen destroyElement(blipend
if isElement(markerthen
removeEventHandler("onClientMarkerHit",marker,onBusStopHit)
destroyElement(marker) 
  end
end

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


S-side:

local rootElement getRootElement()

local busses = {[437] = true}

local Duraklar = {
[1]={-2000.1877441406195.4613647460927.5390625},
[2]={-1996.1949462891338.155975341834.458801269531},
[3]={-1819.6047363281371.095428466816.494701385498},
[4]={-1658.0651855469386.405242919926.4748606681824},
[5]={-1553.6131591797661.591491699226.4819502830505},
[6]={-1530.9566650391964.947204589846.4844288825989},
[7]={-1635.79968261721257.12756347666.4874968528748},
[8]={-1988.25439453131314.44702148446.4815640449524},
[9]={-2326.47827148441374.06750488286.4832334518433},
[10]={-2625.2636718751314.59777832036.485456943512},
[11]={-2826.7387695313876.9908447265643.349967956543},
[12]={-2844.07421875511.334838867194.1004056930542},
[13]={-2812.3327636719205.658416748056.4744448661804},
[14]={-2748.7412109375, -213.974441528326.4776849746704},
[15]={-2452.6572265625, -213.5568695068432.926258087158},
[16]={-2396.435546875, -73.81261444091834.608352661133},
[17]={-2237.5100097656, -73.67718505859434.61568069458},
[18]={-2033.1370849609, -73.50535583496134.616176605225},
[19]={-2002.874511718894.3330917358426.984334945679},
[20]={-1988.1975097656165.1036224365226.983469009399},
}

function yeniDurak(thePlayerID)
local xyDuraklar[ID][1], Duraklar[ID][2], Duraklar[ID][3]
triggerClientEvent(thePlayer,"otobus_durak_loc",thePlayer,x,y,z)
end

function onVehicleEnter(thePlayer)
if not busses[getElementModel(source)] then return end
outputChatBox ("Zacz??e? prace kierowcy autobusu. Na ka?dym przystanku zatrzymaj si? na 8sek. Pami?taj, aby nie opuszcza? pojazdu.")
local xyyeniDurak(thePlayer1)
setElementData(thePlayer,"Data",1)
  end
addEventHandler("onVehicleEnter",rootElement,onVehicleEnter)

addEvent("gorev_bitir",true)
addEventHandler("gorev_bitir",rootElement,
function (client)
if not isPedInVehicle(clientthen return end
if not busses[getElementModel(getPedOccupiedVehicle(client))] then return end
givePlayerMoney(client3)
if #Duraklar == tonumber(getElementData(client,"Data")) then
setElementData(client,"Data",1)
else
setElementData(client,"Data",tonumber(getElementData(client,"Data"))+1)
end
yeniDurak(clienttonumber(getElementData(client,"Data")))
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-14, 15:57


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Dixers, sprawdz kto prowadzi i temu daje :D ??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-14, 16:02


Dixers

No-Life






Wiek: 26
Na forum: 4312 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

luki123luki123, tak, dok?adnie. Pomo?esz? Oferuj? kilka piw i reputacje +10 :D

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-14, 16:07


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Dixers, przy pomocy if'a
 if seat == 0 then 


[ Dodano: 2014-09-14, 16:10 ]
@Upade:

Więcej informacji znajdziesz w Wikipedii MTA:

getVehicleOccupant


[ Dodano: 2014-09-14, 16:12 ]
local driver == getVehicleOccupant Pojazd.., )
if getPlayerName driver then
--//Kwoj kod
end


[ Dodano: 2014-09-14, 16:56 ]
Gdzie moje Piwka i RESP ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-14, 17:52


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

luki123luki123, nie b?d? nachalny i nie pro? si? o piwa i reputacje, bo to ?wiadczy o braku kultury.

Mo?esz zrobi? tak?e sposobem moim, czyli po tworzeniu markera nadaje mu setElementDate z nickiem gracza intergowanego. Nast?pnie p?tla na markery i if bla == nick gracza to tworzy funckj? kolejn?.

Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-14, 18:00


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Shuffle, po co nadawa? kolejne warto?ci gracowi lepiej to zrobi? pro?ciej i l?ej dla serwera.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-14, 20:30


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Graczowi? Warto?? jest nadawana dla markera, kt?ry i tak jest usuwany.

Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-14, 21:12


Dixers

No-Life






Wiek: 26
Na forum: 4312 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

luki123luki123, po pierwsze mnie nie by?o, wi?c nie mog?em ci da? piwa i repu. I czy m?g?by? mi to wsadzi? w m?j kod? By?bym wdzi?czny, otrzymasz 5 piw :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-15, 16:06


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Dixers,
local rootElement getRootElement()

local busses = {[437] = true}

local Duraklar = {
[1]={-2000.1877441406195.4613647460927.5390625},
[2]={-1996.1949462891338.155975341834.458801269531},
[3]={-1819.6047363281371.095428466816.494701385498},
[4]={-1658.0651855469386.405242919926.4748606681824},
[5]={-1553.6131591797661.591491699226.4819502830505},
[6]={-1530.9566650391964.947204589846.4844288825989},
[7]={-1635.79968261721257.12756347666.4874968528748},
[8]={-1988.25439453131314.44702148446.4815640449524},
[9]={-2326.47827148441374.06750488286.4832334518433},
[10]={-2625.2636718751314.59777832036.485456943512},
[11]={-2826.7387695313876.9908447265643.349967956543},
[12]={-2844.07421875511.334838867194.1004056930542},
[13]={-2812.3327636719205.658416748056.4744448661804},
[14]={-2748.7412109375, -213.974441528326.4776849746704},
[15]={-2452.6572265625, -213.5568695068432.926258087158},
[16]={-2396.435546875, -73.81261444091834.608352661133},
[17]={-2237.5100097656, -73.67718505859434.61568069458},
[18]={-2033.1370849609, -73.50535583496134.616176605225},
[19]={-2002.874511718894.3330917358426.984334945679},
[20]={-1988.1975097656165.1036224365226.983469009399},
}

function yeniDurak(thePlayerID)
local xyDuraklar[ID][1], Duraklar[ID][2], Duraklar[ID][3]
triggerClientEvent(thePlayer,"otobus_durak_loc",thePlayer,x,y,z)
end

function onVehicleEnter(thePlayer)
if not busses[getElementModel(source)] then return end
outputChatBox ("Zacz??e? prace kierowcy autobusu. Na ka?dym przystanku zatrzymaj si? na 8sek. Pami?taj, aby nie opuszcza? pojazdu.")
local xyyeniDurak(thePlayer1)
setElementData(thePlayer,"Data",1)
  end
addEventHandler("onVehicleEnter",rootElement,onVehicleEnter)

addEvent("gorev_bitir",true)
addEventHandler("gorev_bitir",rootElement,
function (client)
    if not isPedInVehicle(clientthen return end
        if not busses[getElementModel(getPedOccupiedVehicle(client))] then return end
        local driver == getVehicleOccupant getPedOccupiedVehicle(client), )
            if driver then
            givePlayerMoney(client3)
                if #Duraklar == tonumber(getElementData(client,"Data")) then
                setElementData(client,"Data",1)
                else
                setElementData(client,"Data",tonumber(getElementData(client,"Data"))+1)
                end
            yeniDurak(clienttonumber(getElementData(client,"Data")))
            end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-15, 19:25


Dixers

No-Life






Wiek: 26
Na forum: 4312 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

luki123luki123, dzi?ki luki. Jeste? super. Leci kolejne :piwo:

Postaw piwo autorowi tego posta
 

 
Tagi: praca :: jeden :: gracz
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA 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