Jump to content

Search the Community

Showing results for tags 'script'.

  • 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 everyone, guys please help me, I need a script that will protect custom machines, maps, write in a personal, or here in the topic, thank you all in advance
  2. Can someone help me? what script used in this lock on fire hydra missiles
  3. Hello, I need a marker timer script which starts a timer on screen for that player who hit marker X and stopped when that player hit marker Y. And when that player hits marker X again without hitting marker Y, it restarts/reset timer again. Help me pls.
  4. Hi, I'm in need of help. I'm trying to show the player's life on the screen, however getElementhealth returns me a number like this "96.657466574" Can I convert it to integer? type: Life: 96 Sorry for my english, I'm using the translator. local Vida = getElementHealth ( localPlayer ) or 0 dxDrawText("Vida: "..Vida, x*932, y*62, x*1072, y*87, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
  5. Estou começando a programar, então resolvi criar um script besta mas nem assim funcionou. marker = createMarker(2101.368, -1801.239, 12.5, "cylinder", 1, 0, 255, 0, 200 ) function startJob() carro = createVehicle(448, 2097.831, -1801.282, 13.383) end addEventHandler("onPlayerMarkerHit", marker, startJob) Testei trocar o OnPlayerMarkerHit por onMarkerHit e também não funcionou. Script é do servidor e no meta eu coloquei type="server" Estou assistindo um vídeo aqui e o cara fez EXATAMENTE assim, porém aqui não funciona
  6. local drawDistance = 15 g_StreamedInPlayers = {} function onClientRender() local cx, cy, cz, lx, ly, lz = getCameraMatrix() for k, player in pairs(g_StreamedInPlayers) do if isElement(player) and isElementStreamedIn(player) then do local vx, vy, vz = getPedBonePosition(player, 4) local dist = getDistanceBetweenPoints3D(cx, cy, cz, vx, vy, vz) if dist < drawDistance and isLineOfSightClear(cx, cy, cz, vx, vy, vz, true, false, false) then local x, y = getScreenFromWorldPosition(vx, vy, vz + 0.3) if x and y then local ID = getPlayerID(player) local w = dxGetTextWidth(ID, 0.1, "default-bold") local h = dxGetFontHeight(1, "default-bold") dxDrawText("#ffffff"..ID.."", x - 1 - w / 1, y - 1 - h - 12, w, h, tocolor(0, 0, 0), 1.20, "default-bold", "left", "top", false, false, false, true, false) end end end else table.remove(g_StreamedInPlayers, k) end end end addEventHandler("onClientRender", root, onClientRender) function onClientElementStreamIn() if getElementType(source) == "player" and source ~= getLocalPlayer() then setPlayerNametagShowing(source, false) table.insert(g_StreamedInPlayers, source) end end addEventHandler("onClientElementStreamIn", root, onClientElementStreamIn) function onClientResourceStart(startedResource) visibleTick = getTickCount() counter = 0 local players = getElementsByType("player") for k, v in pairs(players) do if isElementStreamedIn(v) and v ~= getLocalPlayer() then setPlayerNametagShowing(v, false) table.insert(g_StreamedInPlayers, v) end end end addEventHandler("onClientResourceStart", resourceRoot, onClientResourceStart) function getPlayerFromID(ID) return call(getResourceFromName("ID_System"), "getPlayerFromID", tonumber(ID)) end function getPlayerID(player) return getElementData(player,"ID") end Preciso muito de ajuda, irei abrir um servidor de Role-Play e fiz esse script de id, mas gostaria de saber se alguem poderia me ajudar, a duvida seria como deixar o id fixo, tipo quando alguem sair do servidor com exemplo ID 1, quando ela voltar esteja com o mesmo id. Alguem me ajuda?
  7. Essse mod esta bugado os minutos de vida restante, quando um player atira em outra pessoa ela cai e fica os minutos de vida restante na tela enquanto o samu nao chega, e 3 minutos de espera mais quando chega ums 2 minutos porai o personagem morre, o bug esta nos minutos podem me ajudar? --[[ ################################################ # # # SAMU # # # # # # # ################################################ ]] local screenW, screenH = guiGetScreenSize() local resW, resH = 1360,768 local x, y = (screenW/resW), (screenH/resH) local screenWidth, screenHeight = guiGetScreenSize() local myScreenSource = dxCreateScreenSource(screenWidth, screenHeight) local flickerStrength = 0 local dxfont0_fonte = dxCreateFont("font/fonte.ttf", 13) addEventHandler("onClientKey", root, function (button, press) if getElementData(getLocalPlayer(),"playerFallen") then if button == "F1" or button == "F2" or button == "F3" or button == "F4" or button == "F5" or button == "F6" or button == "F7" or button == "b" or button == "F9" or button == "F10" or button == "F11" or button == "F12" then cancelEvent() end end end ) function blockDead() if getElementHealth(localPlayer) <= 20 then if not getElementData(localPlayer, "jobSAMU") then if not getElementData(localPlayer, "playerFallen") then cancelEvent() end end end end addEventHandler("onClientPlayerDamage", localPlayer, blockDead) function text() for _, player in ipairs(getElementsByType('player')) do if isElementOnScreen(player) and getElementData(player, "playerFallen") then local x, y, z = getElementPosition(player) local cx, cy, cz = getCameraMatrix() local vx, vy, vz = getPedBonePosition(player, local dist = getDistanceBetweenPoints3D(cx, cy, cz, vx, vy, vz) local drawDistance = 30.0 if (dist < drawDistance or player == target) then if(isLineOfSightClear(cx, cy, cz, vx, vy, vz, true, false, false)) then local x, y = getScreenFromWorldPosition (vx, vy, vz + 0.6) if(x and y) then local px, py = getScreenFromWorldPosition (vx, vy, vz + 0.3) local w = dxGetTextWidth("PRECISANDO DE CURA!", 1, "default-bold") local h = dxGetFontHeight(1, "default-bold") dxDrawImage(x -6 - w / 2,y - 15 - h - 12, w + 25, h + 115, 'images/hp.png', 0, 0, 0, tocolor(255, 0, 0, math.abs(math.sin(getTickCount()/170))*200)) --dxDrawRectangle(x -6 - w / 2,y - 15 - h - 12, w + 9, h, tocolor(0, 0, 0, 194), false) --dxDrawText("#FFFFFFPRECISANDO DE #FF0000CURA#FFFFFF!", x - 0 - w / 2,y - 15 - h - 12, w, h, tocolor(255,0,0, math.abs(math.sin(getTickCount()/170))*200), 1, "default-bold", "left", "top", false, false, false, true, false) end end end end end end addEventHandler("onClientRender", root, text) function convertTime(ms) local min = math.floor ( ms/60000 ) local sec = math.floor( (ms/1000)%60 ) return min, sec end function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end function contador() local timer = interpolateBetween(deadTime, 0, 0, 0, 0, 0, (getTickCount()-tick)/deadTime, "Linear") local minutes, seconds = convertTime(timer) dxDrawText("Tempo de vida restante: "..minutes..":"..seconds, (screenW * 0.3801) + 1, (screenH * 0.9089) + 1, (screenW * 0.7059) + 1, (screenH * 1.0299) + 1, tocolor(0, 0, 0, 132), 1.00, dxfont0_fonte, "left", "top", false, false, false, false, false) dxDrawText("Tempo de vida restante: #FF0000"..minutes.."#FFFFFF:#FF0000"..seconds, screenW * 0.3801, screenH * 0.9089, screenW * 0.7059, screenH * 1.0299, tocolor(255, 255, 255, 255), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) end function createShader() oldFilmShader, oldFilmTec = dxCreateShader("shaders/old_film.fx") end function updateShader() upDateScreenSource() if (oldFilmShader) then local flickering = math.random(100 - flickerStrength, 100)/100 dxSetShaderValue(oldFilmShader, "ScreenSource", myScreenSource); dxSetShaderValue(oldFilmShader, "Flickering", flickering); dxDrawImage(0, 0, screenWidth, screenHeight, oldFilmShader) end end function upDateScreenSource() dxUpdateScreenSource(myScreenSource) end function render() if not isEventHandlerAdded("onClientRender", root, contador) then tick = getTickCount() createShader() addEventHandler("onClientRender", root, contador) addEventHandler("onClientPreRender", root, updateShader) end end addEvent("startDeadTime", true) addEventHandler("startDeadTime", root, render) function remove() if isEventHandlerAdded("onClientRender", root, contador) then removeEventHandler("onClientRender", root, contador) removeEventHandler("onClientPreRender", root, updateShader) end end addEvent("stopDeadTime", true) addEventHandler("stopDeadTime", root, remove)
  8. --[[ ################################################ # # # SCRIPT PRODUZIDO POR # # Anderson # # # # # ################################################ ]] local screenW, screenH = guiGetScreenSize() local resW, resH = 1360,768 local x, y = (screenW/resW), (screenH/resH) local screenWidth, screenHeight = guiGetScreenSize() local myScreenSource = dxCreateScreenSource(screenWidth, screenHeight) local flickerStrength = 0 local dxfont0_fonte = dxCreateFont("font/fonte.ttf", 13) addEventHandler("onClientKey", root, function (button, press) if getElementData(getLocalPlayer(),"playerFallen") then if button == "F1" or button == "F2" or button == "F3" or button == "F4" or button == "F5" or button == "F6" or button == "F7" or button == "b" or button == "F9" or button == "F10" or button == "F11" or button == "F12" then cancelEvent() end end end ) function blockDead() if getElementHealth(localPlayer) <= 20 then if not getElementData(localPlayer, "jobSAMU") then if not getElementData(localPlayer, "playerFallen") then cancelEvent() end end end end addEventHandler("onClientPlayerDamage", localPlayer, blockDead) function text() for _, player in ipairs(getElementsByType('player')) do if isElementOnScreen(player) and getElementData(player, "playerFallen") then local x, y, z = getElementPosition(player) local cx, cy, cz = getCameraMatrix() local vx, vy, vz = getPedBonePosition(player, local dist = getDistanceBetweenPoints3D(cx, cy, cz, vx, vy, vz) local drawDistance = 30.0 if (dist < drawDistance or player == target) then if(isLineOfSightClear(cx, cy, cz, vx, vy, vz, true, false, false)) then local x, y = getScreenFromWorldPosition (vx, vy, vz + 0.6) if(x and y) then local px, py = getScreenFromWorldPosition (vx, vy, vz + 0.3) local w = dxGetTextWidth("PRECISANDO DE CURA!", 1, "default-bold") local h = dxGetFontHeight(1, "default-bold") dxDrawImage(x -6 - w / 2,y - 15 - h - 12, w + 25, h + 115, 'images/hp.png', 0, 0, 0, tocolor(255, 0, 0, math.abs(math.sin(getTickCount()/170))*200)) --dxDrawRectangle(x -6 - w / 2,y - 15 - h - 12, w + 9, h, tocolor(0, 0, 0, 194), false) --dxDrawText("#FFFFFFPRECISANDO DE #FF0000CURA#FFFFFF!", x - 0 - w / 2,y - 15 - h - 12, w, h, tocolor(255,0,0, math.abs(math.sin(getTickCount()/170))*200), 1, "default-bold", "left", "top", false, false, false, true, false) end end end end end end addEventHandler("onClientRender", root, text) function convertTime(ms) local min = math.floor ( ms/60000 ) local sec = math.floor( (ms/1000)%60 ) return min, sec end function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end function contador() local timer = interpolateBetween(deadTime, 0, 0, 0, 0, 0, (getTickCount()-tick)/deadTime, "Linear") local minutes, seconds = convertTime(timer) dxDrawText("Tempo de vida restante: "..minutes..":"..seconds, (screenW * 0.3801) + 1, (screenH * 0.9089) + 1, (screenW * 0.7059) + 1, (screenH * 1.0299) + 1, tocolor(0, 0, 0, 132), 1.00, dxfont0_fonte, "left", "top", false, false, false, false, false) dxDrawText("Tempo de vida restante: #FF0000"..minutes.."#FFFFFF:#FF0000"..seconds, screenW * 0.3801, screenH * 0.9089, screenW * 0.7059, screenH * 1.0299, tocolor(255, 255, 255, 255), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) end function createShader() oldFilmShader, oldFilmTec = dxCreateShader("shaders/old_film.fx") end function updateShader() upDateScreenSource() if (oldFilmShader) then local flickering = math.random(100 - flickerStrength, 100)/100 dxSetShaderValue(oldFilmShader, "ScreenSource", myScreenSource); dxSetShaderValue(oldFilmShader, "Flickering", flickering); dxDrawImage(0, 0, screenWidth, screenHeight, oldFilmShader) end end function upDateScreenSource() dxUpdateScreenSource(myScreenSource) end function render() if not isEventHandlerAdded("onClientRender", root, contador) then tick = getTickCount() createShader() addEventHandler("onClientRender", root, contador) addEventHandler("onClientPreRender", root, updateShader) end end addEvent("startDeadTime", true) addEventHandler("startDeadTime", root, render) function remove() if isEventHandlerAdded("onClientRender", root, contador) then removeEventHandler("onClientRender", root, contador) removeEventHandler("onClientPreRender", root, updateShader) end end addEvent("stopDeadTime", true) addEventHandler("stopDeadTime", root, remove)
  9. Boa Noite, Preciso de uma ajuda no sistema de expulsar o jogador selecionado do Base (COL) so que to com problema nisso e precisava de uma ajuda segue a baixo o sistema OBS: EU PEGUEI ESSA ULTIMA FUNÇÃO DO SERVER.LUA COMO EXEMPLO DA OUTRA QUE TEM QUANDO KIKA TODOS OS JOGADORES DA BASE (COL), AI QUERO FAZER PARA O JOGADOR SELECIONADO. --- Client.lua ---------------------------------------------------------------- --- PAINEL BasePaneltab1 = guiCreateTab("Jogadores", BasePaneltabpanel) BasePanelGridliste2 = guiCreateGridList(40, 15, 490, 200, false, BasePaneltab1) BasePanelColumn2 = guiGridListAddColumn(BasePanelGridliste2, "Jogador:", 0.9) KikarPlayerBase = guiCreateButton(40, 230, 250, 50,"Kikar Jogador\nSelecionado",false,BasePaneltab1) ClearBase = guiCreateButton(310, 230, 220, 50,"Expulsar todos da Base",false,BasePaneltab1) ---------------------------------------------------- -- Quando clica na Grilist addEventHandler("onClientGUIClick",BasePanelGridliste2,function(thePlayers) playerName = guiGridListGetItemText ( BasePanelGridliste2, guiGridListGetSelectedItem ( BasePanelGridliste2 ), BasePanelColumn2 ) outputChatBox(playerName) if playerName ~= "" then triggerServerEvent("KikaJorgadorBase",getLocalPlayer(),playerName) end elseif source == BaseManangerButton then triggerServerEvent("KikaJorgadorBase",getLocalPlayer()) triggerServerEvent("refreshGatess",getLocalPlayer()) guiSetEnabled(ClearBase,false) guiSetVisible(BaseManagementGUI2,false) triggerServerEvent("refreshPlayerss",getLocalPlayer()) setTimer(function() guiSetEnabled(ClearBase,true) end,10000,1) end) ------------------------------------------------------ --- RECEBE DO SERVER.LUA OS JOGADORES addEvent("refreshPlayers11",true) addEventHandler("refreshPlayers11",getRootElement(),function(thePlayers) row1s,column1s = guiGridListGetSelectedItem(BasePanelGridliste2) guiGridListClear(BasePanelGridliste2) for i, thePlar in ipairs(thePlayers) do local Players = guiGridListAddRow(BasePanelGridliste2) guiGridListSetItemText(BasePanelGridliste2,Players,BasePanelColumn2,tostring(thePlar[1]),false,false) outputChatBox("Jogador "..tostring(thePlar[1]),255,0,0,true) end if row1s and column1s then guiGridListSetSelectedItem(BasePanelGridliste2,row1s,column1s) end end) -- Server.lua -------------------------------------------------------------------- --- RECONHECE OS JOGADORES QUE ESTA NA BASE! addEvent("refreshPlayerss",true) addEventHandler("refreshPlayerss",getRootElement(), function() local thePlayers = {} local ownerAccount = getAccountName(getPlayerAccount(source)) local baseName = getBaseNameFromOwnerAccount(ownerAccount) local colshape = getBaseColshape(baseName) if colshape and isElement(colshape) then local players = getElementsWithinColShape(colshape,"player") for i, player in pairs(players) do local nameCheck = getPlayerName(player) local PlayerP = removeHexCheck(nameCheck, 6) table.insert(thePlayers,{PlayerP}) end end triggerClientEvent(source,"refreshPlayers11",source,thePlayers) end) --------------------------------------------------------------------- --- PARA KIKAR O JOGADOR DA COL VINDO DA GRILIST --OBS: EU PEGUEI ESSA FUNÇÃO COMO EXEMPLO DA OUTRA QUE TEM QUANDO KIKA TODOS OS JOGADORES DA BASE (COL), AI QUERO FAZER PARA O JOGADOR SELECIONADO addEvent("KikaJorgadorBase",true) addEventHandler("KikaJorgadorBase",getRootElement(),function(playerName,player) outputChatBox("TRUE"..playerName,player) local ownerAccount = getAccountName(getPlayerAccount(source)) local baseName = getBaseNameFromOwnerAccount(ownerAccount) local colshape = getBaseColshape(baseName) tpx,tpy,tpz = getElementData(colshape,"tpLoc1"),getElementData(colshape,"tpLoc2"),getElementData(colshape,"tpLoc3") if isElement(colshape) then for i,element in pairs(getElementsWithinColShape(colshape))do if getElementType(element) == "vehicle" then for i,player in pairs(getVehicleOccupants(element))do if playerName ~= player then removePedFromVehicle(player) setVehicleEngineState(element,false) setElementPosition(player,tpx,tpy,tpz) end end elseif getElementType(element) == "player" then if playerName ~= player then setElementPosition(element,tpx,tpy,tpz) end end end alert("Base limpa!",source) else alert("Colshape not added. Please tell the Admin!",source) end end) OBS: EU PEGUEI ESSA ULTIMA FUNÇÃO DO SERVER.LUA COMO EXEMPLO DA OUTRA QUE TEM QUANDO KIKA TODOS OS JOGADORES DA BASE (COL), AI QUERO FAZER PARA O JOGADOR SELECIONADO
  10. Então, eu edito alguns mapas, só que, dessa vez eu apaguei uma construção do próprio gta, e fiz uma base.. Só que, quando me distancio ela some e quando chego bem perto ela aparece. Tem alguma forma de corrigir isso? ou nem. Print a seguir: https://imgur.com/a/7wkGF3z
  11. Bom Dia, Pessoal to com problema num script precisava de uma ajuda, o sistema é quando o jogador pega a arma na mão ela reconhece a função que ela vai fazer e se nao tiver na mão ela nao executa a função. function changeFiringMode () local weapon = getPedWeapon( getLocalPlayer()) --outputChatBox("PLAYER: "..weapon) if weapon == 31 then nameweapon = "AKS-74 Kobra" or "M4A1 CCO" setElementData ( getLocalPlayer(), "userArma", nameweapon ) end if (getElementData(getLocalPlayer(),"userArma") == nameweapon) then if getElementData ( getLocalPlayer(), "usingGrenadeThrower" ) then setElementData ( getLocalPlayer(), "usingGrenadeThrower", false ) unbindKey ( "mouse1", "down", throwGrenade ) toggleControl ( "fire", true ) playSound ("sounds/itm_grenade_up.wav") else local weapon2 = getElementData ( getLocalPlayer(), "selectedWeapon") or "no" if weapon2 and grenadesConfig[weapon2] and ( getElementData ( getLocalPlayer(), grenadesConfig[weapon2].grenadeName ) or 0 ) > 0 then setElementData ( getLocalPlayer(), "usingGrenadeThrower", weapon2 ) bindKey ( "mouse1", "down", throwGrenade ) toggleControl ( "fire", false ) playSound ("sounds/itm_grenade_up.wav") else triggerEvent ("displayClientInfo", getLocalPlayer(),"Inventory","*Você precisa de granada!",255,22,0) end end end end Tentei usar essas função aqui mas não foi como pensei. local weapon = getPedWeapon( getLocalPlayer()) --outputChatBox("PLAYER: "..weapon) if weapon == 31 then nameweapon = "AKS-74 Kobra" or "M4A1 CCO" setElementData ( getLocalPlayer(), "userArma", nameweapon ) end if (getElementData(getLocalPlayer(),"userArma") == nameweapon) then
  12. Привет, мне нужна помощь. Я хочу сделать паспортную систему, мне нужен номер паспорта, который будет случайным
  13. Galera Montei esse script com ajuda de alguns parceiros. Ele cria um Carro privado pela ACL porém gostaria que quando o jogador se deligar do server o veiculo se destruísse. alguém pode me ajudar??? O script esta funcionando perfeitamente, só preciso deste detalhe de destruir quando o jogador se desligar. veh = {} vehCol = {} function veiculodayz (thePlayer) local accountname = getAccountName (getPlayerAccount (thePlayer)) -- accountname recebe o nome da conta do jogador que usou o comando. if isObjectInACLGroup ("user."..accountname, aclGetGroup ("Admin")) then -- Se o nome da conta estiver na ACL Group Admin, então: local x, y, z = getElementPosition (thePlayer) -- x, y, z recebem a posição do jogador que usou o comando. if isElement (veh[thePlayer]) then -- Se já existe o veh[thePlayer] criado, então: spawnVehicle (veh[thePlayer], x+3, y, z) -- Spawna ele perto do jogador, sem criar outro. setElementData (vehCol[thePlayer], "parent", veh[thePlayer]) -- Reseta as datas do colider. setElementData (veh[thePlayer], "parent", vehCol[thePlayer]) setElementData (vehCol[thePlayer], "vehicle", true) setElementData (vehCol[thePlayer], "Tire_inVehicle", 4) setElementData (vehCol[thePlayer], "Engine_inVehicle", 1) setElementData (vehCol[thePlayer], "Parts_inVehicle", 1) setElementData (vehCol[thePlayer], "fuel", 100) else -- Se não existe um veh[thePlayer] criado, então: veh[thePlayer] = createVehicle (411, x+3, y, z) -- Cria o veh[thePlayer]. setVehicleColor (veh[thePlayer], 255, 255, 255) -- escolhe a cor do veiculo if isElement (vehCol[thePlayer]) then -- Se já existe o colider (veículo foi deletado e o colider ficou lá), então: attachElements (vehCol[thePlayer], veh[thePlayer], 0, 0, 0) -- Anexa o colider novamente ao veh[thePlayer]. else -- Se não existe colider nenhum, então: vehCol[thePlayer] = createColSphere (x, y, z, 2.5) -- Cria o colider. attachElements (vehCol[thePlayer], veh[thePlayer], 0, 0, 0) -- Anexa ele ao veh[thePlayer]. setElementData (vehCol[thePlayer], "parent", veh[thePlayer]) -- Seta as datas no veh[thePlayer] e no colider. setElementData (veh[thePlayer], "parent", vehCol[thePlayer]) setElementData (vehCol[thePlayer], "vehicle", true) setElementData (vehCol[thePlayer], "Tire_inVehicle", 4) setElementData (vehCol[thePlayer], "Engine_inVehicle", 1) setElementData (vehCol[thePlayer], "Parts_inVehicle", 1) setElementData (vehCol[thePlayer], "fuel", 100) end end end end addCommandHandler ("carro", veiculodayz)
  14. Boa noite meus querido, alguns dias atrás, me cadastrei no fórum a procura de conhecimento.. estava com muita dificuldade para modificar um script simples e vim procurar ajuda no forum. Assim, várias pessoas me ajudaram, até o moderador do fórum português . Muito obrigado pela ajuda para solucionar este script.. vou mostrar o script antes e depois da modificação que me ajudaram a solucionar. Primeiro código antes da modificação! function DAR_XP_AIRNEWSCR ( source, cmd, pname, Quantidade ) if pname and tonumber(Quantidade) then local cliente = getPlayerFromPartialName(pname) if isElement(cliente) then if getElementData ( source, "Console_AirNewSCR" ) == "Sim" then setElementData ( cliente, "Level", Quantidade ) exports.Scripts_Dxmessages:outputDx(source, "Você Setou o Level do(a) Jogador(a) "..getPlayerName(cliente).."#ffffff para "..Quantidade.." com Sucesso!", "success") exports.Scripts_Dxmessages:outputDx(cliente, "O(A) Admin "..getPlayerName(source).."#ffffff Setou seu Level para "..Quantidade.." com Sucesso!", "success") end else exports.Scripts_Dxmessages:outputDx(source, "O Jogador Não Foi Encontrado", "error") end end end addCommandHandler ( "level", DAR_XP_AIRNEWSCR ) Código modificado ficou assim usando o comando /level "nomeDoPlayer" "level" function DAR_XP_AIRNEWSCR ( source, cmd, pname, Quantidade ) if pname and tonumber(Quantidade) and (isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("Console"))) then local cliente = getPlayerFromPartialName(pname) if isElement(cliente) then setElementData ( cliente, "Level", tonumber(Quantidade) ) exports.Scripts_Dxmessages:outputDx(source, "Você Setou o Level do(a) Jogador(a) "..getPlayerName(cliente).."#ffffff para "..Quantidade.." com Sucesso!", "success") exports.Scripts_Dxmessages:outputDx(cliente, "O(A) Admin "..getPlayerName(source).."#ffffff Setou seu Level para "..Quantidade.." com Sucesso!", "success") else exports.Scripts_Dxmessages:outputDx(source, "O Jogador Não Foi Encontrado", "error") end end end addCommandHandler ( "level", DAR_XP_AIRNEWSCR ) Agora estou com com um novo Script usando o mesmo data "Console_AirNewSCR" e quero saber se tem como eu modificar ele para dar vip usando o comando /ativar "nomeDoPlayer" "tipodovip""dinheiro" e quantos dias irá durar o vip. estou contando com a ajuda desse fórum que tem ótimos scripts que tem um conhecimento um mais avançado que eu . Meu muito obrigado dês de já! ? Comando_VIP = "ativar" Grupo = "Console" -- Grupo no Painel P ( Manage ACL ) function getPlayerFromPartialName ( name ) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function Dar_VIP_AirNewSCR ( source, cmd, player, VIP, Dinheiro ) if getElementData ( source, "Console_AirNewSCR" ) == "Sim" then if player and VIP then local Jogador = getPlayerFromPartialName ( player ) if Jogador then if not isGuestAccount ( getPlayerAccount ( Jogador ) ) then local Conta = getAccountName ( getPlayerAccount ( Jogador ) ) if VIP == "Alpha" then if isObjectInACLGroup ("user."..Conta, aclGetGroup ( "Alpha" ) ) then return outputChatBox ( "* Erro: Esse Jogador já é VIP Alpha", source, 255, 255, 255, true ) end elseif VIP == "Epsylon" then if isObjectInACLGroup ("user."..Conta, aclGetGroup ( "Epsylon" ) ) then return outputChatBox ( "* Erro: Esse Jogador já é VIP Epsylon", source, 255, 255, 255, true ) end elseif VIP == "Sigma" then if isObjectInACLGroup ("user."..Conta, aclGetGroup ( "Sigma" ) ) then return outputChatBox ( "* Erro: Esse Jogador já é VIP Sigma", source, 255, 255, 255, true ) end elseif VIP == "Omega" then if isObjectInACLGroup ("user."..Conta, aclGetGroup ( "Omega" ) ) then return outputChatBox ( "* Erro: Esse Jogador já é VIP Omega", source, 255, 255, 255, true ) end end if VIP == "Alpha" or VIP == "Epsylon" or VIP == "Sigma" or VIP == "Omega" then --return outputChatBox ( "* Erro: Esse VIP não existe!", source, 255, 255, 255, true ) --end aclGroupAddObject ( aclGetGroup( VIP ), "user."..Conta ) Musica_Selecionada = math.random ( 1, 3 ) triggerClientEvent ( root, "AirNewSCR_Ativar_VIP", root, Musica_Selecionada, VIP ) if Musica_Selecionada == 1 then --outputChatBox ( "Arquivos/Rae_Sremmurd_Black_Beatles_ft_Gucci_Mane.mp3", source ) Musica_Tocando = "Rae Sremmurd - Black Beatles ft. Gucci Mane" Bonus = 0 elseif Musica_Selecionada == 2 then --outputChatBox ( "Arquivos/Post_Malone_Congratulations_ft_Quavo.mp3", source ) Musica_Tocando = "Post Malone - Congratulations ft. Quavo" Bonus = 50 elseif Musica_Selecionada == 3 then --outputChatBox ( "XXXTENTACION_Look_At_Me.mp3", source ) Musica_Tocando = "XXXTENTACION - Look At Me!" Bonus = 100 end setElementData ( root, "Ultimo_Ativador", getPlayerName(Jogador) ) setElementData ( root, "VIP_do_Ultimo_Ativador", VIP ) outputChatBox ( " ", root ) outputChatBox ( " ", root ) outputChatBox ( "=======================================================", root, 255, 255, 255, true ) outputChatBox ( "* O(A) Jogador(a) "..getPlayerName(Jogador).." #ffffffAtivou um Plano VIP "..VIP, root, 255, 255, 255, true ) if Bonus == 0 then outputChatBox ( "* Seu Bonus de Ativação foi de "..Bonus.."%, Não foi dessa vez!", root, 255, 255, 255, true ) outputChatBox ( "* O(A) Jogador(a) Recebeu 1kk pela Ativação do VIP", root, 255, 255, 255, true ) if Dinheiro ~= false then givePlayerMoney ( Jogador, 1000000 ) givePlayerMoney ( Jogador, 0 ) end elseif Bonus == 50 then outputChatBox ( "* Seu Bonus de Ativação foi de "..Bonus.."%, +50% de 1kk (1kk500k)", root, 255, 255, 255, true ) outputChatBox ( "* O(A) Jogador(a) Recebeu 1kk pela Ativação do VIP (+500k Bonus)", root, 255, 255, 255, true ) if Dinheiro ~= false then givePlayerMoney ( Jogador, 1000000 ) givePlayerMoney ( Jogador, 500000 ) end elseif Bonus == 100 then outputChatBox ( "* Seu Bonus de Ativação foi de "..Bonus.."%, +100% de 1kk (2kk)", root, 255, 255, 255, true ) outputChatBox ( "* O(A) Jogador(a) Recebeu 1kk pela Ativação do VIP (+1kk Bonus)", root, 255, 255, 255, true ) if Dinheiro ~= false then givePlayerMoney ( Jogador, 1000000 ) givePlayerMoney ( Jogador, 1000000 ) end end outputChatBox ( "* Musica Tocando: "..Musica_Tocando, root, 255, 255, 255, true ) outputChatBox ( "=======================================================", root, 255, 255, 255, true ) outputChatBox ( " ", root ) outputChatBox ( " ", root ) outputDebugString ( "[ Ativação ] - O(A) Admin "..getPlayerName(source).." Ativou um VIP para o(a) Jogador(a) "..getPlayerName(Jogador).."!" ) outputDebugString ( "[ Ativação ] - Bonus do VIP Gerado: "..Bonus.."%" ) setTimer ( function() restartResource ( getThisResource ( ) ) -- Reinicia o Mod Automaticamente! outputDebugString ( "[ AirNewSCR ] - Resource 'Scripts_AtivarVIP' Reiniciado Automaticamente! " ) end, 15000, 1 ) end end else outputChatBox ( "* Erro: Jogador não encontrado!", source, 255, 255, 255, true ) end end end end addCommandHandler ( Comando_VIP, Dar_VIP_AirNewSCR ) function Verificar_Emprego_Atual ( ) for i, player in ipairs(getElementsByType("player")) do local acc = getPlayerAccount(player) if acc and not isGuestAccount(acc) then local accName = getAccountName (acc) if isObjectInACLGroup ("user."..accName, aclGetGroup ( Grupo ) ) then setElementData ( player, "Console_AirNewSCR", "Sim" ) else setElementData ( player, "Console_AirNewSCR", "Não" ) end end end end setTimer ( Verificar_Emprego_Atual, 1500, 0 ) -- By AirNewSCR
  15. Olá meus amigos, estou precisando editar meu Gamemode para quando um player morrer ele perca todas as armas. Alguém pode me ajudar?
  16. Alguém poderia me ajudar em fazer um script de fumaça colorida?
  17. Boa Noite, não queria vim pedir ajuda no forum mas fui forçado a pedir ajuda eu to com problema de aviso numa linha do script que tava criando no Client.lua.. a função é quando da dano no ped (zombie) na linha eu coloco o Blood do zombie > 0 só que quando da numo menor que 0 ele da aviso. AVISO === attempt to compare with number boolean if getElementData(source,"bloodZumbie") > 0 then -- aviso aqui if weapon == 0 then damage = 2500 else damage = getWeaponDamage(weapon,attacker) end if bodypart == 9 then damage = damage * 9.5 headshot = true end setElementData(source, "bloodZumbie", getElementData(source, "bloodZumbie") - math.random(damage * 0.75, damage * 1.25)) outputChatBox("DANO ZUMBIE: "..damage.." / "..getElementData(source,"bloodZumbie")) if getElementData(source,"bloodZumbie") <= 0 and not getElementData(source,"isDeadZumbie") then triggerServerEvent("onZombieGetsKilled", source, attacker, headshot, getWeaponNameFromID(weapon)) setElementData ( source, "isDeadZumbie", true ) outputChatBox("MATOU") end end
  18. Sou um scripter iniciante, ja abri vários scripts de concessionaria e não entendi como funciona muito bem, teria como alguém me ensinar ou me explicar como faz para fazer aquelas tabelas para o player comprar o carro, deixar o carro girando, salvar o carro quando o player sair do servidor ou se o servidor para, por favor ficaria muito grato a quem me ajudasse. OBS: Fiz a parte do painel quando o player passa por cima de um marker, fiz um ped já tbm
  19. Pessoal, estou querendo criar um script com a animação de cruzar os braços, que seria time, tentei fazer ai abaixo mas não pega, acho que fiz algo errado, me ajudem. (Esse e meu primeiro script)
  20. Buenas, Queria saber quien me podria ayudar u orientar para poner una imagen debajo de un vehiculo. tipo sombra pero con una imagen, e visto que algunos manejan el dxDrawMaterialLine3D o con un shader, De ante mano gracias.
  21. CLIENT: function cancelTazerDamage(attacker, weapon, bodypart, loss) if (weapon==24) then -- deagle local mode = getElementData(attacker, "handTaser") if (mode==true) then cancelEvent() end end end addEventHandler("onClientPlayerDamage", localPlayer, cancelTazerDamage) local cFunc = {} local cSetting = {} cSetting["shots"] = {} cSetting["shot_calcs"] = {} local last_shot = 1 cFunc["draw_shot"] = function(x1, y1, z1, x2, y2, z2) table.insert(cSetting["shots"], last_shot, {x1, y1, z1, x2, y2, z2}) local lastx, lasty, lastz = x1, y1, z1 local dis = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) cSetting["shot_calcs"][last_shot] = {} last_shot = last_shot+1 end cFunc["wait_shot"] = function() toggleControl("fire", false) setTimer(function() toggleControl("fire", true) end, 15000, 1) end cFunc["shot_check"] = function(wp, _, _, hitX, hitY, hitZ, element, startX, startY, startZ) if(wp == 24) and (getElementData(localPlayer,"handTaser"))then cFunc["shot_weapon"](hitX, hitY, hitZ, startX, startY, startZ) cancelEvent() if(source == localPlayer) then cFunc["wait_shot"]() end end end cFunc["anim_check"] = function(attacker, wep, bodypart,loss) if(wep == 24) and (getElementData(localPlayer,"handTaser"))then local playerX,playerY,playerZ = getElementPosition(localPlayer) local targetX,targetY,targetZ = getElementPosition(source) if getDistanceBetweenPoints3D(playerX,playerY,playerZ,targetX,targetY,targetZ) <= 12 then triggerServerEvent("tazerFired", getRootElement(), source) end end end addEventHandler("onClientPlayerWeaponFire", getRootElement(), cFunc["shot_check"]) addEventHandler("onClientPedDamage", getRootElement(),cFunc["anim_check"]) addEventHandler("onClientPlayerDamage", getRootElement(),cFunc["anim_check"]) addEventHandler("onClientResourceStart",resourceRoot,function() setElementData(localPlayer, "tazed",0) end) addEventHandler("onClientRender",getRootElement(),function() if getElementData(localPlayer, "tazed") == 1 then toggleAllControls(false, false, false) toggleControl("fire", false) toggleControl("sprint", false) toggleControl("crouch", false) toggleControl("jump", false) toggleControl('next_weapon',false) toggleControl('previous_weapon',false) toggleControl('aim_weapon',false) end end) SERVER: local cFunc = {} local cSetting = {} function tazerFired(target) if (isElement(target) and getElementType(target)=="player") then fadeCamera ( target, false, 1.0, 255, 255, 255 ) setElementData(target, "tazed", 1) toggleAllControls(target, false, false, false) setPedAnimation(target, "ped", "FLOOR_hit_f", -1, false, false, true) setTimer(removeAnimation, 30000, 1, target) end end addEvent("tazerFired", true ) addEventHandler("tazerFired", getRootElement(), tazerFired) function removeAnimation(thePlayer) if (isElement(thePlayer) and getElementType(thePlayer)=="player") then fadeCamera(thePlayer, true, 0.5) if getElementData(thePlayer,"isAnim") then setElementFrozen(thePlayer,true) setPedAnimation(thePlayer,"sweet","sweet_injuredloop",-1,false,false,false) else setPedAnimation(thePlayer,nil,nil) toggleAllControls(thePlayer, true, true, true) end setElementData(thePlayer, "tazed", 0) end end I do not get any errors/warnings in debugscript 3, just simply does not working the script.. What wrong in this codes? :s
  22. Hello there! I just started to develop some fun scripts to the MTA SA (1.5.6) Im not a professional LUA programmer but as good i see on forums (stack overflow etc.) there is a way to import or use functions from other lua files with "require" My problem is that the "require" isnt working for me and i cant import functions from other lua file.I will not paste code because i tried every possible combinations of using the "require" Is there some way to use functions from other file? can i use "require" or there is a alternative for it? Thank you for your answrs ?
  23. ERROR: account-system/s_account_system_sapphire.lua:677: attempt to c [ oncatenate local 'safepassword' (a nil value) ERROR: Client (discord?) triggered serverside event itemResourceStart [ ed, but event is not added serverside DIAGNOSTIC: discord? #1003 CLIENT SCRIPT ERROR: saveplayer-system\c_s [ aveplayer_system.lua is invalid. Please re-compile at https://luac.multitheftauto.com/ I have this roleplay server and I'm not going to register, but the localhost works (mention the server is hosted)
  24. perdão galera consegui resolver o motivo desse tópico, quando entro no servidor aparece um painelzinho em baixo do chat, com o icone do rc, do wifi e uns outros. eu sei que é algum mod originario do mta mas qual é ?
  25. Eu queria separar as funções de um script de bar ( Separar uma função pra cada bebida, Catuaba, Vodca e Cerveja ) pois é muito desorganizado e tambem porque coloquei um painel novo nesse script... ja tentei varias e varias vezes e todas deram errado; c.lua ( A Parte das funções que quero separar Antes ) Esse aqui funciona normalmente, mas o proximo que eu separei não funciona.. function clickEffectDrink(button,state) if button == "left" and state == "up" then if isMouseInPosition(drawDrinksBVS.bgCatuabaX, drawDrinksBVS.bgCatuabaY, drawDrinksBVS.bgCatuabaW, drawDrinksBVS.bgCatuabaH) then if (not isTimer(timerExpireDrinks)) then triggerServerEvent("server:onPlayerBuyDrinkBVS", resourceRoot, 200) else playSoundFrontEnd(6) outputChatBox("Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) end elseif isMouseInPosition(drawDrinksBVS.bgVodkaX, drawDrinksBVS.bgVodkaY, drawDrinksBVS.bgVodkaW, drawDrinksBVS.bgVodkaH) then if (not isTimer(timerExpireDrinks)) then triggerServerEvent("server:onPlayerBuyDrinkBVS", resourceRoot, 150) else playSoundFrontEnd(6) outputChatBox("Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) end elseif isMouseInPosition(drawDrinksBVS.bgCervejaX, drawDrinksBVS.bgCervejaY, drawDrinksBVS.bgCervejaW, drawDrinksBVS.bgCervejaH) then if (not isTimer(timerExpireDrinks)) then triggerServerEvent("server:onPlayerBuyDrinkBVS", resourceRoot, 100) else playSoundFrontEnd(6) outputChatBox("Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) end elseif isMouseInPosition(drawDrinksBVS.bgCloseX, drawDrinksBVS.bgCloseY, drawDrinksBVS.bgCloseW, drawDrinksBVS.bgCloseH) then if isEventHandlerAdded("onClientRender", root, drawDrinks) and isEventHandlerAdded("onClientClick", root, clickEffectDrink) then removeEventHandler("onClientRender", root, drawDrinks) removeEventHandler("onClientClick", root, clickEffectDrink) showCursor(false) end end end end c.lua ( Aqui eu refiz separando as funções das bebidas Catuaba, Vodca e Cerveja, adicionei algumas coisas a mais porque como eu disse, mudei o painel. ) function Catuaba(_,state) if isEventHandlerAdded("onClientRender", root, drawDrinks) then if state == "down" then if isCursorOnElement(screenW * 0.3522, screenH * 0.4714, screenW * 0.4632, screenH * 0.5143) then if (not isTimer(timerExpireDrinks)) then setBlur(false) triggerServerEvent("server:onPlayerBuyDrinkBVS", localPlayer, 200) removeEventHandler("onClientRender", root, drawDrinks) showChat(true) showCursor(false) playSound("sfx/hit.mp3", false) else playSound("sfx/hit.mp3", false) outputChatBox("#1066E7Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) end end end end end addEventHandler("onClientClick", root, Catuaba) function Vodca(_,state) if isEventHandlerAdded("onClientRender", root, drawDrinks) then if state == "down" then if isCursorOnElement(screenW * 0.3522, screenH * 0.4714, screenW * 0.4632, screenH * 0.5143) then if (not isTimer(timerExpireDrinks)) then setBlur(false) triggerServerEvent("server:onPlayerBuyDrinkBVS", localPlayer, 150) removeEventHandler("onClientRender", root, drawDrinks) showChat(true) showCursor(false) playSound("sfx/hit.mp3", false) else playSound("sfx/hit.mp3", false) outputChatBox("#1066E7Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) end end end end end addEventHandler("onClientClick", root, Vodca) function Cerveja(_,state) if isEventHandlerAdded("onClientRender", root, drawDrinks) then if state == "down" then if isCursorOnElement(screenW * 0.3522, screenH * 0.4714, screenW * 0.4632, screenH * 0.5143) then if (not isTimer(timerExpireDrinks)) then setBlur(false) triggerServerEvent("server:onPlayerBuyDrinkBVS", localPlayer, 100) removeEventHandler("onClientRender", root, drawDrinks) showChat(true) showCursor(false) playSound("sfx/hit.mp3", false) else playSound("sfx/hit.mp3", false) outputChatBox("#1066E7Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) end end end end end addEventHandler("onClientClick", root, Cerveja) Oque há de errado no script ? se puderem me informar o erro como sempre agradeço irmãos!
×
×
  • Create New...