Jump to content

Erema93

Members
  • Posts

    60
  • Joined

  • Last visited

Everything posted by Erema93

  1. Первый вопрос актуален Второй вопрос: кто сожет сделать скрипт поднятия\опускания пантографа на жд транспорте?
  2. Как в GUI окне вывести информацию об игроке (уровень,опыт ,права и т.д.)? Вот код окна GUIEditor = { button = {}, window = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(807, 516, 356, 355, "Статистика", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 1.00) guiSetProperty(GUIEditor.window[1], "CaptionColour", "C8FFFFFF") GUIEditor.button[1] = guiCreateButton(31, 348, 15, 0, "", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(141, 330, 84, 15, "Закрыть", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "default-bold-small") GUIEditor.label[1] = guiCreateLabel(13, 66, 217, 40, "Никнейм", false, GUIEditor.window[1]) GUIEditor.label[2] = guiCreateLabel(13, 91, 102, 15, "Уровень", false, GUIEditor.window[1]) GUIEditor.label[3] = guiCreateLabel(13, 116, 105, 15, "Опыт", false, GUIEditor.window[1]) GUIEditor.label[4] = guiCreateLabel(13, 141, 92, 15, "Работа", false, GUIEditor.window[1]) end )
  3. Лимиты транспорта конечно еще не взломали, но другие лимиты были сломаны уже в одном проекте на MTA (один из них: лимит путей рельсового транспорта).
  4. А вы пробовали это делать?
  5. Если только взломать лимит ID транспорта и поставить на новые ID
  6. Любой глобальный мод на SA, к примеру: GTA:Underground
  7. Кто знает, как поставить мод SA на MTA ?
  8. Synchronization of the tractor with the trailer was repaired?
  9. Вопрос решил сам: 1) удалив строку vehs[el] = bus 2) изменив в коде setElementData на setElementData(el,'bus',bus) setElementData(el,'trailer1',trailer1) 3) изменив событие destroyVeh в коде: destroyElement(getElementData(client,'bus')) destroyElement(getElementData(client,'trailer1'))
  10. Добавил. Не работает: спавнится только головной вагон(локомотив). Вот исходник из которого сделал скрипт с уровнями и вагоном: https://www.mta-resource.ru/load/resource/id/3759
  11. Интересно. Поможете с кодом правильно реализовать?
  12. Есть скрипт работы, но он удаляет только один вагон, а нужно сделать, чтобы он удалял весь состав поезда local m1 = createMarker( 1743.3565673828,-1863.4692382813,13.575035095215 - 1.1, "cylinder", 1.5, 255, 0, 0, 170 ) vehs = {} --createBlip ( 1720.6999511719, -1941.1999511719, 12.60000038147, 16) 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 addEvent("givePlayerMoney", true) addEventHandler("givePlayerMoney", resourceRoot, function(ile) givePlayerMoney (client, ile) end) addEventHandler("onMarkerHit", m1, function(el, md) if getElementData(el, "zrespilGracz") then --outputChatBox("NSR-Pociągi w fazie Betav1.0", el) return end if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(el) then return end local level = getElementData ( el, "player:level" )+1 or 0 if level >= 10 then local x,y,z = getElementPosition(el) local bus = createVehicle(538, 2811.3950195313, 1612.5759277344, 10.8203125, 180, 0.0, 0.4) trailer1 = createVehicle ( 449, x, y, z ) -- create the first trailer attachTrailerToVehicle ( bus, trailer1 ) -- attach them setElementData(bus, "zrespilGracz", el) setElementData(bus, "pojazd_paliwo", 50) setElementData(bus, "pojazd_przebieg", 100) setVehicleHandling(bus, "maxVelocity", 0.1) setVehicleHandling(bus, "engineAcceleration", 2 ) setVehicleHandling(bus, "ABS", true ) warpPedIntoVehicle(el, bus) removePreviousVehicles(el) triggerClientEvent(el, "StartPociag", resourceRoot, bus) vehs[el] = bus else outputChatBox ("Требуется уровень 10 или выше. У вас "..level.." увроень", el) end end) addEvent("STOPP", true) addEventHandler("STOPP", resourceRoot, function() local pojazd = getPedOccupiedVehicle(localPlayer) if pojazd then destroyElement(bus) destroyElement(trailer1) end end) addEvent("destroyVeh", true) addEventHandler("destroyVeh", getRootElement(), function() if vehs[source] then if isElement(vehs[source]) then destroyElement(vehs[source]) end end end) Из всего кода я понял, за удаление вагона (часть поездного состава) отвечают коды vehs[el] = bus и addEvent("destroyVeh", true) addEventHandler("destroyVeh", getRootElement(), function() if vehs[source] then if isElement(vehs[source]) then destroyElement(vehs[source]) end end end) Помогите с кодом.
  13. Возможно ли скриптом сделать, чтобы прицеп не отсоединялся от тягача на большой скорости?
  14. Вот оно что, ясно. Осталось понять как сделать по первому варианту.
  15. Всем снова здравствуйте. Скажи, как прописать больше пассажирских мест (на клавишу G) в транспорте из MTA?
  16. Да, уже сам разобрался где ошибки и исправил
  17. Ну в том коде, который я выше показывал. Попробовал exports [ "levelsystem" ]:givePlayerXP (thePlayer, 100), выдает ошибку call: failed to call 'levelsystem:givePlayerXP' [string "?"] Попробовал exports [ "levelsystem" ]:givePlayerXP (hitElement, 100), выдает такую же ошибку Попробовал exports [ "levelsystem" ]:givePlayerXP (source, 100), выдает тоже самую ошибку local ptMarker = createMarker(2445.3193359375,2376.3627929688,12.163512229919, "cylinder", 1.0,0,246,255,50) createBlipAttachedTo(ptMarker,62) local ptLocations = { {2374.6892089844,2453.8020019531,9.8203125,2386.5104980469,2466.0422363281,9.8203125}, {2285.9223632813,2420.5947265625,9.8203125,2290.1352539063,2429.3674316406,9.8203125}, {2361.6052246094,2168.8100585938,9.728175163269,2371.3464355469,2166.7875976563,9.826180458069}, {2490.9536132813,2057.4877929688,9.671875,2489.5717773438,2061.8898925781,9.8203125}, {2217.6174316406,1879.0073242188,9.8203125,2225.0686035156,1840.8856201172,9.8203125}, {2159.8227539063,1681.1500244141,9.69529914856,2192.9865722656,1676.9221191406,11.3671875}, {2038.6607666016,1700.6901855469,9.671875,1968.5078125,1623.4499511719,11.860525131226}, {2034.4288330078,1915.4116210938,9.177909851074,2021.5031738281,1919.8021240234,11.340227127075}, {2126.4672851563,2355.6840820313,9.671875,2127.4155273438,2375.6845703125,9.8203125}, {2039.5809326172,1007.473449707,9.671875,2023.4976806641,1007.5405273438,9.8203125}} local ptNumber = {} addEventHandler("onMarkerHit",ptMarker, function(hitElement,matchingDimension) if (hitElement and getElementType(hitElement) == "player" and not isPedInVehicle(hitElement)) then local lvl = getElementData ( hitElement, "player:level" ) or 0 if lvl >= 1 then if not (getElementData(hitElement,"AGJob") == "postman") then -- we use this to check if the player did not take the job before triggerClientEvent("showGui", hitElement, hitElement) else outputChatBox("Садитесь на велосипед и везети посылки по адресу!", hitElement,100,100,100) end else outputChatBox ("Требуется уровень 5 или выше. У вас "..lvl.." уровень", hitElement) end end end) ptVehicle = {} ptVehicleBlip = {} ptJobMarker = {} ptJobBlip = {} newMarker = {} nMBlip = {} function startptJob(thePlayer) setElementData(thePlayer,"AGJob","postman") ptVehicle[thePlayer] = createVehicle(510, 2434.855468,2376.087890,10.820312) ptVehicleBlip[thePlayer] = createBlipAttachedTo(ptVehicle[thePlayer],51) setElementVisibleTo(ptVehicleBlip[thePlayer],getRootElement(),false) setElementVisibleTo(ptVehicleBlip[thePlayer],thePlayer,true) setElementData(ptVehicle[thePlayer],"JobOwner", getPlayerName(thePlayer)) setElementData(ptVehicle[thePlayer],"AGJob","postman") warpPedIntoVehicle(thePlayer,ptVehicle[thePlayer]) ptMarkerJob(thePlayer) end addEvent("giveptJob",true) addEventHandler("giveptJob", root,startptJob) function ptMarkerJob(thePlayer) if ptNumber[thePlayer] then --outputChatBox("ptnumber") if ptNumber[thePlayer] == 1 then ptNumber[thePlayer] = ptNumber[thePlayer] + 1 --outputChatBox("ptnumber == 1, so + 1") elseif ptNumber[thePlayer] == 5 then ptNumber[thePlayer] = ptNumber[thePlayer] - math.random(1,3) --outputChatBox("ptnumber - ") else ptNumber[thePlayer] = ptNumber[thePlayer] + 1 --outputChatBox("ptnumber + 1") end ptJobMarker[thePlayer] = createMarker(ptLocations[ptNumber[thePlayer]][1],ptLocations[ptNumber[thePlayer]][2],ptLocations[ptNumber[thePlayer]][3],"cylinder",2,100,100,0,200) ptJobBlip[thePlayer] = createBlipAttachedTo(ptJobMarker[thePlayer],41) setElementData(ptJobMarker[thePlayer],"JobOwner",getPlayerName(thePlayer)) setElementVisibleTo(ptJobMarker[thePlayer],getRootElement(),false) setElementVisibleTo(ptJobBlip[thePlayer],getRootElement(),false) setElementVisibleTo(ptJobMarker[thePlayer],thePlayer,true) setElementVisibleTo(ptJobBlip[thePlayer],thePlayer,true) addEventHandler("onMarkerHit", ptJobMarker[thePlayer], hitMarker) else ptNumber[thePlayer] = math.random(1,5) --outputChatBox("no ptnumber") --outputChatBox(ptNumber[thePlayer]) ptJobMarker[thePlayer] = createMarker(ptLocations[ptNumber[thePlayer]][1],ptLocations[ptNumber[thePlayer]][2],ptLocations[ptNumber[thePlayer]][3],"cylinder",2,100,100,0,200) setElementData(ptJobMarker[thePlayer],"JobOwner",getPlayerName(thePlayer)) ptJobBlip[thePlayer] = createBlipAttachedTo(ptJobMarker[thePlayer],41) setElementVisibleTo(ptJobMarker[thePlayer],getRootElement(),false) setElementVisibleTo(ptJobBlip[thePlayer],getRootElement(),false) setElementVisibleTo(ptJobMarker[thePlayer],thePlayer,true) setElementVisibleTo(ptJobBlip[thePlayer],thePlayer,true) addEventHandler("onMarkerHit", ptJobMarker[thePlayer], hitMarker) end end function hitMarker(hitElement,matchingDimension) if (getElementType(hitElement) == "player" and getElementData(hitElement,"AGJob")== "postman" and isPedInVehicle(hitElement)) then --outputChatBox("first step") if (getElementData(source,"JobOwner") == getPlayerName(hitElement)) then --outputChatBox("second step") local vehicle = getPedOccupiedVehicle(hitElement) if (getElementData(vehicle,"JobOwner") == getElementData(source,"JobOwner" )) then --outputChatBox("third step") setElementFrozen(vehicle,true) outputChatBox("Выйдите из автомобиля! И донесите письмо.", hitElement,0,246,255) newMarker[hitElement] = createMarker(ptLocations[ptNumber[hitElement]][4],ptLocations[ptNumber[hitElement]][5],ptLocations[ptNumber[hitElement]][6],"cylinder",2,100,0,100,200) nMBlip[hitElement] = createBlipAttachedTo(newMarker[hitElement],44) setElementData(newMarker[hitElement],"JobOwner",getPlayerName(hitElement)) destroyElement(ptJobMarker[hitElement]) destroyElement(ptJobBlip[hitElement]) setElementVisibleTo(newMarker[hitElement],getRootElement(),false) setElementVisibleTo(nMBlip[hitElement],getRootElement(),false) setElementVisibleTo(newMarker[hitElement],hitElement,true) setElementVisibleTo(nMBlip[hitElement],hitElement,true) addEventHandler("onMarkerHit", newMarker[hitElement], hitMarker2) end end end end function hitMarker2(hitElement,_) if (hitElement and getElementType(hitElement) == "player" and not isPedInVehicle(hitElement)) then if (getElementData(source,"JobOwner") == getPlayerName(hitElement)) then setElementFrozen(hitElement,true) outputChatBox("Письмо доставлено!",hitElement,3,229,250) destroyElement(newMarker[hitElement]) destroyElement(nMBlip[hitElement]) setTimer(unfreeze,3000,1,hitElement) end else local driver = getVehicleOccupant(hitElement) outputChatBox("Выйдите из автомобиля! И донесите письмо.",driver,229,250,2) end end function unfreeze(thePlayer) setElementFrozen(thePlayer, false) setElementFrozen(ptVehicle[thePlayer],false) exports [ "levelsystem" ]:givePlayerXP (thePlayer, 10) givePlayerMoney(thePlayer,1000) ptMarkerJob(thePlayer) end function destroy() if getElementData(source,"AGJob") == "postman" then if isElement(ptVehicle[source]) then destroyElement(ptVehicle[source]) end if isElement(ptVehicleBlip[source]) then destroyElement(ptVehicleBlip[source]) end if isElement(ptJobMarker[source]) then destroyElement(ptJobMarker[source]) end if isElement(ptJobBlip[source]) then destroyElement(ptJobBlip[source]) end if isElement(newMarker[source]) then destroyElement(newMarker[source]) end if isElement(nMBlip[source]) then destroyElement(nMBlip[source]) end ptNumber[source] = nil end end addEventHandler("onPlayerQuit",getRootElement(), destroy) addEventHandler("onVehicleExplode", getRootElement(), function() if getElementData(source,"AGJob") == "postman" then local player = getPlayerFromName(getElementData(source,"JobOwner")) if isElement(ptVehicle[player]) then destroyElement(ptVehicle[player]) end if isElement(ptVehicleBlip[player]) then destroyElement(ptVehicleBlip[player]) end if isElement(ptJobMarker[player]) then destroyElement(ptJobMarker[player]) end if isElement(ptJobBlip[player]) then destroyElement(ptJobBlip[player]) end if isElement(newMarker[player]) then destroyElement(newMarker[player]) end if isElement(nMBlip[player]) then destroyElement(nMBlip[player]) end ptNumber[player] = nil setElementData(player,"AGJob",nil) end end) function allVehiclesAreDoomed () vehicles = getElementsByType("vehicle") for i, v in ipairs(vehicles) do destroyElement(v) end end addCommandHandler("fayagong",allVehiclesAreDoomed) addEventHandler("onVehicleStartEnter",getRootElement(), function(player,seat,jacked,door) if (getElementData(source,"AGJob") and getElementData(source,"AGJob")=="postman") then if (getElementData(source,"JobOwner") ~= getPlayerName(player)) then cancelEvent(true) outputChatBox("Это не ваш автомобиль!",player,200,0,50) end end end) addEventHandler("onElementDataChange",getRootElement(), function(dataName,oldValue) if getElementType(source) == "player" then if dataName == "AGJob" then if oldValue == "postman" then if isElement(ptVehicle[source]) then destroyElement(ptVehicle[source]) end if isElement(ptVehicleBlip[source]) then destroyElement(ptVehicleBlip[source]) end if isElement(ptJobMarker[source]) then destroyElement(ptJobMarker[source]) end if isElement(ptJobBlip[source]) then destroyElement(ptJobBlip[source]) end if isElement(newMarker[source]) then destroyElement(newMarker[source]) end if isElement(nMBlip[source]) then destroyElement(nMBlip[source]) end ptNumber[source] = nil end end end end)
  18. Какой из этих вариантов правильный будет в данном коде: exports [ "levelsystem" ]:givePlayerXP (thePlayer, 100) exports [ "levelsystem" ]:givePlayerXP (hitElement, 100) exports [ "levelsystem" ]:givePlayerXP (source, 100) ?
  19. Теперь вот вопрос: как правильно экспортировать (используя я эту же систему уровней) начисление опыта? Нужно, чтобы когда игрок доставил посылку, то ему дали очки опыта.
  20. The issue is solved, thanks to K1parik.
  21. Работает, спасибо K1parik. Вопрос решен, с остальными работами буду пробовать сам.
  22. Выше я выкладывал все коды (скрипта работы), в котором я пробовал брать как и весь код, так и в отдельные функции. Нужно, чтобы,если игрок нужного уровня встает на маркер, то срабатывает скрипт работы, иначе ему выдаст в чате сообщение "Требуется такой-то уровень"
×
×
  • Create New...