[YARDIM] Checkpoint

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı #Ricch

  • Yeni Üye
  • *
    • İleti: 17
: 08 Ağustos 2020, 17:13:13
Merhaba, İnternetten bir otobüs mesleği indirdim sorunsuz çalışıyor, ama göreve aynı anda 2 kişi girince checkpointlerde sıkıntı oluşuyor. Örneğin checkpointi ben alıyorum ama arkadaşımda da alınmış sayılıyor, arkadaşım alınca bende alınmış sayılıyor. Kodlara baktım ama çözümünü bulamadım yardımcı olursanız sevinirim.
 


MTASATURK

[YARDIM] Checkpoint
« : 08 Ağustos 2020, 17:13:13 »

Çevrimdışı MertA178

  • Oh,shit! What is these cringes? These are LUA codes bro! LUA is a terrible scripting language.
  • Deneyimli Üye
  • *
    • İleti: 381
Yanıtla #1 : 08 Ağustos 2020, 20:13:37
Linki görebilmek için Kayıt olun yada Giriş yapın.
Merhaba, İnternetten bir otobüs mesleği indirdim sorunsuz çalışıyor, ama göreve aynı anda 2 kişi girince checkpointlerde sıkıntı oluşuyor. Örneğin checkpointi ben alıyorum ama arkadaşımda da alınmış sayılıyor, arkadaşım alınca bende alınmış sayılıyor. Kodlara baktım ama çözümünü bulamadım yardımcı olursanız sevinirim.
Kodları atarsan yardımcı olabilirim.
 


Çevrimdışı #Ricch

  • Yeni Üye
  • *
    • İleti: 17
Yanıtla #2 : 09 Ağustos 2020, 13:11:48
Linki görebilmek için Kayıt olun yada Giriş yapın.
Kodları atarsan yardımcı olabilirim.

kodları atmak yerine direkt scriptin linkini atabilirim daha kolay olur.
 


Çevrimdışı MertA178

  • Oh,shit! What is these cringes? These are LUA codes bro! LUA is a terrible scripting language.
  • Deneyimli Üye
  • *
    • İleti: 381
Yanıtla #3 : 10 Ağustos 2020, 13:10:31
Linki görebilmek için Kayıt olun yada Giriş yapın.
kodları atmak yerine direkt scriptin linkini atabilirim daha kolay olur.
Sen bana serverside ve clientside at o bana yeter.
 


Çevrimdışı #Ricch

  • Yeni Üye
  • *
    • İleti: 17
Yanıtla #4 : 12 Ağustos 2020, 18:27:17
Linki görebilmek için Kayıt olun yada Giriş yapın.
Sen bana serverside ve clientside at o bana yeter.

Forumlarda yeni olduğum için iyi atamadım sanırım, umarım anlaşılır.

clientside
Spoiler for Hiden:
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)

