Jump to content

Search the Community

Showing results for tags 'Lua'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

  1. ola pessoal, estou procurando um script que quando dou /melimpa ou tanto faz o cmd ele limpa as acl e grupos atribuidos a essa conta, não sei quais funções tenho que usar, pfv me ajudem.
  2. Queria editar um bau de armas e munição acrescentando um sistema onde a facção possa guardar uma quantia de dinheiro. Porém ela seria acessavel pela facção podendo adicionar uma quantia (todos os depositos seria acumulado em apenas uma conta bancaria) e retira-la. porem membros de corporação também teria acesso para apenas retirar dinheiro de la, assim esvaziando suposto "cofre". é possivel ?
  3. Olá estou com problemas em meu emprego, todo mundo mesmo quem não está atrabalhando neste emprego consegue spawnar o veiculo do trabalho apenas indo até o marker, tentei por uma proteção que faça com quem tem a skin do emprego consiga pegar o carro e o destruir. porém nenhum resultado se conseguirem me ajudar agraçederia muito. local marker = createMarker(2681.17285, -1957.08862, 12.7, "cylinder", 1.0, 0, 0, 255, 255) local Dmarker = createMarker(2679.63989, -1968.49829, 12.5, "cylinder", 3.0, 255, 0, 0, 100) function enterVehicle ( player, seat, jacked ) --quando um jogador entra em um veículo policeLimpador = { [552]=true} --ID Veiculos Policiais policeLimpadorSkins = { [27]=true } --ID Skins Policiais if ( policeLimpador[getElementModel(source)] ) and ( not policeLimpadorSkins[getElementModel(player)] ) then --se o veículo é um dos 4 carros da polícia, ea pele não é uma pele polícia cancelEvent() outputChatBox ( "#ff0000Somente Motoristas podem entrar neste veiculo", player, 255, 255, 255, true ) --and tell the player why end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) --add an event handler for onVehicleStartEnter function Vehicle( thePlayer ) if getElementType(thePlayer) == "player" then local x,y,z = getElementPosition(thePlayer) veh = createVehicle(552, 2687.59, -1970.002, 13.547, -0, 0, 266.348 ) warpPedIntoVehicle(thePlayer, veh) end end addEventHandler("onMarkerHit", marker, enterVehicle) function destroy (hitElement) if getElementType(hitElement) == "Vehicle" then destroyElement(hitElement) end end addEventHandler("onMarkerHit", Dmarker, destroy)
  4. Queria saber se é possivel assim que o carro for destruido no desmanche por outro player, fazer com que o dono do carro receba a mensagem de que seu veiculo foi destruido. se sim como? abaixo é o codigo que estou tentado implementar esse funcionamento. local blipLocal = createBlip(1768, -2040, 14, 24) local marker = createMarker (1768, -2040, 12.7, "cylinder", 3, 255, 155, 30, 150); local acceptCar = true; local timerCurrent = 300000; setTimer(function() if (acceptCar == false) then setElementVisibleTo ( marker, root, true ); setElementVisibleTo ( blipLocal, root, true ); acceptCar = true; outputChatBox("#FFFF00[DESMANCHE] #FFFFFFO DESMANCHE ESTÁ A PROCURA POR VEICULOS NOVAMENTE.", root, 255, 255, 255, true); end end, timerCurrent,0) addEventHandler ( "onResourceStart", getRootElement(), function ( ) outputChatBox("#FFFF00[DESMANCHE] #FFFFFFO DESMANCHE ESTÁ COMPRANDO VEICULOS.", root, 255, 255, 255, true); end ) addEventHandler("onMarkerHit", marker, function (player) if (acceptCar == true) then local carPlayer = getPedOccupiedVehicle(player); if not (carPlayer) then return end acceptCar = false; valueCar = math.random(2500, 15000); destroyElement(carPlayer); givePlayerMoney(player, valueCar); outputChatBox("#FFFF00[DESMANCHE] #FFFFFFPARABÉNS VOCÊ RECEBEU #00ff00$"..valueCar.." #FFFFFFPOR VENDER ESTE VEICULO AO DESMANCHE.", player, 255, 255, 255, true) outputChatBox("#FFFF00[DESMANCHE] #FFFFFFO DESMANCHE ACABOU DE COMPRAR UM VEICULO E ENCERROU SUAS ATIVIDADES.", root, 255, 255, 255, true); setElementVisibleTo ( marker, root, false ); setElementVisibleTo ( blipLocal, root, false ); end end )
  5. Bom Dia, Gostaria que alguém pudesse explicar como instalar o plugin MTA LUA, para o Notepad++, Estava lendo o Topico, mas não consegui entender muito bem e nem achar o Download!, Desde ja Obrigado!
  6. A simple script of dressable characters and deformable faces. You can move every vertex of the head with a simple displacement shader. The script is in test state right now, I'll create a new editor later. Hope you like it.
  7. Hello dear community. I'm doing a Error Tooltip Resource, I created an Error Client File for all the Errors from my Main Register Resource, and I tried to call that resource by Functions on the same resource, How can I call a Function from the same resource and get The Object File that I want?... This is my code - Error File (InitTooltipMessage.lua) ---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•--- ---| |--- ---| Script by "Kyonax - Pilar Perfeccionista" Synchronous member |--- ---| Github: https://github.com/Kyonax • G-Mail: [email protected] |--- ---| Code Script from Montgomery Country RP |--- ---| Resource-Script: [init] |--- ---| Name-Script: [InitTooltipMessage] |--- ---| Function-Script: Save all the posible Script Errors |--- ---| |--- ---| DEV-DATE: 31/08/2020 |--- ---| Server Script |--- ---| number: 001 |--- ---| MIT License |--- ---| |--- ---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•--- local tooltip = { error = { notDataDigit = { name = 'notDataDigit', syntax = 'NULL LABEL', message = 'El campo actual debe ser completado', description = 'El campo en donde te encuentras, es un campo de entrada, es decir necesitas ingresar información para poder continuar.', type = 'ERROR', number = '1' }, notFoundAccount={ name = 'notFoundAccount', syntax = 'NULL QUERY LOGIN', message = 'No se ha podido encontrar la cuenta en la Base de Datos.', description='Se ha recibido valor NULL al realizar la búsqueda Query del Usuario en la Base de Datos, es decir que el valor Buscado no existe en la Base de Datos.', type = 'ERROR', number = '2' }, notEqual = { name = 'notEqual', syntax = 'NOT EQUAL LABEL', message = 'Los datos ingresados no son iguales.', description = 'Se ha obtenido un ERROR de similitud a la hora de comparar dos valores que deben ser exactamente iguales.', type = 'ERROR', number = '3' } incorrectInformation ={ name = 'incorrectInformation', syntax = 'NOT EQUAL QUERY', message = 'La información ingresada es incorrecta.', description = 'La comparación de el dato obtenido de la Base de Datos y el Ingresado ha devuelto un ERROR de similitud, es decir los datos ingresados no son iguales a los registrados en la base de datos.', type = 'ERROR', number = '4' }, notFoundVariables = { name = 'notFoundVariables', syntax = 'NULL INFORMATION', message = 'Las variables esenciales tienen como valor NULL.', description = 'Variables necesarias para le ejecución del código son de valor NULL, lo que indica que los valores no han sido digitadas o que han sido corrompidos.', type = 'ERROR', number = '5' }, existAccount = { name = 'existAccount', syntax = 'MULTIPLE VALUES QUERY', message = 'El usuario digitado no se encuentra disponible.', description = 'El nombre de usuario para crear la cuenta ya se encuentra registrado en la Base de Datos, lo que causa un error de multiples valores registrados.', type = 'ERROR', number = '6' }, existDiscordID = { name = 'existDiscordID', syntax = 'MULTIPLE VALUES QUERY', message = 'La ID de Discord digitada ya se encuentra en uso.', description = 'La ID de Discord se encontró en la base de datos, lo que quiere decir que otra cuenta está registrada con esta ID.', type = 'ERROR', number = '7' }, notValidPassword = { name = 'notValidPassword', syntax = 'LOW SECURITY ACCOUNT', message = 'La contraseña no es segura', description = 'Existen algunos requerimientos para acceder al Servidor, uno de ellos es tener una contraseña de más de 6 carácteres.', type = 'ERROR', number = '8' } } } local function getError(name) return tooltip.error[name] end local function getTooltip(name) return tooltip.error[name].syntax...' '...tooltip.error[name].message...' '...' ['...tooltip.error[name].type...' #' ...tooltip.error[name].number...']' end and I tried to call the getTooltip Function from another File called - RegisterBackend.lua - It's a Server Lua File local test = exports['[init]']:getTooltip('notFoundAccount').message local test2 = exports['[init]']:getError('notFoundAccount').type Both Files are on the same Resource call [Init] And this is my Meta.xml Code <!--ERROR--> <file src="src/error/InitTooltipMessage.lua" type='client'></file> <!--Exported Functions--> <export function='getError' type='client'></export> <export function='getTooltip' type='client'></export> The error that I get when I run the Code is this What I need to do? to call correctly Plss I'm Stuck in this
  8. Çiftçi Mesleğinin Script Yapımı 1.Client.lua 2.server.lua 3.shared.lua 4.meta.xml Client .lua İçeriği -- Reappersz İyi Oyunlardiler. local dxMarker = createMarker(markerT[1],markerT[2],markerT[3]-0.1, "cylinder", 1, 255, 255, 255, 0) local ped = createPed(skinTractor,markerT[1],markerT[2],markerT[3]) setElementRotation(ped, 0, 0, 90) addEventHandler( "onClientRender", root, function () local x, y, z = getElementPosition(dxMarker) local Mx, My, Mz = getCameraMatrix() if (getDistanceBetweenPoints3D(x, y, z, Mx, My, Mz) <= 20) then local WorldPositionX, WorldPositionY = getScreenFromWorldPosition(x, y, z +1, 0.07) if (WorldPositionX and WorldPositionY) then dxDrawText("Çiftçi Mesleği", WorldPositionX - 1, WorldPositionY + 1, WorldPositionX - 1, WorldPositionY + 1, tocolor(0, 0, 0, 255), 1.52, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Çiftçi Mesleği", WorldPositionX - 1, WorldPositionY + 1, WorldPositionX - 1, WorldPositionY + 1, tocolor(255, 255, 255, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false) end end end ) --------------------------------------------- local markerState = 1 function getMarkerCurrentState () return markerState end function updateMarkerCurrentState () markerState = markerState + 1 end function restoreMarkerCurrentState () markerState = 1 end function isMarchEnd () if getMarkerCurrentState () >= #tractorMarks then return true else return false end end local markerT = createMarker(markerT[1],markerT[2],markerT[3]-1, "cylinder", 1, 255, 255, 255, 0) local blip = createBlipAttachedTo(markerT, 25) setBlipVisibleDistance(blip, 400) function centerWindow ( center_window ) local sx, sy = guiGetScreenSize ( ) local windowW, windowH = guiGetSize ( center_window, false ) local x, y = ( sx - windowW ) / 2, ( sy - windowH ) / 2 guiSetPosition ( center_window, x, y, false ) end local sw,sh = guiGetScreenSize() local window={} local label={} local button={} wndTra = guiCreateWindow(0,0,400,120,"Çiftçi Mesleği",false) centerWindow(wndTra) guiSetVisible(wndTra,false) labeTra = guiCreateLabel(5,25,390,50," Merhaba, bu tarlayı traktör ile sürmeni istiyorum,\nbunu yapabilirmisin ?.",false,wndTra) guiSetFont(labeTra, "default-bold-small") guiLabelSetHorizontalAlign(labeTra, "center", false) buttonTra1 = guiCreateButton(10,70,180,35,"...",false,wndTra) guiSetFont(buttonTra1,"default-bold-small") guiSetProperty(buttonTra1, "NormalTextColour", "FF00FF00") buttonTra2 = guiCreateButton(210,70,180,35,"Hayır Kalsın.",false,wndTra) guiSetFont(buttonTra2,"default-bold-small") guiSetProperty(buttonTra2, "NormalTextColour", "FFFF0000") function createMarkerTractor(player) if player == getLocalPlayer() then m = tractorMarks[ getMarkerCurrentState () ] updateMarkerCurrentState () local marker = createMarker(m[1],m[2],m[3]-1, "corona", 2, 0, 255, 0, 80) setElementData(marker,"tractor_mark",true) setElementData(player,"tractor_mark",marker) local blip = createBlip(m[1],m[2],m[3],41,3) setElementData(player,"tractor_blip",blip) local obj = createObject(804,m[1],m[2],m[3]) setObjectScale(obj, 1.0) setElementCollisionsEnabled (obj, false) setElementData(player,"tractor_obj",obj) end end function deleteMarkerTractor(player) if player == getLocalPlayer() then local marker = getElementData(player,"tractor_mark") local blip = getElementData(player,"tractor_blip") local obj = getElementData(player,"tractor_obj") if marker then if isElement(marker) then destroyElement(marker) end end if blip then if isElement(blip) then destroyElement(blip) end end if obj then if isElement(obj) then destroyElement(obj) end end end end addEvent("deleteMarkerTractor", true) addEventHandler("deleteMarkerTractor", getRootElement(), deleteMarkerTractor) function startClick() local player = getLocalPlayer() if (source == buttonTra1) then guiSetVisible(wndTra,false) showCursor(false) local state = getElementData(player,"tractor_works") if not state then triggerServerEvent("start_Tractor",player,player) setElementData(player,"tractor_works",0) createMarkerTractor(player) outputChatBox("#1E90FF[BİLGİ] #FFFFFFİşe başladınız, işarete sürün.",255,255,255,true) setElementData(player,"Model Danışmanı",getElementModel(player)) setElementModel(player,158) setElementData(player,"tractor_plus",0) setElementData(player,"Kazanılan Gelir",moneyTra) else triggerServerEvent("stop_Tractor",player,player) local hodok = tonumber(state) local profit = getElementData(player,"Kazanılan Toplam kon") if not profit then profit = 0 end setElementData(player,"Kazanılan Toplam Kon",nil) setElementData(player,"Şuan Kazanılan Kon",nil) triggerServerEvent("giveMoneyTractor",player,player,profit) setElementData(player,"tractor_works",nil) setElementModel(player,getElementData(player,"Önceki Cilt Danışamanı")) deleteMarkerTractor(player) end elseif (source == buttonTra2) then guiSetVisible(wndTra,false) showCursor(false) end end addEventHandler("onClientGUIClick", getRootElement(), startClick) function onClientMarkerHit(player, mdim) if player == getLocalPlayer() then if mdim then local veh = getPedOccupiedVehicle(player) local state = getElementData(player,"tractor_works") if getElementData(source,"tractor_mark") then if veh then setElementData(player,"tractor_plus",tonumber(getElementData(player,"tractor_plus")) + 1) if getElementData(player,"tractor_plus") >= #tractorMarks then restoreMarkerCurrentState () local pacienty = tonumber(getElementData(player,"tractor_plus")) if pacienty > 0 then setElementData(player,"tractor_works",tonumber(state) + pacienty) setElementData(player,"tractor_plus",0) if not getElementData(player,"kazanılan total ") then setElementData(player,"kazanılan total",0) end if not getElementData(player,"total") then setElementData(player,"total",0) end setElementData(player,"kazanılan total",getElementData(player,"kazanılan total") + getElementData(player,"kazanlan total")) deleteMarkerTractor(player) outputChatBox("#1E90FF[BİLGİ] #FFFFFFKazanç : #00FF00"..getElementData(player,"total kazanılan").." #FFFFFFmoney.",255,255,255,true) outputChatBox("#1E90FF[BİLGİ] #FFFFFFMaaşınızı aldınız.",255,255,255,true) end else deleteMarkerTractor(player) createMarkerTractor(player) end end end end end end addEventHandler("onClientMarkerHit", getRootElement(), onClientMarkerHit) addEventHandler ( "onClientMarkerHit", getRootElement(), function(ply) if ply ~= localPlayer then return end if source == markerT then local state = getElementData(ply,"tractor_works") local veh = getPedOccupiedVehicle(ply) if not veh then guiSetVisible(wndTra,true) showCursor(true) if not state then guiSetText(buttonTra1,"İşe Başla.") else guiSetText(buttonTra1,"İşi Bitir.") end end end end) Bu Client.lua İçeriğimiz Sırada Server.Lua -- Türkçe Çeviri Reappersz---- -- Reappersz İyi Oyunlardiler. function start_Tractor(player) local veh = createVehicle(531,spawnTractor[1],spawnTractor[2],spawnTractor[3], 0, 0, 160) setElementData(player,"tractor_veh",veh) trailer = createVehicle(610, 0, 0, 4, 0, 0, 160) attachTrailerToVehicle(veh, trailer) setElementData(player,"trailer_veh",trailer) setElementData(veh,"tractor_plus",0) warpPedIntoVehicle(player,veh) setElementData(veh, "vehicle:Work", true) setElementData(veh, "vehicle:Work:Owner", player) end addEvent("start_Tractor", true) addEventHandler("start_Tractor", getRootElement(), start_Tractor) function enterVehicle ( player ) local data = getElementData(source, "vehicle:Work") if not data then return end local owner = getElementData(source, "vehicle:Work:Owner") if owner ~= player then cancelEvent() outputChatBox("#1E90FF[BİLGİ] #FFFFFFBu araç senin değil...",player,255,255,255,true) end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) function stop_Tractor(player) local state = getElementData(player,"tractor_works") local veh1 = getElementData(player,"tractor_veh") local veh2 = getElementData(player,"trailer_veh") if state then if veh1 then destroyElement(veh1) setElementData(player,"tractor_veh",nil) end if veh2 then destroyElement(veh2) setElementData(player,"trailer_veh",nil) end end triggerClientEvent("deleteMarkerTractor",player,player) end addEvent("stop_Tractor", true) addEventHandler("stop_Tractor", getRootElement(), stop_Tractor) function giveMoneyTractor(player, summa) local state = getElementData(player,"tractor_works") if state then givePlayerMoney(player, summa) outputChatBox("#1E90FF[BİLGİ] #FFFFFFİşi bitirdin. Maaşın #00FF00"..summa.." #FFFFFF$.",player,255,255,255,true) end end addEvent("giveMoneyTractor", true) addEventHandler("giveMoneyTractor", getRootElement(), giveMoneyTractor) function job_quit_Medik() local player = source local state = getElementData(player,"tractor_works") if state then local veh = getElementData(player,"tractor_veh") if veh then destroyElement(veh) setElementData(player,"tractor_veh",nil) end end end addEventHandler("onPlayerQuit", root, job_quit_Medik) function onVehicleStartEnter( player, seat, jacked ) local veh = source local pveh = getElementData(player,"tractor_veh") if veh == pveh then setElementData(player,"Уничтожение_Автобуса",nil) end end addEventHandler ( "onVehicleStartEnter", getRootElement(), onVehicleStartEnter) setTimer(function() for lol,player in ipairs(getElementsByType("player")) do local pveh = getElementData(player,"tractor_veh") if pveh then local driverA = getVehicleOccupant(pveh) if driverA == player then if getElementData(player,"Уничтожение_Автобуса") then setElementData(player,"Уничтожение_Автобуса",nil) end else if getElementData(player,"Уничтожение_Автобуса") then setElementData(player,"Уничтожение_Автобуса",tonumber(getElementData(player,"Уничтожение_Автобуса")) - 1) if tonumber(getElementData(player,"Уничтожение_Автобуса")) < 0 then setElementData(player,"Уничтожение_Автобуса",nil) stop_Tractor(player) outputChatBox("#1E90FF[BİLGİ] #FFFFFFİşten ayrıldın.",player,255,255,255,true) end end end end end end,1000,0) function onVehicleExit(player,seat) if seat == 0 then local pveh = getElementData(player,"tractor_veh") if source == pveh then setElementData(player,"Уничтожение_Автобуса",60) outputChatBox("#1E90FF[BİLGİ] #FFFFFFİşi dönmelisin yoksa 60 saniye sonra yok olacak.",player,255,255,255,true) end end end addEventHandler("onVehicleExit", getRootElement(), onVehicleExit) function onPlayerWasted() giveMoneyTractor(source) end addEventHandler("onPlayerWasted", getRootElement(), onPlayerWasted) function onPlayerQuit() giveMoneyTractor(source) end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) Buda Server.lua ' İçeriğimiz İçinden Editlemeler Değişiklikler Yapılabilir Sıradaki İçeriğimiz Shared.lua İçeriğidir -- Türkçe Çeviri Reappersz -- -- Reappersz İyi Oyunlardiler. markerT = {-103.97047424316,9.280517578125,3.1171875} -- Harita İşaretlemesi. skinTractor = 158 -- ID рабочего скина. moneyTra = math.random(1500,10000) -- Satılanların geliri. spawnTractor = {-123.93685150146,58.673442840576,3.1171875} -- Traktor Işınlama. tractorMarks = { -- Koleksiyon Kordinatları. {-129.10345458984,44.776748657227,3.1171875}, {-140.21569824219,35.499088287354,3.1171875}, {-138.20004272461,22.663047790527,3.1171875}, {-148.60707092285,14.514667510986,3.1171875}, {-145.90365600586,3.4965758323669,3.1171875}, {-156.54542541504,-6.012909412384,3.1171875}, {-154.13597106934,-17.593681335449,3.1171875}, {-164.40188598633,-27.394626617432,3.1171875}, {-162.29643249512,-39.118156433105,3.1171875}, {-171.7504119873,-45.86404800415,3.1171875}, {-169.89549255371,-58.790817260742,3.1171875}, {-179.14767456055,-66.964935302734,3.1171875}, {-180.8540802002,-80.188659667969,3.1171875}, {-192.09867858887,-82.351318359375,3.1171875}, {-194.74926757813,-68.188079833984,3.1171875}, {-184.73794555664,-59.438095092773,3.1171875}, {-187.86322021484,-46.48645401001,3.1171875}, {-176.4867401123,-37.576705932617,3.1171875}, {-178.89535522461,-23.708335876465,3.1171875}, {-167.26829528809,-14.703594207764,3.1171875}, {-169.14628601074,0.85636925697327,3.1171875}, {-157.40020751953,11.213445663452,3.1171875}, {-163.81475830078,27.186906814575,3.109395980835}, {-151.95930480957,38.768440246582,3.1171875}, {-155.29359436035,53.715530395508,3.1171875}, {-144.55880737305,61.669063568115,3.1171875}, {-153.22250366211,73.040794372559,3.1171875}, {-164.96725463867,64.920394897461,3.1171875}, {-160.10667419434,51.389507293701,3.1171875}, {-172.44535827637,43.420669555664,3.1171875}, {-168.49655151367,27.312816619873,3.1171875}, {-181.05578613281,18.532829284668,3.109395980835}, {-176.61128234863,4.3219885826111,3.109395980835}, {-188.57684326172,-7.4416480064392,3.109395980835}, {-186.15411376953,-23.690855026245,3.1171875}, {-199.10632324219,-34.989559173584,3.1171875}, {-196.35543823242,-49.323276519775,3.1171875}, {-207.32098388672,-57.854675292969,3.1171875}, {-204.13220214844,-74.361557006836,3.1171875}, {-214.03121948242,-81.115821838379,3.1171875}, {-222.42245483398,-71.313377380371,3.1171875}, {-211.78359985352,-60.138431549072,3.1171875}, {-217.53211975098,-41.33757019043,3.1171875}, {-205.04089355469,-31.443368911743,3.1171875}, {-207.49635314941,-12.911985397339,3.1171875}, {-195.17124938965,-1.4358625411987,3.109395980835}, {-199.52687072754,22.681520462036,3.1171875}, {-187.56085205078,33.805614471436,3.1171875}, {-190.6788482666,50.106971740723,3.1171875}, {-178.33522033691,60.7131690979,3.1171875}, {-182.21771240234,76.404037475586,3.1171875}, {-191.54174804688,87.14820098877,3.1171875}, {-203.26365661621,79.401123046875,3.1171875}, {-199.90397644043,61.27318572998,3.1171875}, {-212.61807250977,50.887119293213,3.1171875}, {-209.3896484375,34.510997772217,3.1171875}, {-221.73179626465,23.422630310059,3.1171875}, {-217.9956817627,8.4652395248413,3.1171875}, {-231.29121398926,-4.3941593170166,3.109395980835}, {-227.30709838867,-17.375923156738,3.1171875}, {-238.58776855469,-26.8854637146,3.1171875}, {-234.0107421875,-40.141651153564,3.1171875}, {-245.84834289551,-50.500583648682,3.1171875}, {-243.30256652832,-64.259651184082,3.1171875}, {-253.69897460938,-70.972732543945,3.1171875}, {-261.44381713867,-60.243770599365,3.1171875}, {-264.31607055664,-45.27653503418,3.1171875}, {-253.13627624512,-37.03816986084,3.1171875}, {-256.28436279297,-21.476554870605,2.5999567508698}, {-243.57893371582,-5.2200374603271,2.8984375}, {-246.77336120605,13.520101547241,2.5481338500977}, {-232.55879211426,27.493730545044,2.8690776824951}, {-235.26802062988,47.376792907715,2.5473833084106}, {-221.7456817627,60.752349853516,2.8304569721222}, {-226.7194519043,72.61767578125,2.5015366077423}, {-214.16030883789,83.426750183105,2.7792901992798}, {-217.92860412598,94.814697265625,2.4680054187775}, {-227.80729675293,97.381309509277,2.0782046318054}, {-227.83094787598,81.953834533691,2.3373956680298}, {-242.23078918457,74.386619567871,1.953736782074}, {-236.50303649902,54.08487701416,2.4138503074646}, {-253.51921081543,43.162837982178,1.965989947319}, {-248.65715026855,20.133153915405,2.3974192142487}, {-265.92660522461,3.4994027614594,1.9778387546539}, {-260.5168762207,-20.83599281311,2.453197479248}, {-276.29504394531,-35.595523834229,2.0164685249329}, {-271.26129150391,-54.640983581543,3.1171875}, } Ve Son Adım Meta.XML İçeriğimiz <meta> <script src="shared.lua" type="shared" cache="false"/> <script src="client.lua" type="client" cache="false"/> <script src="server.lua" type="server"/> </meta> Bu Adımları Yaptıktan Sonra Meslek Dosyamızı Bir Zip Açarak İçine Atın Bunları Ardından Servere Yükleme Yapıp Startlayın ve refreshleyin
  9. ¡Hola, buen día, adjuntaré mi problema de manera detallada...! Quiero cambiar el sonido del motor de la Wayfarer a una similitud con una Harley Davidson, por ello usé *getVehicleCurrentGear* cuando la moto esté parada reproduzca un sonido, si ya existe, no haga más, si acelera, cambie y elimine el que existía para evitar sonido acumulado pero soy principiante en creación de scripts, ¿Algún consejo? function isSoundFinished(theSound) return ( getSoundPosition(theSound) == getSoundLength(theSound) ) end function HarleyDavidsonSound() for _, vehicles in pairs(getElementsByType("vehicle")) do if(getElementModel(vehicles) == 586) then setWorldSoundEnabled( 7, 0, false) setWorldSoundEnabled( 7, 1, false) local x,y,z = getElementPosition( vehicles ) local gear = getVehicleCurrentGear( vehicles ) print(gear) if gear == 1 then motor = playSound3D("motor.wav", x, y, z, true) attachElements( motor, vehicles) setElementParent( motor, vehicles ) end end end end addEventHandler( "onClientRender", root, HarleyDavidsonSound)
  10. s2sk

    Lua f*k sh*t

    I MAKE SO setElementData(source, "countCheckpoitBusRoad", 0) -- somewhere in the code local countCheckpoint = getElementData(player, "countCheckpoitBusRoad") + 1 -- callback hit marker -- AND HERE ERROR setElementData(player, "countCheckpoitBusRoad", countCheckpoint) AND HAVE "ERROR: attempt to perform arithmetic on a boolean value 'countCheckpoint '" WHY??? MY SYSTEM-BUS WORK, BUT IN CONSOLE MORE ERROR
  11. Olá, eu estava querendo colocar o nick do jogador na hud que estou fazendo, porém quando eu coloco ele aparece por exemplo: "Meu#929292Nick", ou seja, com o código da cor, alguém sabe como retira isso? function SousaHud ( ... ) if (not isPlayerMapVisible()) then local dinheiro = getPlayerMoney(localPlayer) local banco = getElementData(localPlayer, "bank.money") or "0" local muniarma = getPedAmmoInClip (localPlayer) local munitotal = getPedTotalAmmo (localPlayer) local vida = math.floor(getElementHealth(getLocalPlayer())) local colete = math.floor(getPedArmor(getLocalPlayer())) local fome = getElementData(getLocalPlayer(), "fome") or 100 local sede = getElementData(getLocalPlayer(), "sede") or 100 local nome = getPlayerName (localPlayer) dxDrawRectangle(screenW * 0.7897, screenH * 0.0495, screenW * 0.2103, screenH * 0.2487, tocolor(0, 0, 0, 215), false) dxDrawRectangle(screenW * 0.7978, screenH * 0.0651, screenW * 0.1949, screenH * 0.0352, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.7978, screenH * 0.1133, screenW * 0.0941, screenH * 0.0326, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.8993, screenH * 0.1133, screenW * 0.0941, screenH * 0.0326, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.7978, screenH * 0.1589, screenW * 0.0941, screenH * 0.0326, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.8985, screenH * 0.1589, screenW * 0.0941, screenH * 0.0326, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.8985, screenH * 0.2044, screenW * 0.0941, screenH * 0.0326, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.7971, screenH * 0.2044, screenW * 0.0941, screenH * 0.0326, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.7978, screenH * 0.2500, screenW * 0.1949, screenH * 0.0352, tocolor(255, 255, 255, 255), false) dxDrawText(""..nome.. "", screenW * 0.7971, screenH * 0.0651, screenW * 0.9926, screenH * 0.1003, tocolor(0, 0, 0, 254), 1.20, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("R$"..dinheiro , screenW * 0.7971, screenH * 0.1120, screenW * 0.8912, screenH * 0.1458, tocolor(0, 0, 0, 254), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("R$"..banco , screenW * 0.8985, screenH * 0.1120, screenW * 0.9926, screenH * 0.1458, tocolor(0, 0, 0, 254), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Fome " ..fome.. "%", screenW * 0.7971, screenH * 0.1576, screenW * 0.8912, screenH * 0.1914, tocolor(0, 0, 0, 254), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Sede " ..sede.. "%", screenW * 0.8985, screenH * 0.1576, screenW * 0.9926, screenH * 0.1914, tocolor(0, 0, 0, 254), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Vida " ..vida.. "%", screenW * 0.7971, screenH * 0.2031, screenW * 0.8912, screenH * 0.2370, tocolor(0, 0, 0, 254), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Colete " ..colete.. "%", screenW * 0.8985, screenH * 0.2031, screenW * 0.9926, screenH * 0.2370, tocolor(0, 0, 0, 254), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Rawer Roleplay", 1084, 191, 1350, 219, tocolor(0, 0, 0, 254), 1.50, "default-bold", "center", "center", false, false, false, false, false) end
  12. function Tared (policePed,hitElement,dim) setPedAnalogControlState(policePed, "accelerate", 1) end addEvent( "Tared", true ) addEventHandler( "Tared", localPlayer, Tared ) ابي البوت يطارد الاعب الي لمس الماركر الي اسمة Marker1 هل ممكن مساعدة؟
  13. local Marker1 = createMarker(-82.43913, -907.21539, 17.27800 ,"cylinder", 2, 0, 0, 255, 255) addEventHandler("onMarkerHit",Marker1, function (hitElement,matchingDimension) local policePed = createPed (280, -148.21268, -959.39343, 28.35586) local PoliceCar = createVehicle(597, -148.21268, -959.39343, 28.35586, 359.447, 0.000, 90) warpPedIntoVehicle ( policePed, PoliceCar) end ) ابي اخلي البيد الي اسمة policePed يطارد الاعب ممكن مساعدة؟
  14. السلام عليكم ورحمة الله وبركاتة انا كنت ابي اسوي بوت اول ما المس ماركر معين يروح البوت يظهر بسيارت شرطة ويطاردني ممكن مساعدة؟
  15. السلام عليكم ورحمة الله وبركاتة كنت اتمني ان اقوم بعمل مود بسيط واود مساعدتكم في تصميمة انا اود ان افعل سكربت صغير عبارة عن عند كتابت امر up علي سبيل المثال يقوم بحمل الاعب الذي يقوم بكتابت اسمة والاعب المحمول يقوم بعمل انيماشن معين هل بامكانكم مساعدتي؟
  16. مساعدة بسيطة علي كود اريد ان تظهر العلامات في الخريطة تدريجيا وليس جميعها في وقت واحد وعندما المس اي ماركر يقوم بحذف الماركر والعلامة ونقلنلي لماركر والعلامة التي تليها حتي انتهي من جميع الماركرات التي بالجدول اتمني منكم مساعدتي رجائا انا في مرحة التعلم رجائا اي تعديل يرجا ان تعدلة علي الكود الاساسي GUIEditor = { button = {}, window = {}, memo = {} } local targetMar = { {1345.76172, 343.09811, 19}, {205.60931, -174.15186, 1}, {2264.45654, 63.23068, 25}, {696.72180, -442.32590, 15}, {-85.84571, -1189.86865, 0.5} } local mar = {} local bli = {} function newTar() --setElementModel(localPlayer,22) setElementData(localPlayer,"pizzaDone",0) for i,v in pairs ( targetMar ) do mar[i] = createMarker(v[1],v[2],v[3],"cylinder",2,255,255,0) bli[i] = createBlip(v[1],v[2],v[3],0) setElementData(mar[i],"pizzaMar",true) end addEventHandler("onClientMarkerHit",root,onTarHit) outputChatBox("Go to the signs on the map to deliver the smuggled goods when you finish 5 counting areas and get the required amount",255,0,0) end function finishJob() removeEventHandler("onClientMarkerHit",finMar,finishJob) destroyElement(finMar) destroyElement(blipfin) outputChatBox("Good Job ! Here's your money !",255,255,0) triggerServerEvent("onDone",resourceRoot) newTar() end function onTarHit() if getElementData(localPlayer,"pizzaOccupent") == true and getElementData(source,"pizzaMar") == true then local piz = getElementData(localPlayer,"pizzaDone") if not piz then piz = 0 end destroyElement(source) setElementData(localPlayer,"pizzaDone",piz+1) piz = piz+1 outputChatBox(piz.."/5 completed !",0,255,0) if piz == 5 then removeEventHandler("onClientMarkerHit",root,onTarHit) for _,v in pairs ( bli ) do destroyElement(v) end outputChatBox("Come back now to receive your money",255,255,0) finMar = createMarker(-52.76169, -225.02179, 5.42969, "cylinder", 2, 255, 255, 0) blipfin = createBlip(-52.76169, -225.02179, 5.42969, 0) addEventHandler("onClientMarkerHit",finMar,finishJob) end end end function onClick() if source == GUIEditor.button[1] then --setElementModel(localPlayer,22) for i,v in pairs ( targetMar ) do mar[i] = createMarker(v[1],v[2],v[3],"cylinder",2,255,255,0) bli[i] = createBlip(v[1],v[2],v[3],0) setElementData(mar[i],"pizzaMar",true) end addEventHandler("onClientMarkerHit",root,onTarHit) setElementData(localPlayer,"pizzaOccupent",true) outputChatBox("Go to the signs on the map to deliver the smuggled goods when you finish 5 counting areas and get the required amount",255,0,0) removeEventHandler("onClientGUIClick",root,onClick) destroyElement(GUIEditor.window[1]) showCursor(false) elseif source == GUIEditor.button[2] then for _,v in pairs ( mar ) do destroyElement(v) end for _,v in pairs ( bli ) do destroyElement(v) end setElementData(localPlayer,"pizzaDone",0) --setElementModel(localPlayer,0) setElementData(localPlayer,"pizzaOccupent",false) outputChatBox("Good Baay!",0,255,0) removeEventHandler("onClientGUIClick",root,onClick) destroyElement(GUIEditor.window[1]) showCursor(false) end end addEvent("onPizzaHit",true) addEventHandler("onPizzaHit",root, function () GUIEditor.window[1] = guiCreateWindow(0.28, 0.30, 0.42, 0.40, "- Pizza Man -", true) guiWindowSetMovable(GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.memo[1] = guiCreateMemo(0.09, 0.17, 0.48, 0.69, "\nIn this job you must successfully deliver smuggled weapons. Connect all weapons and promise to get your money back.", true, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(0.63, 0.24, 0.32, 0.20, "Accept Job", true, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(0.63, 0.54, 0.32, 0.20, "Decline / Remove From Job", true, GUIEditor.window[1]) showCursor(true) addEventHandler("onClientGUIClick",root,onClick) end )
  17. --------------------------------- السلام عليكم ممكن تساعدوني انا ابي السيارة الي يصنعها الاعب عند لامس الماركر هو فقط الي يقدر ييركبها ولو نزل منها لمدة 30 ثانية السيارة تتمسح واذا كان معة السيارة ما يقدر يصنع سيارة غيرها بيلز سعدوني ارجوكم انا حموت واتعلم الحتي دي
  18. redditing

    Button

    -- Client Side Button = guiCreateButton(0.45, 0.54, 0.10, 0.06, "Get Value", true) guiSetProperty(Button, "NormalTextColour", "FFAAAAAA") guiSetVisible(Button, false) EditBox= guiCreateEdit(0.41, 0.45, 0.18, 0.04, " chcesz tego kupić sztuk?", true) guiSetProperty(EditBox, "NormalTextColour", "FFFF0000") guiEditSetMaxLength(EditBox, 3) guiSetVisible(EditBox, false) addEventHandler("onClientGUIClick", Button function() local inputBox = tonumber(guiGetEdit(EditBox)) if inputBox==0 then outputChatBox("U set value input "..inputBox, 255, 255, 0) end end) -- Another Client Side addCommandHandler("TurnOnButton", function() guiSetVisible(Button, true) guiSetVisible(EditBox, true) end) I don't know what's wrong, but when I type the command 'TurnOnButton' I can't click the button and the editBox as if they didn't exist
  19. Olá Se você sabe programar em Lua e QUER TRABALHAR DE FATO, entre em contato comigo caso queira ganhar dinheiro. Quero: 1 gamemode de Hot Pursuit - perseguição de polícia contra ladrão 1 gamemode de training - basicamente é só um painel pra escolher um mapa e treinar - Algumas customizações simples pra veículos - Uns paineis simples Se for pra ficar de enrolação, demorar 2 dias pra responder uma coisa simples, não dar nem sinal de vida de como está indo o projeto, não entre em contato. Caso queira se comprometer ao trabalho, fale comigo, que serás muito bem pago. Abraços Jayb
  20. Olá, estou como ideia de converter um guiGrid em DxGrid usando o mode dxLib, mas eu não estou conseguindo criar as colunas, só queria um retângulo preto que é a lista sem colunas. Peguei essa função de um mod (vou chamar de mod A) que usa dxGrid e coloquei no meu mod (mod B) , n funciona(já botei o dxGrid.Lua no meta). Apaguei todas as funções que se comunica com o dxGrid.Lua do mod A e apaguei, deixe só a função abaixo e a Lista e as Colunas foram criadas normalmente. Coloquei a função no mod B e só criou a Lista sem coluna.(Tentei trocar o nome da Lista para ver se funcionava e não deu certo também) addEventHandler("onClientResourceStart", resourceRoot, function () Arm_Test = dxGridW:Create(470, 303, 427, 157) Arm_Test:AddColumn("Jogador", 207) Arm_Test:AddColumn("Arma", 210) Arm_Test:SetVisible(true) end)
  21. function premiumhud() local px,py,pz = getElementPosition(getLocalPlayer()) local x,y,z = getElementPosition(getLocalPlayer()) local distance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz) if distance <= 10 then local sx,sy = getScreenFromWorldPosition ( x, y, z+1.12, 0.05 ) if not sx then return end local scale = 0.01/(0.01 * (distance / 1)) dxDrawText ( "Premium", sx, sy, sx, sy + 25, tocolor(255,230,100,255), math.min ( 0.07 *(180/distance),1.8), "clear-normal", "center", "bottom", false, false, false ) end end addCommandHandler("premium", premiumhud) Kiedy wpisuje komendę /premium na czacie, pojawia mi się na chwile napis po czym szybko znika. Chciałbym, aby to pokazywało się do czasu opuszczenia serwera. Oraz chciałbym zrobić to na uprawnienie, czyli osoba która ma wybraną range w pliku ACL może wpisać tą komende. Czekam na szybką pomoc!
  22. Gostaria de saber como faço para adicionar grupos ACL nestes chat Help-me function MensagemTwitter(source, cmd, ...) local MessagemT = table.concat ( { ... }, " " ) local name = getPlayerName(source); for _,v in ipairs(getElementsByType("player")) do outputChatBox("#00BFFF[ Twitter ] #FFFFFF "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true) --efeito no chat end end addCommandHandler("Twitter", MensagemTwitter) function MensagemAnon(source, cmd, ...) local MessagemANS = table.concat ( { ... }, " " ); for _,v in ipairs(getElementsByType("player")) do outputChatBox("#ffffff[ #696969 Anônimo #ffffff] #696969"..MessagemANS,v, 255, 255, 255, true) --efeito no chat end end addCommandHandler("Ans", MensagemAnon) function MensagemRP(source, cmd, ...) local MessagemFRP = table.concat ( { ... }, " " ); local name = getPlayerName(source); local getID = getElementData(source, "ID") or "n.a" for _,v in ipairs(getElementsByType("player")) do outputChatBox("#A9A9A9[ @Global ]#ffffff "..name.." #A9A9A9(ID:"..getID..") #A9A9A9 ❱ #ffffff"..MessagemFRP,v, 255, 255, 255, true) --efeito no chat end end addCommandHandler("forarp", MensagemRP) addEventHandler("onPlayerJoin", getRootElement(), function() bindKey(source, "k", "down", "chatbox", "Ans")--bind end ) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do bindKey(player,"k", "down", "chatbox", "Ans") --bind end end ) addEventHandler("onPlayerJoin", getRootElement(), function() bindKey(source, "u", "down", "chatbox", "Twitter") --bind end ) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do bindKey(player,"u", "down", "chatbox", "Twitter") --bind end end ) addEventHandler("onPlayerJoin", getRootElement(), function() bindKey(source, "i", "down", "chatbox", "forarp") --bind end ) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do bindKey(player,"i", "down", "chatbox", "forarp") --bind end end )
  23. Olá, estou a efetuar uma criação de servidor no estilo dayz, porém diferente dos demais presentes, preciso urgentemente de ajuda na parte de scripts, preciso de um scripter profissional em Lua urgente, pois temos muitos projetos para avançar e não consigo pelo o facto de ser preciso scripts. Caso alguém esteja interessado em nos ajudar, agradeço imenso. Obs: Todo o trabalho será pago. Deixarei disponível os contactos para quem estiver interessado a participar do nosso projeto. Obrigado. Discord: Mustang#1636 Gribix#3409 Discord
  24. Queria ajuda para quando eu digitar certo comando no chat, ativar o efeito "gunflash" nos determinados locais que está no script, ex: /backfire Mas sinto que está faltando algo nesse código, obs: não é meu, está disponível na web, só preciso de ajuda mesmo. Desde já agradeço a qualquer tipo de ajuda. ENGINE_ENABLED = true ENGINE_VOLUME_MASTER = 0.15 -- volume multiplier ENGINE_VOLUME_THROTTLE_BOOST = 2.5 -- boosting engine volume if we use throttle ENGINE_SOUND_FADE_DIMENSION = 6969 -- dimension for unloading sounds ENGINE_SOUND_DISTANCE = 80 -- max distance DEBUG = false -- offsets of exhaust flames local als = { [411] = { {-0.60, -2.4, -0.3}, }, [451] = { {0, -2.5, -0.35}, }, [506] = { {-0.44, -2.4, -0.20}, {-0.38, -2.4, -0.20}, }, [401] = { {-0.70, -2.2, -0.4}, {0.70, -2.2, -0.4}, }, [503] = { {-0.50, -2.4, -0.3}, {0.50, -2.4, -0.3}, }, [419] = { {-0.50, -2.5, -0.3}, {0.50, -2.5, -0.3}, }, [562] = { {-0.70, -2.4, -0.3}, {0.70, -2.4, -0.3}, }, [534] = { {-0.70, -2.2, -0.3}, {0.70, -2.2, -0.3}, }, [496] = { {-0.65, -2.4, -0.4}, }, [494] = { {-0.50, -2.3, -0.2}, {0.50, -2.3, -0.2}, }, [517] = { {-0.60, -2.3, -0.5}, {0.60, -2.4, -0.5}, }, [541] = { {-0.62, -2.3, -0.4}, {0.62, -2.4, -0.4}, }, [458] = { {-0.70, -2.7, -0.5}, {0.70, -2.7, -0.5}, }, [529] = { {-0.68, -2.4, -0.3}, {0.68, -2.4, -0.3}, }, [429] = { {-0.40, -2.5, -0.3}, {0.40, -2.5, -0.3}, }, [405] = { {-0.60, -2.8, -0.3}, {0.60, -2.8, -0.3}, }, [602] = { {-0.55, -2.4, -0.2}, }, [555] = { {-0.50, -2.4, -0.6}, {0.50, -2.4, -0.6}, }, [507] = { {-0.65, -2.9, -0.4}, {0.65, -2.9, -0.4}, }, [420] = { {-0.10, -2.4, -0.3}, {0.10, -2.4, -0.3}, }, [546] = { {0.50, -2.4, -0.3}, }, [565] = { {-0.50, -2.3, -0.5}, {0.50, -2.3, -0.5}, }, [410] = { {-0.55, -2.1, -0.4}, {0.55, -2.1, -0.4}, }, [421] = { {0.60, -2.7, 0.09}, {0.70, -2.7, 0.09}, }, [492] = { {-0.160, -2.3, -0.4}, {0.190, -2.3, -0.4}, }, [561] = { {0.70, -2.7, -0.3}, }, [426] = { {0.65, -2.5, -0.5}, }, [585] = { {0.70, -2.3, -0.3}, }, [547] = { {-0.60, -2.7, -0.3}, {0.60, -2.7, -0.3}, }, [451] = { {-0.45, -2.1, -0.4}, {0.45, -2.1, -0.4}, }, [527] = { {-0.65, -2.2, -0.4}, {0.65, -2.2, -0.4}, }, [491] = { {-0.59, -2.5, -0.4}, {0.59, -2.5, -0.4}, }, [558] = { {0.50, -2.9, -0.3}, }, [558] = { {0.50, -2.9, -0.3}, }, [466] = { {-0.65, -2.7, -0.2}, {0.65, -2.7, -0.2}, }, [560] = { {-0.70, -2.7, -0.5}, }, [526] = { {-0.65, -2.7, -0.3}, {0.65, -2.7, -0.3}, }, [404] = { {-0.50, -2.6, -0.5}, {0.50, -2.6, -0.5}, }, [589] = { {-0.50, -2.5, -0.5}, {0.50, -2.5, -0.5}, }, [438] = { {-0.60, -2.1, -0.1}, {0.60, -2.1, -0.1}, }, [409] = { {-0.55, -2.8, -0.3}, }, [479] = { {-0.55, -2.6, -0.3}, {0.55, -2.6, -0.3}, }, } local streamedVehicles = {} local pi = math.pi function calculateGearRatios(vehicle, maxRPM, startRatio) local ratios = {} local handling = getVehicleHandling(vehicle) local gears = math.max(4, handling.numberOfGears) local maxVelocity = handling.maxVelocity local acc = handling.engineAcceleration local drag = handling.dragCoeff --local c = ((acc*maxVelocity) / maxRPM)*(maxRPM*0.00175) --local c = startRatio or ((acc / drag / maxVelocity) * pi) * 20 local curGear, curRatio = 1, 0 local mRPM = maxVelocity * 100 mRPM = ((maxRPM*gears)/mRPM)*maxRPM repeat if mRPM/curGear > maxRPM*curRatio then curRatio = curRatio+0.1/curGear else ratios[curGear] = curRatio*0.95 curGear = curGear+1 curRatio = 0 end until #ratios == gears ratios[0] = 0 ratios[-1] = ratios[1] --[[ ratios[0] = 0 for gear=1, gears do if gear > 1 then c = c - c*(gear*0.02) end ratios[gear] = (c / gear) end ratios[-1] = ratios[1] --]] return ratios end function updateEngines(dt) if not ENGINE_ENABLED then return end local myVehicle = getPedOccupiedVehicle(localPlayer) if myVehicle and getVehicleController(myVehicle) ~= localPlayer then myVehicle = false end local cx, cy, cz = getCameraMatrix() local now = getTickCount() for vehicle, data in pairs(streamedVehicles) do if isElement(vehicle) then local engine = getElementData(vehicle, "vehicle:engine") if engine then local x, y, z = getElementPosition(vehicle) local rx, ry, rz = getElementRotation (vehicle) local distance = getDistanceBetweenPoints3D(x, y, z, cx, cy, cz) if getVehicleEngineState(vehicle) == true and distance < ENGINE_SOUND_DISTANCE*2 then local model = getElementModel(vehicle) local handling = getVehicleHandling(vehicle) local velocityVec = Vector3(getElementVelocity(vehicle)) local velocity = velocityVec.length * 180 local controller = getVehicleController(vehicle) local upgrades = getElementData(vehicle, "vehicle:upgrades") or {} engine.gear = engine.gear or 1 engine.turbo = upgrades.turbo engine.turbo_shifts = upgrades.turbo engine.volMult = engine.volMult or 1 engine.shiftUpRPM = engine.shiftUpRPM or engine.maxRPM*0.91 engine.shiftDownRPM = engine.shiftDownRPM or (engine.idleRPM+engine.maxRPM)/2.5 data.prevThrottle = data.throttle data.throttle = controller and (getPedControlState(controller, "accelerate")) if not data.reverse and velocity < 10 then data.reverse = controller and (getPedAnalogControlState(controller, "brake_reverse") > 0.5)or false elseif data.throttle and velocity < 50 then data.reverse = false end local isSkidding = controller and ( ( getPedControlState(controller, "accelerate") and getPedControlState(controller, "brake_reverse") or getPedControlState(controller, "handbrake") ) and velocity < 40 ) or false data.forceNeutral = isSkidding -- w / s or handbrake without moving: neutral gear or (isLineOfSightClear(x, y, z, x, y, z-(getElementDistanceFromCentreOfMassToBaseOfModel(vehicle)*1.25), true, false, false, true, true, false, false, vehicle) and data.throttle) -- vehicle in air: neutral gear or isElementFrozen(vehicle) or isElementInWater(vehicle) -- frozen / in water: neutral gear or (( rx > 110 ) and ( rx < 250 )) -- on roof: neutral gear data.groundRPM = data.groundRPM or 0 data.throttlingRPM = data.throttlingRPM or 0 data.previousGear = data.previousGear or engine.gear data.gear = data.gear or 1 data.currentGear = data.currentGear or 1 data.changingGear = type(data.changingGear) == "number" and data.changingGear or false data.changingRPM = data.changingRPM or 0 data.changingTargetRPM = data.changingTargetRPM or 0 data.turboValue = data.turboValue or 0 data.prevTurboValue = data.turboValue data.als = upgrades.als or false data.effects = data.effects or {} local changedGear = false local gearRatios = calculateGearRatios(vehicle, engine.maxRPM, engine.startRatio or 1) local soundPack = engine.soundPack local wheel_rpm = velocity*100 local rpm = wheel_rpm -- engine rpm --if data.reverse then --data.currentGear = -1 --end -- calculating rpm + neutral gear if getVehicleController(vehicle) then rpm = rpm*gearRatios[data.gear] else rpm = engine.idleRPM end if not data.forceNeutral then data.throttlingRPM = math.max(0, data.throttlingRPM - (engine.maxRPM*0.0012)*dt) else if data.throttle then data.throttlingRPM = data.throttlingRPM + (engine.maxRPM*0.0012)*dt else data.throttlingRPM = math.max(0, data.throttlingRPM - (engine.maxRPM*0.0012)*dt) end data.throttlingRPM = math.min(data.throttlingRPM, engine.maxRPM) end rpm = rpm+data.throttlingRPM -- smooth rpm change rpm = rpm+data.changingRPM if data.changingGear then local progress = (now-data.changingTargetRPM.time) / 300 -- how long data.changingRPM = interpolateBetween(data.changingTargetRPM.target, 0, 0, 0, 0, 0, progress, "InQuad") if progress >= 1 then data.changingGear = false data.changingGearDirection = false data.changingRPM = 0 data.changingTargetRPM = false end end if data.previousGear ~= data.currentGear then changedGear = (data.currentGear < data.previousGear) and "down" or "up" data.changingGear = data.currentGear data.changingGearDirection = changedGear local nextrpm = engine.maxRPM if gearRatios[data.changingGear] then nextrpm = wheel_rpm*gearRatios[data.changingGear] end data.changingRPM = rpm-nextrpm data.changingTargetRPM = {target=data.changingRPM, time=now} data.gear = data.currentGear data.turboValue = 0 end -- prev gear update data.previousGear = data.currentGear -- change gears if not data.changingGear and data.throttlingRPM == 0 and wheel_rpm > 200 then if rpm > engine.shiftUpRPM and data.throttle then data.currentGear = math.min(data.currentGear+1, math.max(4, getVehicleHandling(vehicle).numberOfGears)) elseif rpm < engine.shiftDownRPM then data.currentGear = math.max(1, data.currentGear-1) end end -- rev limiter if rpm < engine.idleRPM then rpm = engine.idleRPM+math.random(0,100) elseif rpm > engine.maxRPM then rpm = engine.maxRPM-math.random(0,100) data.wasRevLimited = true end -- ALS if data.wasRevLimited then -- when using throttle if (data.rpm or 0) < engine.maxRPM*0.98 then data.wasRevLimited = false if data.als then data.activeALS = true end end else if changedGear == "up" and math.random(1, 4) == 1 then -- randomly with gear change if data.als then data.activeALS = true end elseif data.prevThrottle and not data.throttle and data.rpm > engine.maxRPM*0.5 and math.random(1, 2) == 1 then if data.als then data.activeALS = true end end end -- save rpm data.rpm = rpm -- turbo if engine.turbo then if data.throttle and rpm > engine.maxRPM/2 then data.turboValue = math.min(0.5, data.turboValue+ 0.0008*dt) else data.turboValue = math.max(0, data.turboValue - 0.0005*dt) end end -- sounds local svol = {} if not data.sounds then data.sounds = {} data.sounds[1] = playSound3D("sounds/"..soundPack.."/1.wav", x, y, z, true) data.sounds[2] = playSound3D("sounds/"..soundPack.."/2.wav", x, y, z, true) data.sounds[3] = playSound3D("sounds/"..soundPack.."/3.wav", x, y, z, true) data.sounds[4] = playSound3D("sounds/turbo.wav", x, y, z, true) for i=1, 3 do setSoundEffectEnabled(data.sounds[i], "compressor", true) end else -- engine local minMidProgress = math.min(1, (rpm+500)/(engine.maxRPM/2)) local maxMidProgress = minMidProgress - ((engine.maxRPM/2)/rpm) local highProgress = (rpm-(engine.maxRPM/2.2))/(engine.maxRPM/2.2) svol[1] = 1 - 2^(rpm/(engine.idleRPM*1.5) - 2) svol[2] = minMidProgress < 1 and interpolateBetween(0, 0, 0, 0.8, 0, 0, minMidProgress, "InQuad") or interpolateBetween(0.8, 0, 0, 0, 0, 0, maxMidProgress, "OutQuad") svol[3] = interpolateBetween(0, 0, 0, 1, 0, 0, highProgress, "OutQuad") local vol = svol[1] vol = vol*ENGINE_VOLUME_MASTER*engine.volMult if data.throttle then vol = vol*ENGINE_VOLUME_THROTTLE_BOOST end setSoundVolume(data.sounds[1], math.max(0, vol)) setSoundSpeed(data.sounds[2], rpm/(engine.idleRPM*2)) local vol = svol[2] vol = vol*ENGINE_VOLUME_MASTER*engine.volMult if data.throttle then vol = vol*ENGINE_VOLUME_THROTTLE_BOOST end if data.changingGearDirection == "up" and vol > 0.1 then vol = vol/2 end setSoundVolume(data.sounds[2], math.max(0, vol)) setSoundSpeed(data.sounds[2], rpm/(engine.maxRPM*0.6)) local vol = svol[3] vol = vol*ENGINE_VOLUME_MASTER*engine.volMult if data.throttle then vol = vol*ENGINE_VOLUME_THROTTLE_BOOST end if data.changingGearDirection == "up" and vol > 0.1 then vol = vol/2 end setSoundVolume(data.sounds[3], math.max(0, vol)) setSoundSpeed(data.sounds[3], rpm/(engine.maxRPM*0.925)) svol[4] = data.turboValue local vol = svol[4]*ENGINE_VOLUME_MASTER if data.throttle then vol = vol*ENGINE_VOLUME_THROTTLE_BOOST end setSoundVolume(data.sounds[4], math.max(0, vol*0.9)) setSoundSpeed(data.sounds[4], svol[4]+0.8) if ((changedGear == "up" and data.prevTurboValue > 0.2) or (not data.throttle and data.prevTurboValue > 0.2)) and engine.turbo_shifts then local sound = 1 if changedGear then sound = changedGear and changedGear == "up" and tostring(2) or tostring(1) end data.sounds[5] = playSound3D("sounds/turbo_shift"..sound..".wav", x, y, z, false) setSoundVolume(data.sounds[5], 0.6*ENGINE_VOLUME_MASTER) if not data.throttle then data.turboValue = 0 end end if data.activeALS and not isElement(data.sounds[6]) then data.sounds[6] = playSound3D("sounds/als"..math.random(1, 13)..".wav", x, y, z, false) setSoundVolume(data.sounds[6], 0.8) setSoundSpeed(data.sounds[6], 1.1) --setSoundEffectEnabled(data.sounds[6], "reverb", true) setSoundEffectEnabled(data.sounds[6], "echo", true) setSoundEffectEnabled(data.sounds[6], "compressor", true) for _, offset in ipairs((als[model] or {})) do local ef = createEffect("gunflash", x, y, z, 0, 0, 0) setEffectSpeed(ef, 0.25) setEffectDensity(ef, 2) data.effects[ef] = {offset[1], offset[2], offset[3], 90, 0, 180} setTimer(function() data.effects[ef] = nil destroyElement(ef) end, 1000, 1) end data.activeALS = false end for i=1, #data.sounds do local v = data.sounds[i] if isElement(v) then setElementPosition(v, x, y, z) setElementDimension(v, (svol[i] or 1) > 0 and getElementDimension(vehicle) or ENGINE_SOUND_FADE_DIMENSION) if vehicle == getPedOccupiedVehicle(localPlayer) then setSoundMaxDistance(v, ENGINE_SOUND_DISTANCE*2) else setSoundMaxDistance(v, ENGINE_SOUND_DISTANCE) end end end local rx, ry, rz = getElementRotation(vehicle) for ef, offset in pairs(data.effects) do if isElement(ef) then local ox, oy, oz = getPositionFromElementOffset(vehicle, offset[1], offset[2], offset[3]) setElementPosition(ef, ox, oy, oz) setElementRotation(ef, offset[4]-rx, offset[5]-ry, offset[6]-rz) end end end if DEBUG and vehicle == myVehicle then dxDrawText("Silnik\nTyp: "..tostring(engine.name).."\nRPM: "..tostring(rpm).."\nVol1: "..tostring(svol[1]).."\nVol2: "..tostring(svol[2]).."\nVol3: "..tostring(svol[3]).."\nTurboVol: "..tostring(svol[4]), 300, 300) local t = "Biegi\nBieg: "..tostring(data.gear).."/"..tostring(#gearRatios).."\n" for k, v in ipairs(gearRatios) do t = t.."Ratio "..tostring(k)..": "..v.."\n" end dxDrawText(t, 300, 440) end else if data.sounds then for k, v in ipairs(data.sounds) do if isElement(v) then destroyElement(v) end end data.sounds = false end data.rpm = 0 data.gear = 1 data.previousGear = 0 end end end end end addEventHandler("onClientPreRender", root, updateEngines) blowdurum = false function blowac() if blowdurum == false then addEventHandler( "onClientHUDRender", root,updateEngines) blowdurum = true end end function blowkapa() if blowdurum == true then removeEventHandler( "onClientHUDRender", root,updateEngines) blowdurum = false end end function streamInVehicle(vehicle) if not streamedVehicles[vehicle] then if isElement(vehicle) and getElementData(vehicle, "vehicle:engine") then streamedVehicles[vehicle] = {} addEventHandler("onClientElementDestroy", vehicle, function() streamOutVehicle(source) end) end end end function streamOutVehicle(vehicle) if streamedVehicles[vehicle] then if streamedVehicles[vehicle].sounds then for k, v in ipairs(streamedVehicles[vehicle].sounds) do if isElement(v) then destroyElement(v) end end end streamedVehicles[vehicle] = nil end end function toggleGTAEngineSounds(bool) setWorldSoundEnabled(7, bool) setWorldSoundEnabled(8, bool) setWorldSoundEnabled(9, bool) setWorldSoundEnabled(10, bool) setWorldSoundEnabled(11, bool) setWorldSoundEnabled(12, bool) setWorldSoundEnabled(13, bool) setWorldSoundEnabled(14, bool) setWorldSoundEnabled(15, bool) setWorldSoundEnabled(16, bool) setWorldSoundEnabled(40, bool) end function getGTARPM(vehicle) if (vehicle) then local velocityVec = Vector3(getElementVelocity(vehicle)) local velocity = velocityVec.length * 180 if (isVehicleOnGround(vehicle)) then if (getVehicleEngineState(vehicle) == true) then if(getVehicleCurrentGear(vehicle) > 0) then vehicleRPM = math.floor(((velocity/getVehicleCurrentGear(vehicle))*150) + 0.5) if (vehicleRPM < 650) then vehicleRPM = math.random(650, 750) elseif (vehicleRPM >= 8000) then vehicleRPM = 8000 end else vehicleRPM = math.floor(((velocity/1)*220) + 0.5) if (vehicleRPM < 650) then vehicleRPM = math.random(650, 750) elseif (vehicleRPM >= 8000) then vehicleRPM = 8000 end end else vehicleRPM = 0 end else if (getVehicleEngineState(vehicle) == true) then vehicleRPM = vehicleRPM - 150 if (vehicleRPM < 650) then vehicleRPM = math.random(650, 750) elseif (vehicleRPM >= 8000) then vehicleRPM = 8000 end else vehicleRPM = 0 end end return tonumber(vehicleRPM) else return 0 end end -- EKSPORT function getVehicleRPM(vehicle) if streamedVehicles[vehicle] then return streamedVehicles[vehicle].rpm or getGTARPM(vehicle) else return getGTARPM(vehicle) end end function getVehicleGear(vehicle) if streamedVehicles[vehicle] then return streamedVehicles[vehicle].gear or getVehicleCurrentGear(vehicle) else return getVehicleCurrentGear(vehicle) end end function toggleEngines(bool) ENGINE_ENABLED = bool toggleGTAEngineSounds(not ENGINE_ENABLED) if bool == true then for k, v in ipairs(getElementsByType("vehicle", root, true)) do streamInVehicle(v) end else for vehicle, data in pairs(streamedVehicles) do streamOutVehicle(vehicle) end streamedVehicles = {} end end addEvent("onClientRefreshEngineSounds", true) addEventHandler("onClientRefreshEngineSounds", root, function() for _, v in pairs(streamedVehicles) do for _, sound in pairs(v.sounds or {}) do if isElement(sound) then stopSound(sound) end end v.sounds = nil end end) addEventHandler("onClientElementStreamIn", root, function() if getElementType(source) == "vehicle" then streamInVehicle(source) end end ) addEventHandler("onClientElementStreamOut", root, function() streamOutVehicle(source) end ) addEventHandler("onClientVehicleEnter", root, function(player, seat) if seat == 0 then setTimer(streamInVehicle, 200, 1, source) end end) addEventHandler("onClientResourceStart", resourceRoot, function() toggleEngines(true) end) addEventHandler("onClientResourceStop", resourceRoot, function() for k, v in pairs(streamedVehicles) do if v.sounds and #v.sounds > 0 then for _, sound in pairs(v.sounds) do if isElement(sound) then destroyElement(sound) end end end end toggleGTAEngineSounds(true) end) function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) -- Get the matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] -- Apply transform local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z -- Return the transformed point end
  25. After I finished the first version of my character customization system i just realized its such a piece of crap, so i started writing a new version with a whole new concept. The first version worked with CJ skin and i just attached some custom head models to it. Conversely the new version is running with shaders and the skin is a custom dff. Here is a video of the head customization. The clothing is in progress yet, it takes a lot of time because i have to make custom cloth models. Hope you like it. Please don't ask for the source code, this script will never be released. Sorry.
×
×
  • Create New...