Jump to content

Search the Community

Showing results for tags 'help'.

  • 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. Hello, I want to make a repository for groups but I am not very knowledgeable. My goal thing is a locker or warehouse where they can store weapons. I would be very happy if you help
  2. Hello, I want to know how can I detect when a bot dies? But, not when someone kills it, only when it dies, for example when it jumped off a cliff, or another bot killed it, i mean, only detect when it dies in a general way and give a reward by dropping a pickup.
  3. I've been playing MTA on and off on 2715x1527x32 and it was always above 60 fps, today I changed my resolution to 1920x1080x32 before launching the game and when I did that my game got limited to 10 fps. When that I happened I decided to go back to my old resolution however that didn't fix the fps issue. I tried to reinstall the game and it still didn't work, I even changed the bit level in properties but that keeps getting unchecked after I run the game, I also tried running the game on CPU 0 but but there was no hope. I tried all of the resolutions in the drop-box list and still didn't work apart from the 720x480x32 and lower. The game used to run butter smooth but now I can't even play it because ever since I updated that resolution today. How can I resolve this issue? Thanks
  4. Sziasztok! Írnék egy munka kódot de valami baj van és nem értem mi a baj. ---Server side for i, player in ipairs(getElementsByType("player")) do setElementData(player, "Jobveh", false) end local vehpos = { [1] = {2742.76416, -2468.74683, 13.64844}, [2] = {2742.69360, -2460.06079, 13.64844}, }; local Deliverypos = { } local Marker = createMarker(2744.14453, -2453.91431, 13.86226, "cylinder", 3, 255) local VehIDJobs = {609, 499}, addEventHandler("onMarkerHit", resourceRoot, function(hitElement, mDim) if (mDim) then if (source == Marker) then if (getElementType(hitElement) == "player") then if not (getElementType(HitElement, "Jobveh")) then local Veh for i, spot in pairs(vehpos) do createVehicle(609, spot[1], spot[2], spot[3]) setElementData(hitElement, "Jobveh", Jobveh) veh = true break; end end if (veh) then end end end end end end
  5. Hello everyone. I am creating a skins store, but I would like to know how I can save each skin I buy in a list, as items since there are many skins. Is there a way to create a save system for each skin? saving it by id? I don't know if I explain myself well.
  6. Xwaw

    Nitro value

    Hello Is it possible to somehow check the value of how much NOS you have in the vehicle because I am looking for but not which do not seem to work as if they were not at all. I need this value to make a bar that will show how much nitro the vehicle has.
  7. Let's talk script security. It might be a taboo topic for some but it shouldn't, at all. In fact, the more people talk about this and unite to discuss and create robust, safe and well-coded scripts, the better the MTA resource development community will be. Rules: Main article: https://wiki.multitheftauto.com/wiki/Script_security The key points are there, but the code examples don't suffice, and the implementations will vary depending on the gamemode and resources. Pinned information: Coming soon Notes: - I'm not perfect and everyone makes mistakes. Please correct me when I'm wrong. - Eventually if this becomes a popular topic, I am willing to incorporate translations of certain explanations into other languages in this OP, as I know a majority of the MTA community doesn't master the English language and prefers to communicate and read in other languages.
  8. Hi I wanted to learn how to create my own shaders for this game from lighting starting to moving texture on the wall. I would really like someone to give me a link to a page where I can find all the functions or if someone wants to explain to me what it is all about
  9. Nesse script abaixo se você arrastar o item do inventario chamado "chavedefenda" ele executa uma função eu gostaria q esse item roubasse cada pneu do carro ou seja o jogador chega perto do pneu e arrasta a chave de fenda pro carro ai ele começa a roubar o pneu do carro quando ele termina de roubar o pneu vai pro inventario e o pneu do carro some automaticamente o mesmo serve pra quando o jogador tem o pneu no inventario ai arrasta a chave de fenda pro carro fazendo assim ele coloca o pneu de volta no carro ou seja se ele tiver o pneu no inventario e o carro não tiver um ou mais pneus ele coloca o pneu no lugar e ele sai do inventario do jogador quem conseguir fazer pra mim elseif getElementType(target) == "vehicle" then --Interação com veículos if item == "toolbox" then --Reparar o veículos drop = false local health = getElementHealth(target) if health >= 1000 then sendNotification(player, "error", "O veículo não precisa de reparo.") return false end local result = takeItem(player, slot, "toolbox", 1) if result then closeInventory(player) setPedAnimation(player, "OTB", "betslp_loop", 0, true, true, false) toggleControl(player, "fire", false) toggleControl(player, "jump", false) setElementFrozen(target, true) toggleAllControls(player, false) playSound3D(target, "fix.mp3", 20) sendProgressbar(player, 15, "Reparando o veículo...") cooldown[player] = setTimer(function() setPedAnimation( player, "ped", "facanger", 0, false, false, false) toggleControl(player, "fire", true) toggleControl(player, "jump", true) setElementFrozen(target, false) toggleAllControls(player, true) setElementHealth(target, 1000) fixVehicle(target) cooldown[player] = nil sendNotification(player, "success", "Veículo reparado com sucesso.") end, 1000*15, 1) else sendNotification(player, "error", "Ocorreu um erro ao usar este item.") end elseif item == "chavedefenda" then drop = false local theVehicle = getPedOccupiedVehicle ( player ) if ( theVehicle ) then sendNotification(player, "error", "Desça do veiculo primeiro") return false end local result = takeItem(player, slot, "chavedefenda", 1) if result then closeInventory(player) setPedAnimation(player, "OTB", "betslp_loop", 0, true, true, false)--animação roubando toggleControl(player, "fire", false) toggleControl(player, "jump", false) setElementFrozen(target, true) toggleAllControls(player, false) sendProgressbar(player, 15, "Roubando o pneu...") cooldown[player] = setTimer(function() setPedAnimation( player, "ped", "facanger", 0, false, false, false) toggleControl(player, "fire", true) toggleControl(player, "jump", true) setElementFrozen(target, false) toggleAllControls(player, true) --setElementData(target, "Gasolina", gasolina + 25) cooldown[player] = nil sendNotification(player, "success", "você roubou o pneu do veiculo com sucesso") end, 1000*15, 1) else sendNotification(player, "error", "Ocorreu um erro ao usar este item") end end end
  10. Esses 2 helicópteros contem armas q meus players que forem pilotar eles vão querer usar em algum momento eu gostaria de bloquear esses armamentos do meu servidor como eu poderia fazer isso?
  11. EU SIMPLESMENTE GOSTARIA QUE QUEM TIVESSE NAS ACLS VIPS [ DIAMANTE, OURO, PRATA, BRONZE ] TIVESSE MAIS SLOTS NA GARAGEM O SCRIPT É ASSIM createEventHandler ("MST.onPlayerBuyVehicle", getRootElement (), function (player, selecionado, cor_1, cor_2, cor_3, cor_4) if selecionado then local accName = getAccountName (getPlayerAccount (player)) local result = dbPoll (dbQuery (db, "SELECT * FROM Veiculos WHERE Conta = ? AND Modelo = ?", accName, selecionado.model), -1) if #result == 0 then if getAllPlayerVehicles (player) >= config.gerais.veiculosmax then --eu sei q é aqui q impede que o jogador compre mais carros message (player, "Você já possui a quantidade máxima de veículos", "error") return end local money = getPlayerMoney (player) if money >= selecionado.price then local id = NovoID () local cor = cor_1..", "..cor_2..", "..cor_3..", "..cor_4 local t_1, t_2, t_3, t_4, t_5, t_6, t_7, t_8, t_9, t_10, t_11, t_12, t_13, t_14, t_15 = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 local tunning = t_1..", "..t_2..", "..t_3..", "..t_4..", "..t_5..", "..t_6..", "..t_7..", "..t_8..", "..t_9..", "..t_10..", "..t_11..", "..t_12..", "..t_13..", "..t_14..", "..t_15 dbExec (db, "INSERT INTO Veiculos VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", accName, id, selecionado.name, selecionado.model, "Guardado", cor, tunning, "Não", 0, "SemPlaca", selecionado.price, 1000, 100) message (player, "Você comprou o veículo "..selecionado.name.." por R$"..convertNumber(selecionado.price)..",00.", "success") takePlayerMoney (player, selecionado.price) triggerClientEvent (player, "MST.onPlayerCloseEvents", player) else message (player, "Você não possui dinheiro suficiente.", "error") end else message (player, "Você já possui esse veículo.", "error") end else message (player, "Selecione algum veículo da lista.", "error") end end) --aqui é a função a cima q verifica os carros q o jogador tem na garagem function getAllPlayerVehicles (player) local accName = getAccountName (getPlayerAccount (player)) local result = dbPoll (dbQuery (db, "SELECT * FROM Veiculos WHERE Conta = ?", accName), -1) return #result end --aqui e no arquivo de configuração config = { gerais = { veiculosmax = 2, -- Veículos Máximos que o Jogador vai poder ter na Garagem. elementfuel = "Gasolina", -- Element Data de Gasolina do seu Servidor. elementid = "ID", -- Element Data de ID do seu Servidor. infobox = "addBox", -- Evento da sua Infobox. distancia = 30, -- Distancia do Player e do Veículo. (Guardar Veículo) velocitymax = 400, -- Velocidade Máximas de todos os Veículos. acls = {"Console"}, -- ACL's Administradoras do seu Servidor. },
  12. Preciso de uma ajuda em algo meio q simples basicamente eu preciso q não deixe o jogador retirar o outro do veiculo caso já tenha alguém dirigindo o veiculo por exemplo eu vou roubar o carro do cara e basicamente não conseguir preciso q isso sirva pra todos os veículos q tenha como roubar. Outro exemplo seria o carro tem um motorista mais está destrancado ai vem um iniciante no servidor e tenta roubar o carro do cara ele não irá conseguir pegar o carro somente quando o caso estiver sem nenhum jogador dentro
  13. ERROR EN LA CONSOLA: ERROR: items/itemsS.lua:671: attempt to index global 'trash' (a nil value) El error me aparece cada vez que inicio el server y cada vez que le hago restart a cualquier script, no entiendo, me tiene cabezón. Resalto la línea 671 del error en amarrillo. (línea del supuesto error) local sistemaitems function loadTrash() local query = dbQuery(connection, "SELECT * FROM bins;" ) local result, numrows = dbPoll(query, -1) if (result and numrows > 0) then for index, trashPos in pairs(result) do trashPos = fromJSON(trash["pos"]) or "[[ 0,0,0,0,0,0,0,0 ]]" sistemaitems = createObject(1359, trashPos[1],trashPos[2], trashPos[3]-0.4, trashPos[4], trashPos[5], trashPos[6]) setElementData(sistemaitems, "sistemaID", trash['id']) setElementInterior(sistemaitems, trashPos[7]) setElementDimension(sistemaitems, trashPos[8]) end end end addCommandHandler("papelera", function(playerSource, cmd) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Console")) then local x, y, z = getElementPosition(playerSource) local rx, ry, rz = getElementRotation(playerSource) local int = getElementInterior(playerSource) local Dim = getElementDimension(playerSource) local Query, _, insertID = dbQuery(connection,"INSERT INTO bins (pos) VALUES(?)", toJSON({x, y, z, rx, ry, rz, int ,Dim})) local checkQuery, _, insertID = dbPoll ( Query, -1 ) if checkQuery then outputChatBox("#7cc776[Inventario] #ffffff Papelera creada.", playerSource, 255,255, 255, true) sistemaitems = createObject(1359, x, y, z-0.4, rx, ry, rz) setElementData(sistemaitems, "sistemaID", insertID) setElementInterior(sistemaitems, int) setElementDimension(sistemaitems, Dim) end end end) El código es parte de un sistema de papelera para desechar items, todo lo demás corre muy bien. Será algún problema con mi sistema de ID?
  14. Sziasztok! Olyan kérdésem lenne, hogy valaki tudna-e legalább útba igazítani, hogyan tudnék egy 3D pozíciónáló scriptet készíteni, mint pl. SeeMTA-n a kiegészítőknél. Válaszokat előre köszönöm.
  15. Stardust

    Kicked: VF #2

    Hi, my friend is having an issue with connecting to all servers in MTA. Error message came on display: Disconnected: You were kicked by (VF #2 03030000) https://imgur.com/a/ZGv5euu Anyone here can help me point out the solution? I'm new in this and trying to fix the problem, thanks!
  16. hello im using 3ds max studios 2010 and trying to create animations but when i try to exports dont show my animation: prints: https://imgur.com/a/zqL8lcu
  17. function giveV(player, car_id) if player and isElement(player) then if car_id and type(car_id) == 'number' then local _,i = hasV(player, car_id) local garagem = getElementData(player, 'conce.garage') or {} if i then outputChatBox('Você já tem este carro!') --infobox return false else table.insert(garagem, {id = car_id}) setElementData(player, 'conce.garagem', garagem) outputChatBox('Você adquiriu um '..vehicle[car_id].name..'.') --infobox return true end else outputDebugString('Aguardando arg #2 válido para a function hasV') return false end else outputDebugString('Aguardando arg #1 válido para a function hasV') return false end end I'm struggling to make a dealership script, but the giveV function doesn't add the car to the garage list even if the checks pass. Can anyone help?
  18. I can't verify if the vehicle's id is the same as the spawned one and if it's going to destroy it! addEvent('onPlayerRequestSpawnV', true) addEventHandler('onPlayerRequestSpawnV', root, function(vid) local x,y,z = getElementPosition(source); local _,_,r = getElementRotation(source); local spawnedV = getElementData(source, 'conce.garagem.spawneds') or {}; for i,v in ipairs(spawnedV) do if i.vidC == vid then if i.vh and isElement(i.vh) then destroyElement(i.vh) return false; end end end vehicleSV = createVehicle(vid, x,y,z,_,_,r) warpPedIntoVehicle(source, vehicleSV) table.insert(spawnedV, {vidC = vid, vh = vehicleSV}) end); This is my current code...
  19. local x,y,z,lx,ly,lz = getCameraMatrix() addCommandHandler("getmatrixcam", function() outputChatBox("your position is:" ..x,y,z,lx,ly,lz.. ".") end) Does anyone know what the problem is with this code? (I am using the translator). I'm new to scripting... ERRO: Bad argument @'outputChatBox' [expected bool at argument 5, got number '-1710.618...']
  20. Hello, I have a problem with this code, this creates a Dx on you that other players can see, it is activated with a trigger from the server-side and a setElementData, but when I use it at the same time as someone else the render gets bug, It says that it was already handled.. local sX, sY = guiGetScreenSize ( ) local onEmoji4 = {}; local plyEmoji4 = getElementsByType ( "player" ) local showEmoji4 = false function onEmoji4Render ( ) local cx, cy, cz = getCameraMatrix () for i = 1, #plyEmoji4 do local p = plyEmoji4[i] if ( onEmoji4[p] ) then local x, y, z = getPedBonePosition.. --- -- blag blah blah local dEmoji4 = getDistanceBetweenPoints3D ( cx... -- blag blah blah if ( dEmoji4 < 100 ) then if ( isLineOfSightClear ( cx, cy... -- blag blah blah if (getElementData (p, "Emoji4") == true) then local sx, sy = getScreenFromWorldPosition...-- blag blah blah if ( sx ) and ( sy ) then local sEmoji4 = 400 / ...-- blag blah blah dxDrawImage ( sx - ( sEmoji4 / 2 ), sy - ( sEmoji4 / 2 ), sEmoji4, sEmoji4, "T_UI_Message_Icon_Aisatsu_BC.webp", 0, 0, 0, tocolor ( 255, 255, 255, 255 ) ) end end end end end end end function attachEmoji4 ( Emoji4 ) if not ( Emoji4 and isElement ( Emoji4 ) ) then return end onEmoji4[Emoji4] = true addEventHandler ( "onClientRender", root, onEmoji4Render ) setTimer(function() removeEventHandler ( "onClientRender", root, onEmoji4Render ) end, 2000, 1) end addEvent( "StartEmoji", true ) addEventHandler( "StartEmoji", root, attachEmoji4 )
  21. Hola que tal, quisiera que me orientaran en algo. Hay un código de un usuario aquí en el foro que permite caminar en el agua utilizando la creación de un objeto y render bajo el jugador, el problema es que esto solo lo ve el jugador que lo ejecuta, no pueden verlo los demás. He intentado con un trigger desde el server side pero no he podido lograr que funcione, quisiera que me orientaran al respecto para lograr que los demás players te vean caminando sobre el agua... por acá adjunto el código original y post del usuario: https://forum.multitheftauto.com/topic/58614-water-walk/ -- water walk local obj = {} function WaterWalk() if obj[localPlayer] then local x,y,_ = getElementPosition(localPlayer) setElementPosition(obj[localPlayer],x,y,-.5) end end addEventHandler ("onClientRender",root,WaterWalk) function WaterOn() local px,py,_ = getElementPosition(localPlayer) obj[localPlayer] = createObject(1221,px,py,0) setElementAlpha(obj[localPlayer],0) end addCommandHandler("water",WaterOn)
  22. Olá estou com um problema com este resource de Painel de Sirene, o problema é o seguinte eu tenho markers no servidor para criar os veiculos que tenhem esse painel e tambem tem markers para os destruir, porem quando alguem destroi o veiculo com a sirene ou buzina ligada ela fica em loop sem parar ou seja o veiculo é deletado mas ela fica ali tocando Já tentei de todas as formas não consigo arrumar isso alguém pode ajudar? Client-side --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- local sx,sy = guiGetScreenSize() local screenW,screenH = guiGetScreenSize() local resW, resH = 1280, 720 local x, y = (screenW/resW), (screenH/resH) function dxsirenepainelsprp () local theVehicle = getPedOccupiedVehicle ( localPlayer ) if ( theVehicle ) then if getPedOccupiedVehicleSeat(localPlayer) == 1 or getPedOccupiedVehicleSeat(localPlayer) == 0 then if ( getElementModel ( theVehicle ) == 436 ) or ( getElementModel ( theVehicle ) == 490 ) or ( getElementModel ( theVehicle ) == 404 ) then dxDrawRectangle(screenW * 0.5477, screenH * 0.8151, screenW * 0.2350, screenH * 0.1471, tocolor(0, 0, 0, 255), false) dxDrawText("Painel Sirene", screenW * 0.3377, screenH * 0.8151, screenW * 0.9927, screenH * 0.8411, tocolor(255, 140, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false) if getElementData ( theVehicle, "vtrgiroflex" ) == false then dxDrawRectangle(screenW * 0.5550, screenH * 0.8867, screenW * 0.0637, screenH * 0.0417, tocolor(9, 9, 9, 180), false) else dxDrawRectangle(screenW * 0.5550, screenH * 0.8867, screenW * 0.0637, screenH * 0.0417, tocolor(255, 140, 0, 255), false) end if getElementData ( theVehicle, "vtrsirene" ) == false then dxDrawRectangle(screenW * 0.6319, screenH * 0.8867, screenW * 0.0637, screenH * 0.0417, tocolor(9, 9, 9, 180), false) else dxDrawRectangle(screenW * 0.6319, screenH * 0.8867, screenW * 0.0637, screenH * 0.0417, tocolor(255, 140, 0, 255), false) end if getElementData ( theVehicle, "vtrbuzina" ) == false then dxDrawRectangle(screenW * 0.7117, screenH * 0.8867, screenW * 0.0637, screenH * 0.0417, tocolor(9, 9, 9, 180), false) else dxDrawRectangle(screenW * 0.7117, screenH * 0.8867, screenW * 0.0637, screenH * 0.0417, tocolor(255, 140, 0, 255), false) end dxDrawText("1", screenW * 0.3468, screenH * 0.8672, screenW * 0.8287, screenH * 0.8867, tocolor(255, 140, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false) dxDrawText("2", screenW * 0.4212, screenH * 0.8672, screenW * 0.9056, screenH * 0.8867, tocolor(255, 140, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false) dxDrawText("3", screenW * 0.5023, screenH * 0.8672, screenW * 0.9854, screenH * 0.8867, tocolor(255, 140, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false) dxDrawText("Giroflex", screenW * 0.3500, screenH * 0.8932, screenW * 0.8214, screenH * 0.9206, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false) dxDrawText("Sirene", screenW * 0.4322, screenH * 0.8932, screenW * 0.8953, screenH * 0.9206, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false) dxDrawText("Buzina", screenW * 0.5103, screenH * 0.8932, screenW * 0.9780, screenH * 0.9206, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false) end end end end addEventHandler ( "onClientRender", getRootElement (), dxsirenepainelsprp ) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- local vehiclesSirenes = {} addEvent("startSireneSound",true) addEventHandler("startSireneSound",root, function() local theVehicle = getPedOccupiedVehicle ( localPlayer ) if ( theVehicle ) then if(vehiclesSirenes[source])then destroyElement(vehiclesSirenes[source]) vehiclesSirenes[source] = nil setElementData(theVehicle, "vtrsirene", false) else setElementData(theVehicle, "vtrsirene", true) vehiclesSirenes[source] = playSound3D( "sirene.mp3", 0,0,0, true ) setSoundMaxDistance(vehiclesSirenes[source], 150 ) setSoundVolume (vehiclesSirenes[source], 0.1) attachElements (vehiclesSirenes[source], source, 0, 0, 0 ) end end end) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- local vehiclesSirene3 = {} addEvent("startSireneSound3",true) addEventHandler("startSireneSound3",root, function() local theVehicle = getPedOccupiedVehicle ( localPlayer ) if ( theVehicle ) then if(vehiclesSirene3[source])then destroyElement(vehiclesSirene3[source]) vehiclesSirene3[source] = nil setElementData(theVehicle, "vtrbuzina", false) else setElementData(theVehicle, "vtrbuzina", true) vehiclesSirene3[source] = playSound3D( "horn.mp3", 0,0,0, true ) setSoundMaxDistance(vehiclesSirene3[source], 100 ) setSoundVolume (vehiclesSirene3[source], 1.0) attachElements (vehiclesSirene3[source], source, 0, 0, 0 ) end end end) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Emergency Lights resource by vovo4ka -- please, do not remove copyright -- Edited by #FurkanOzulus [OzulusTR] -- Special Thanks, vovo4ka for the this script :) local strobo_interval = 5 -- strobo light freq. 10 = 0.5 sec local is_strobo_enabled = enable -- enable/disable stroboscopic lights mode -- lamps local flash_interval = 2 -- flash freq -- led blink mode local blink_interval = 20 -- blink interval local blink_duration = 2 -- 1..blink_interval local car_lights_table = { -- Enforcer [427] = {["mode"]="lamp", [1]={["pos"]={0.45, 1.1, 1.42}, ["color"]={255,0,0}, ["size"]=0.2, ["phase"]=10.0}, [2]={["pos"]={-0.45, 1.1, 1.42}, ["color"]={255,0,0}, ["size"]=0.2, ["phase"]=10.0}, [3]={["pos"]={0.22, 1.1, 1.42}, ["color"]={255,0,0}, ["size"]=0.2, ["phase"]=0.0}, [4]={["pos"]={-0.22, 1.1, 1.42}, ["color"]={255,0,0}, ["size"]=0.2, ["phase"]=0.0}, [5]={["pos"]={-1.18, 0.1, 0.94}, ["color"]={255,0,0}, ["size"]=0.1, ["phase"]=0.0}, [6]={["pos"]={-1.18, -1.63, 0.94}, ["color"]={255,0,0}, ["size"]=0.1, ["phase"]=5.0}, [7]={["pos"]={-1.18, -3.37, 0.94}, ["color"]={255,0,0}, ["size"]=0.1, ["phase"]=10.0}, [8]={["pos"]={1.18, 0.1, 0.94}, ["color"]={255,0,0}, ["size"]=0.1, ["phase"]=0.0}, [9]={["pos"]={1.18, -1.63, 0.94}, ["color"]={255,0,0}, ["size"]=0.1, ["phase"]=5.0}, [10]={["pos"]={1.18, -3.37, 0.94}, ["color"]={255,0,0}, ["size"]=0.1, ["phase"]=10.0} }, -- Elegant PassatVtr -- Police Speed [436] = {["mode"]="led", [1]={["pos"]={-0.5,-0.1, 0.8}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=0.0}, [2]={["pos"]={0.5, -0.1, 0.8}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=0.0}, [3]={["pos"]={-0.1, 0.1, 0.8}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=0.0}, [4]={["pos"]={0.1, 0.1, 0.8}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=0.0}, [5]={["pos"]={-0.6, -0.25, 0.8}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=0.0}, [6]={["pos"]={0.6, -0.25, 0.8}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=0.0}, [7]={["pos"]={-0.2,0, 0.8}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=0.0}, [8]={["pos"]={0.2, 0, 0.8}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=0.0}, -- [17]={["pos"]={-0.5,-0.1, 0.8}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=10.0}, [18]={["pos"]={0.5, -0.1, 0.8}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=10.0}, [19]={["pos"]={-0.1, 0.1, 0.8}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=10.0}, [199]={["pos"]={0.1, 0.1, 0.8}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=10.0}, [188]={["pos"]={-0.6, -0.25, 0.8}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=10.0}, [166]={["pos"]={0.6, -0.25, 0.8}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=10.0}, [177]={["pos"]={-0.2,0, 0.8}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=10.0}, [155]={["pos"]={0.2, 0, 0.8}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=10.0}, --=-=-=-- [40]={["pos"]={-0.77, 2.10, 0.10}, ["color"]={255,0,0}, ["size"]=0.1, ["phase"]=1.0}, [41]={["pos"]={0.77, 2.10, 0.10}, ["color"]={255,0,0}, ["size"]=0.1, ["phase"]=1.0}, [42]={["pos"]={-0.6, 2.26, 0.10}, ["color"]={0,0,255}, ["size"]=0.1, ["phase"]=0.0}, [43]={["pos"]={0.6, 2.26, 0.10}, ["color"]={0,0,255}, ["size"]=0.1, ["phase"]=0.0}, ----frente^ }, -- radio patrulha [404] = {["mode"]="led", [1]={["pos"]={-0.5,-0.1, 1.0}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=0.0}, [2]={["pos"]={0.5, -0.1, 1.0}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=0.0}, [3]={["pos"]={-0.1, 0.1, 1.0}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=0.0}, [4]={["pos"]={0.1, 0.1, 1.0}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=0.0}, [5]={["pos"]={-0.6, -0.25, 1.0}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=0.0}, [6]={["pos"]={0.6, -0.25, 1.0}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=0.0}, [7]={["pos"]={-0.2,0, 1.0}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=0.0}, [8]={["pos"]={0.2, 0, 1.0}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=0.0}, -- [17]={["pos"]={-0.5,-0.1, 1.0}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=10.0}, [18]={["pos"]={0.5, -0.1, 1.0}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=10.0}, [19]={["pos"]={-0.1, 0.1, 1.0}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=10.0}, [199]={["pos"]={0.1, 0.1, 1.0}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=10.0}, [188]={["pos"]={-0.6, -0.25, 1.0}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=10.0}, [166]={["pos"]={0.6, -0.25, 1.0}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=10.0}, [177]={["pos"]={-0.2,0, 1.0}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=10.0}, [155]={["pos"]={0.2, 0, 1.0}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=10.0}, --=-=-=-- [40]={["pos"]={-0.77, 2.16, -0.36}, ["color"]={255,0,0}, ["size"]=0.1, ["phase"]=1.0}, [41]={["pos"]={0.77, 2.16, -0.36}, ["color"]={255,0,0}, ["size"]=0.1, ["phase"]=1.0}, [42]={["pos"]={-0.6, 2.36, -0.36}, ["color"]={0,0,255}, ["size"]=0.1, ["phase"]=0.0}, [43]={["pos"]={0.6, 2.36, -0.36}, ["color"]={0,0,255}, ["size"]=0.1, ["phase"]=0.0}, ----frente^ }, --------=========--------- -- FBI Rancher [490] = {["mode"]="lamp", [1]={["pos"]={0, 0.2, 0.9}, ["color"]={255,0,0}, ["size"]=0.4, ["phase"]=5.0}, [2]={["pos"]={0.4, 0, 0.9}, ["color"]={255,0,0}, ["size"]=0.4, ["phase"]=0.0}, [3]={["pos"]={-0.4, 0, 0.9}, ["color"]={255,0,0}, ["size"]=0.4, ["phase"]=15.0}, [4]={["pos"]={0.55, -0.2, 0.9}, ["color"]={255,0,0}, ["size"]=0.4, ["phase"]=7.0}, [5]={["pos"]={-0.55, -0.2, 0.9}, ["color"]={255,0,0}, ["size"]=0.4, ["phase"]=20.0} }, -- since 0.8 there are no default lights position, because only emergency and pre-defined vehicles can use lights --["default"] = {["mode"]="lamp", [1]={["pos"]={0.5, 0, 0.8}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=0.0}, [2]={["pos"]={-0.5, 0, 0.8}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=10.0}} } -- do not modify -------------------------------------------- local vehicles = {} local timers = {} local base_freq = 50 -- freq of timer for light change ------------------------------------------------------------- function release_vehicle(vehicle) if (isElement(vehicle)) then if (is_strobo_enabled) then setVehicleOverrideLights ( vehicle, 0) setVehicleLightState ( vehicle, 0, 1 ) setVehicleLightState ( vehicle, 1, 1 ) setVehicleLightState ( vehicle, 2, 1 ) setVehicleLightState ( vehicle, 3, 1 ) end end if (vehicles[vehicle]~=nil) then -- release the markers for key, value in pairs(vehicles[vehicle]["flist"]) do destroyElement (value["m"]) end setElementData(vehicle, "vtrgiroflex", false) vehicles[vehicle] = nil end if (timers[vehicle]~=nil) then -- kill the strobo timer killTimer(timers[vehicle]) timers[vehicle] = nil if (isElement(vehicle)) then if (getElementData( vehicle, "emerlights_source")==getPlayerName(getLocalPlayer())) then triggerEvent ( "onPlayerEmergencyLightStateChange", getRootElement(), 0 ) end end end end function checkForAbility(vehicle) local veh_model = getElementModel ( vehicle ) if (car_lights_table[veh_model]==nil)or(getElementData( vehicle, "emerlights_enabled" )=="false") then return false end return true end function strobo_state_update (vehicle) -- check for valid vehicle if (isElement(vehicle)) then if (vehicles[vehicle]==nil) then -- check for disallowing to use lights -- its enabled by default if (checkForAbility(vehicle)==false) then release_vehicle(vehicle) return end local veh_model = getElementModel ( vehicle ) --if (car_lights_table[veh_model]==nil) then --veh_model = "default" --end setElementData( vehicle, "emerlights_source", src, false) if (src==getPlayerName(getLocalPlayer())) then triggerEvent ( "onPlayerEmergencyLightStateChange", getRootElement(), 1 ) end -- init state variable vehicles[vehicle] = {} vehicles[vehicle]["lstate"] = 0 -- strobo lights state vehicles[vehicle]["fstate"] = 0 -- flash light state vehicles[vehicle]["flist"] = {} -- flash lights list (marker ids) -- create flash lights local mode = car_lights_table[veh_model]["mode"] if (mode==nil) then mode = "lamp" end local coeff = 0 if (mode=="lamp") then coeff = 3.141592654/10.0 else coeff = blink_interval/20.0 end vehicles[vehicle]["fmode"] = mode for light_id, light_desc in pairs(car_lights_table[veh_model]) do if (light_id~="mode") then vehicles[vehicle]["flist"][light_id] = {} vehicles[vehicle]["flist"][light_id]["m"] = createMarker( 0.0001, 0.0001, 0.0001, "corona", light_desc["size"], light_desc["color"][1], light_desc["color"][2], light_desc["color"][3], 100) vehicles[vehicle]["flist"][light_id]["p"] = light_desc["phase"]*coeff attachElements ( vehicles[vehicle]["flist"][light_id]["m"], vehicle, light_desc["pos"][1], light_desc["pos"][2], light_desc["pos"][3] ) end end end -- strobo light if (is_strobo_enabled) then setVehicleOverrideLights ( vehicle, 2) if (vehicles[vehicle]["lstate"]<strobo_interval) then setVehicleLightState ( vehicle, 0, 1 ) setVehicleLightState ( vehicle, 1, 0 ) setVehicleLightState ( vehicle, 2, 0 ) setVehicleLightState ( vehicle, 3, 1 ) else setVehicleLightState ( vehicle, 0, 0 ) setVehicleLightState ( vehicle, 1, 1 ) setVehicleLightState ( vehicle, 2, 1 ) setVehicleLightState ( vehicle, 3, 0 ) end if (vehicles[vehicle]["lstate"]>=strobo_interval*2) then vehicles[vehicle]["lstate"] = 0 else vehicles[vehicle]["lstate"] = vehicles[vehicle]["lstate"] + 1 end end -- flash light if (vehicles[vehicle]["fmode"]=="lamp") then -- lamp mode local tmp_fstate = vehicles[vehicle]["fstate"] for key, value in pairs(vehicles[vehicle]["flist"]) do local R, G, B, A = getMarkerColor( value["m"] ) setMarkerColor(value["m"], R, G, B, (math.sin(tmp_fstate+value["p"])+1.0)*128.0) end vehicles[vehicle]["fstate"] = vehicles[vehicle]["fstate"] + flash_interval else -- led mode local tmp_fstate = vehicles[vehicle]["fstate"] for key, value in pairs(vehicles[vehicle]["flist"]) do local R, G, B, A = getMarkerColor(value["m"]) -- blinking mode local tmp_val = tmp_fstate+value["p"] if (tmp_val>blink_interval) then tmp_val = tmp_val - blink_interval end if ((tmp_val>=0)and(tmp_val<blink_duration))or((tmp_val>=blink_duration+1)and(tmp_val<blink_duration*2+1)) then setMarkerColor(value["m"], R, G, B, 255) else setMarkerColor(value["m"], R, G, B, 0) end end vehicles[vehicle]["fstate"] = vehicles[vehicle]["fstate"] + 1 if (vehicles[vehicle]["fstate"]>blink_interval) then vehicles[vehicle]["fstate"] = vehicles[vehicle]["fstate"] - blink_interval end end else -- if vehicle is no more exists release_vehicle(vehicle) end end function isStroboLightsOn (vehicle_id) if (timers[vehicle_id]) then return 1 else return 0 end end function setStroboLightsOn(vehicle_id, value) if ( vehicle_id ) then if (value==nil) then if (isStroboLightsOn(vehicle_id)==1) then value = 0 else value = 1 end; end; if (value==0) then if (timers[vehicle_id]) then release_vehicle(vehicle_id) end end if (value==1) then if (timers[vehicle_id]) then release_vehicle(vehicle_id) end -- create strobo timer timers[vehicle_id] = setTimer ( strobo_state_update, base_freq, 0, vehicle_id ) end end end -- only local effect function enableStroboLightsMode(source, value) if (value=="0")or(value=="false") then is_strobo_enabled = false --outputConsole("Stroboscopic mode disabled") else if (value=="1")or(value=="true") then is_strobo_enabled = true --outputChatBox("Stroboscopic mode enabled") else --outputChatBox("Usage: strobo 0 or strobo 1 for disable/enable stroboscopic lights mode") end end end addCommandHandler("strobo", enableStroboLightsMode) -- triggered by server function setEmerlightsState(value, state) local player = getPlayerFromName ( value ) local vehicle = getPedOccupiedVehicle(player) if (vehicle) then setStroboLightsOn(vehicle, state) end end addEvent("setEmerlights", true) addEventHandler("setEmerlights", getRootElement(), setEmerlightsState) function requestEmerlights() -- check for driver playerVehicle = getPedOccupiedVehicle (getLocalPlayer()) -- get the player's vehicle if (playerVehicle) then -- if player is not a driver if getPedOccupiedVehicleSeat(localPlayer) == 1 or getPedOccupiedVehicleSeat(localPlayer) == 0 then -- sync setElementData(playerVehicle, "vtrgiroflex", true) triggerServerEvent("requestEmerlightChangeState", getLocalPlayer(), 1-isStroboLightsOn(getPedOccupiedVehicle(getLocalPlayer()))) else -- not able to use lights for this vehicle --outputChatBox("unknown car!") end end end addCommandHandler("Strobo Light On", requestEmerlights)--stroboLightOn) bindKey("1", "down", "Strobo Light On") addEvent("onPlayerEmergencyLightStateChange") Server-Side --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- local viaturas = { [436]=true,[490]=true,[404]=true } function Sirene1(player,thePlayer,seat) local vehicle = getPedOccupiedVehicle(player) if(vehicle and viaturas[getElementModel(vehicle)])then if getPedOccupiedVehicleSeat(player) == 1 or getPedOccupiedVehicleSeat(player) == 0 then triggerClientEvent("startSireneSound",vehicle) setElementData(vehicle, "SireneTocando1", true) end end end function onResStart1() for index, player in ipairs(getElementsByType("player")) do bindKey(player, "2", "down", Sirene1) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onResStart1) function onPlayerJoin1() bindKey(source, "2", "down", Sirene1) end addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoin1) function cleanAll1(player) for index, player in ipairs(getElementsByType("player")) do unbindKey(player, "2", "down", Sirene1) end end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), cleanAll1) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- local viaturas3 = { [436]=true,[490]=true,[404]=true } function Sireneamb2(player,seat) local vehicle = getPedOccupiedVehicle(player) if(vehicle and viaturas3[getElementModel(vehicle)])then if getPedOccupiedVehicleSeat(player) == 1 or getPedOccupiedVehicleSeat(player) == 0 then triggerClientEvent("startSireneSound3",vehicle) setElementData(vehicle, "SireneTocando2", true) end end end function onResStart3() for index, player in ipairs(getElementsByType("player")) do bindKey(player, "3", "both", Sireneamb2) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onResStart3) function onPlayerJoin3() bindKey(source, "3", "both", Sireneamb2) end addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoin3) function cleanAll3(player) for index, player in ipairs(getElementsByType("player")) do unbindKey(player, "3", "both", Sireneamb2) end end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), cleanAll3) addEventHandler("onElementDestroy", getResourceRootElement(getThisResource()), function () local viaturas3 = { [436]=true,[490]=true,[404]=true } local vehicle = getPedOccupiedVehicle(player) if(vehicle and viaturas3[getElementModel(vehicle)])then for index, player in ipairs(getElementsByType("player")) do unbindKey(player, "3", "both", Sireneamb2) unbindKey(player, "2", "down", Sirene1) if (getElementData(vehicle, "SireneTocando1") == true) then setElementData(vehicle, "SireneTocando1", false) triggerClientEvent("startSireneSound",vehicle) end if (getElementData(vehicle, "SireneTocando2") == true) then setElementData(vehicle, "SireneTocando2", false) triggerClientEvent("startSireneSound3",vehicle) end end end end) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- function onPlayerRequestEmerlight(value) triggerClientEvent(getRootElement(), "setEmerlights", getRootElement(), getPlayerName(source), value) end addEvent("requestEmerlightChangeState", true) addEventHandler("requestEmerlightChangeState", getRootElement(), onPlayerRequestEmerlight) --> Furkan Özulus <--
  23. Hello MTA... Sorry for asking rookie questions so frequently. So, I am trying to make NPC's on the map walk around. I know I will have to give them a path to walk (Which I don't know how to do, but I'll get there). Right now I am finding it hard to get my NPC to even move. This is the very basic coding I have so far. Pedestrians.lua function pedLoad() local thePed = createPed ( 106, 2492, -1673, 13.25, 200) setPedAnimation(thePed, "ped", "walk_gang1", -1, true, true, false, true) outputChatBox("This command did something", player, 100, 255, 100) end addEventHandler ( "onResourceStart", getResourceRootElement(), pedLoad ) Now this works properly: local thePed = createPed ( 106, 2492, -1673, 13.25, 200) It creates my NPC and rotates him 200 degrees... But the rest of the coding doesn't do anything. I have tried setControlState: function pedLoad() local thePed = createPed ( 106, 2492, -1673, 13.25, 200) setControlState(thePed, "walk", true) setControlState(thePed, "forwards", true) outputChatBox("This command did something", player, 100, 255, 100) end addEventHandler ( "onResourceStart", getResourceRootElement(), pedLoad ) And nothing happened... I know with setControlState I also have to change his camera to move in different directions but I can't get him to move at all... So, if someone could help me I would appreciate it. Thank You.
  24. Hello MTA... I'm a lurker and I am pretty sure this is my first post on this server : / So, I am making an RP MTA SA Server, and I am only doing this as a hobby. I know you can add Green Housing Icons and Blue Housing Icons to the Map in Map Editor, and I know you can use createObject(id, x, y, z) in the lua coding (I plan on using lua coding for this)... But how do I populate the entire map with Green/Blue Housing Icons? To Buy or Rent Property? I'm sure there are many people that have done this manually, but their must be a resource that has all the housing locations open source? I tried to download open source MTA Servers to get the Map but I don't know how to go about loading the map. So, my question is, is their an Easy way to script all the Houses/Properties in the Game without going from 1 house to the next and collecting coords? This is probably a really dumb question, I just had to ask.
  25. how to remove the flickering of a thunderstorm during a storm/rain? как убрать мерцания грозы во время шторма/дождя? I would like to remove this flickering due to the fact that the road is corny not visible and is constantly blinding хотел бы убрать это мерцание из за того что банально не видно дорогу и слепит постояно
×
×
  • Create New...