serverside
Spoiler for Hiden:
Kod
local rootElement = getRootElement()
local busses = {[431] = true, [437] = true}
local busTable = {
[1]={1269.98, -1852.29, 13.3828},[2]={1181.87, -1796.36, 13.3984},[3]={1164.47, -1712.17, 13.7231},[4]={1038.74, -1712.84, 13.4254},[5]={1037.64, -1558.29, 13.3862},
[6]={1061.46, -1443.02, 13.4006},[7]={1051.46, -1396.45, 13.4565},[8]={825.122, -1395.14, 13.3444},[9]={648.371, -1395.33, 13.3444},[10]={635.96, -1252.67, 17.1576},
[11]={554.18, -1122.47, 27.2105},[12]={238.52, -1170.34, 19.5841},[13]={-43.18, -1354.07, 11.2299},[14]={-284.8, -1642.00, 15.5116},[15]={-354.4, -1831.65, 22.2320},
[16]={-348.6, -2125.50, 28.3879},[17]={-174.6, -2413.64, 35.6235},[18]={-36.62, -2711.40, 42.0042},[19]={-315.0, -2800.08, 57.5757},[20]={-757.3, -2764.34, 74.7090},
[21]={-1141, -2850.020, 67.7570},[22]={-1569, -2742.080, 48.5795},[23]={-1966, -2547.510, 38.2349},[24]={-2191, -2370.410, 30.5065},[25]={-2212, -2264.740, 30.5055},
[26]={-2102, -2078.130, 63.1302},[27]={-1820, -1726.650, 29.1070},[28]={-1400, -1648.350, 45.1570},[29]={-1144, -1899.890, 77.5020},[30]={-802.3, -1785.11, 92.2070},
[31]={-758.6, -1454.05, 87.8020},[32]={-652.7, -1420.18, 90.4095},[33]={-572.8, -1070.35, 23.5500},[34]={-372.0, -823.054, 28.4015},[35]={-189.6, -938.291, 35.3530},
[36]={-55.70, -858.507, 13.7823},[37]={-113.0, -402.609, 1.10380},[38]={-221.9, 187.8397, 8.88888},[39]={-63.88, 551.1700, 9.22222},[40]={323.85, 753.2600, 6.15222},
[41]={740.54, 657.1210, 10.7505},[42]={1099.8, 803.8835, 10.7070},[43]={1556.6, 831.4191, 6.80807},[44]={1785.1, 798.4346, 11.2008},[45]={1605.7, 116.6938, 37.2020},
[46]={1701.3, -644.311, 41.8010},[47]={1635.6, -884.206, 52.5121},[48]={1798.2, -1037.61, 39.4545},[49]={2223.8, -1137.70, 25.6588},[50]={2269.0, -1209.68, 23.9119},
[51]={2196.8, -1382.42, 23.8575},[52]={2110.5, -1427.29, 23.8566},[53]={2002.0, -1459.51, 13.4255},[54]={1842.8, -1508.62, 13.3936},[55]={1819.2, -1865.68, 13.4469},
[56]={1779.7, -1917.97, 13.4165},[57]={1811.2, -1890.22, 13.4372},[58]={1798.6, -1830.07, 13.4257},[59]={1680.3, -1859.67, 13.4131},[60]={1468.2, -1869.85, 13.4074},
}

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("Вы начали работу!", thePlayer, 255, 255, 0)
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(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(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("You have earned " .. gpm .. "$", thePlayer, 0, 140, 240)
setElementData(thePlayer, "buszp", 0)
end
end
end
addEventHandler("onVehicleExit", rootElement, giveMoney)
addEventHandler("onPlayerQuit", rootElement, giveMoney)

Mesaj Birleştirildi: [time]12 Ağustos 2020, 18:28:49[/time]
Linki görebilmek için Kayıt olun yada Giriş yapın.

Forumlarda yeni olduğum için iyi atamadım sanırım, umarım anlaşılır.

clientside
Spoiler for Hiden:
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)

serverside
Spoiler for Hiden:
Kod
local rootElement = getRootElement()
local busses = {[431] = true, [437] = true}
local busTable = {
[1]={1269.98, -1852.29, 13.3828},[2]={1181.87, -1796.36, 13.3984},[3]={1164.47, -1712.17, 13.7231},[4]={1038.74, -1712.84, 13.4254},[5]={1037.64, -1558.29, 13.3862},
[6]={1061.46, -1443.02, 13.4006},[7]={1051.46, -1396.45, 13.4565},[8]={825.122, -1395.14, 13.3444},[9]={648.371, -1395.33, 13.3444},[10]={635.96, -1252.67, 17.1576},
[11]={554.18, -1122.47, 27.2105},[12]={238.52, -1170.34, 19.5841},[13]={-43.18, -1354.07, 11.2299},[14]={-284.8, -1642.00, 15.5116},[15]={-354.4, -1831.65, 22.2320},
[16]={-348.6, -2125.50, 28.3879},[17]={-174.6, -2413.64, 35.6235},[18]={-36.62, -2711.40, 42.0042},[19]={-315.0, -2800.08, 57.5757},[20]={-757.3, -2764.34, 74.7090},
[21]={-1141, -2850.020, 67.7570},[22]={-1569, -2742.080, 48.5795},[23]={-1966, -2547.510, 38.2349},[24]={-2191, -2370.410, 30.5065},[25]={-2212, -2264.740, 30.5055},
[26]={-2102, -2078.130, 63.1302},[27]={-1820, -1726.650, 29.1070},[28]={-1400, -1648.350, 45.1570},[29]={-1144, -1899.890, 77.5020},[30]={-802.3, -1785.11, 92.2070},
[31]={-758.6, -1454.05, 87.8020},[32]={-652.7, -1420.18, 90.4095},[33]={-572.8, -1070.35, 23.5500},[34]={-372.0, -823.054, 28.4015},[35]={-189.6, -938.291, 35.3530},
[36]={-55.70, -858.507, 13.7823},[37]={-113.0, -402.609, 1.10380},[38]={-221.9, 187.8397, 8.88888},[39]={-63.88, 551.1700, 9.22222},[40]={323.85, 753.2600, 6.15222},
[41]={740.54, 657.1210, 10.7505},[42]={1099.8, 803.8835, 10.7070},[43]={1556.6, 831.4191, 6.80807},[44]={1785.1, 798.4346, 11.2008},[45]={1605.7, 116.6938, 37.2020},
[46]={1701.3, -644.311, 41.8010},[47]={1635.6, -884.206, 52.5121},[48]={1798.2, -1037.61, 39.4545},[49]={2223.8, -1137.70, 25.6588},[50]={2269.0, -1209.68, 23.9119},
[51]={2196.8, -1382.42, 23.8575},[52]={2110.5, -1427.29, 23.8566},[53]={2002.0, -1459.51, 13.4255},[54]={1842.8, -1508.62, 13.3936},[55]={1819.2, -1865.68, 13.4469},
[56]={1779.7, -1917.97, 13.4165},[57]={1811.2, -1890.22, 13.4372},[58]={1798.6, -1830.07, 13.4257},[59]={1680.3, -1859.67, 13.4131},[60]={1468.2, -1869.85, 13.4074},
}

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("Вы начали работу!", thePlayer, 255, 255, 0)
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(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(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("You have earned " .. gpm .. "$", thePlayer, 0, 140, 240)
setElementData(thePlayer, "buszp", 0)
end
end
end
addEventHandler("onVehicleExit", rootElement, giveMoney)
addEventHandler("onPlayerQuit", rootElement, giveMoney)
« Son Düzenleme: 12 Ağustos 2020, 18:30:34 Gönderen: #Ricch »
 


Çevrimdışı MertA178

  • Oh,shit! What is these cringes? These are LUA codes bro! LUA is a terrible scripting language.
  • Deneyimli Üye
  • *
    • İleti: 381
Yanıtla #5 : 14 Ağustos 2020, 02:31:41
Linki görebilmek için Kayıt olun yada Giriş yapın.
Forumlarda yeni olduğum için iyi atamadım sanırım, umarım anlaşılır.

clientside
Kod
local client = getLocalPlayer( )
local rootElement = getRootElement()
local marker = nil
local blip = nil

addEvent("bus_set_location",true)
addEventHandler("bus_set_location",client,
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)

serverside
Kod
local rootElement = getRootElement()
local busses = {[431] = true, [437] = true}
local busTable = {
[1]={1269.98, -1852.29, 13.3828},[2]={1181.87, -1796.36, 13.3984},[3]={1164.47, -1712.17, 13.7231},[4]={1038.74, -1712.84, 13.4254},[5]={1037.64, -1558.29, 13.3862},
[6]={1061.46, -1443.02, 13.4006},[7]={1051.46, -1396.45, 13.4565},[8]={825.122, -1395.14, 13.3444},[9]={648.371, -1395.33, 13.3444},[10]={635.96, -1252.67, 17.1576},
[11]={554.18, -1122.47, 27.2105},[12]={238.52, -1170.34, 19.5841},[13]={-43.18, -1354.07, 11.2299},[14]={-284.8, -1642.00, 15.5116},[15]={-354.4, -1831.65, 22.2320},
[16]={-348.6, -2125.50, 28.3879},[17]={-174.6, -2413.64, 35.6235},[18]={-36.62, -2711.40, 42.0042},[19]={-315.0, -2800.08, 57.5757},[20]={-757.3, -2764.34, 74.7090},
[21]={-1141, -2850.020, 67.7570},[22]={-1569, -2742.080, 48.5795},[23]={-1966, -2547.510, 38.2349},[24]={-2191, -2370.410, 30.5065},[25]={-2212, -2264.740, 30.5055},
[26]={-2102, -2078.130, 63.1302},[27]={-1820, -1726.650, 29.1070},[28]={-1400, -1648.350, 45.1570},[29]={-1144, -1899.890, 77.5020},[30]={-802.3, -1785.11, 92.2070},
[31]={-758.6, -1454.05, 87.8020},[32]={-652.7, -1420.18, 90.4095},[33]={-572.8, -1070.35, 23.5500},[34]={-372.0, -823.054, 28.4015},[35]={-189.6, -938.291, 35.3530},
[36]={-55.70, -858.507, 13.7823},[37]={-113.0, -402.609, 1.10380},[38]={-221.9, 187.8397, 8.88888},[39]={-63.88, 551.1700, 9.22222},[40]={323.85, 753.2600, 6.15222},
[41]={740.54, 657.1210, 10.7505},[42]={1099.8, 803.8835, 10.7070},[43]={1556.6, 831.4191, 6.80807},[44]={1785.1, 798.4346, 11.2008},[45]={1605.7, 116.6938, 37.2020},
[46]={1701.3, -644.311, 41.8010},[47]={1635.6, -884.206, 52.5121},[48]={1798.2, -1037.61, 39.4545},[49]={2223.8, -1137.70, 25.6588},[50]={2269.0, -1209.68, 23.9119},
[51]={2196.8, -1382.42, 23.8575},[52]={2110.5, -1427.29, 23.8566},[53]={2002.0, -1459.51, 13.4255},[54]={1842.8, -1508.62, 13.3936},[55]={1819.2, -1865.68, 13.4469},
[56]={1779.7, -1917.97, 13.4165},[57]={1811.2, -1890.22, 13.4372},[58]={1798.6, -1830.07, 13.4257},[59]={1680.3, -1859.67, 13.4131},[60]={1468.2, -1869.85, 13.4074},
}

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("Вы начали работу!", thePlayer, 255, 255, 0)
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(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(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("You have earned " .. gpm .. "$", thePlayer, 0, 140, 240)
setElementData(thePlayer, "buszp", 0)
end
end
end
addEventHandler("onVehicleExit", rootElement, giveMoney)
addEventHandler("onPlayerQuit", rootElement, giveMoney)

Kodu yanlış attın queto ile editledim.Fixlendi.Test etmedim ama dene.
 


MTASATURK

Ynt: [YARDIM] Checkpoint
« Yanıtla #5 : 14 Ağustos 2020, 02:31:41 »