Search the Community

Showing results for tags 'lua'.



More search options

  • 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
    • Open Source Contributors
    • Suggestions
  • General MTA
    • News
    • Media
    • Site/Forum/IRC/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • community.mtasa.com
    • Scripting
    • Maps
    • Resources
    • Other Creations
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash
  • Private Bugtracker

Found 217 results

  1. I want create a script, which play a sound, when a player shot another player head. But the sound play for killed player and localplayer too. How to make this?
  2. dbExec question mark value

    So this is the function: https://wiki.multitheftauto.com/wiki/DbExec bool dbExec ( element databaseConnection, string query [, var param1 [, var param2 ...]] ) And I have an SQL Query like: dbExec(connection, "INSERT INTO table_name VALUES('1','Bob','What\'s the time?')") The function think that the ?(question mark) should be replaced with the param1 value and not handle it as a string and this couse an error. How should I escape this?
  3. I want create a bank-system. But i don't know, how to begin the script. Can i make it possible this with setElementData, and getElementDatas? sorry for my bad english
  4. I want create a animation for my dx image. The image hide, and appear again continuously. How to make this?
  5. MTA C++ Addon

    Addons for MTA supported only serverside? Or is it possible for the client? Or shared? Lua very slowly for my functions. I want use C++ on clientside.
  6. I want create a script, which tp a player to me, and teleport me to a player, like in admin panel, just with command. How to make this? For example: /tpto playername , and /tpme playername. And when i teleport a player to me, the player get out from vehicle
  7. [HELP] How to create 3d text?

    I want create a script, which creates a 3d text with a cmd. For example, when i type "/word asd" then this make a 3d text the player position "#playername : asd", then after elapse 3 hours, the text will hide. How to make this?
  8. [PHP][SCRIPT] getPlayerPing

    Hey! Would someone tell me how to do getPlayerPing for the php sdk library? I only managed to make a list of players on the server function listPlayer( ) local players = {} for k, player in ipairs( getElementsByType ("player") ) do local player = getPlayerName( player ) table.insert( players, player ) end return players end
  9. function outputChatBoxRemote ( playerName, message, type, serverport ) outputChatBox ( "From " .. playerName .. " on " .. serverport .. ": " .. message ) return "hello sailor" end function finishedCallback( responseData, errno ) responseData = tostring(responseData) if responseData == "ERROR" then outputDebugString( "callRemote: ERROR #" .. errno ) elseif responseData ~= "hello sailor" then outputDebugString( "callRemote: Unexpected reply: " .. responseData ) else end end function playerChat ( message, type ) callRemote ( "87.229.77.40:22030", getResourceName(getThisResource()), "outputChatBoxRemote", finishedCallback, getPlayerName(source), message, type, getServerPort() ) end addEventHandler ( "onPlayerChat", getRootElement(), playerChat ) This is the code, but does not working.. what wrong?
  10. I want make a script, which plays sound from youtube.. But.. there is no one converter which would work.. How to use a converter as sound player? Anyone can help?? Sorry for my bad english..
  11. function getPlayerFromID(id) return call(getResourceFromName("game_id2"), "getPlayerFromID", tonumber(id)) end function getPlayerID(player) return getElementData(player,"id") end function criarGang ( source, commandName, ... ) local getaMoney = getPlayerMoney (source) local teamName = table.concat({...}, " ") if teamName then if getaMoney <300000 then outputChatBox("#7d26cd[SERVER] #FF0000Você não tem dinheiro suficiente para criar uma gang valor 5000$",source,255,255,255,true) else if ( getPlayerTeam(source) ~= false ) and ( countPlayersInTeam(getPlayerTeam(source)) == 1 ) then destroyElement(getPlayerTeam(source)) outputChatBox("#F4A460[SERVER]#F08080 Sua gang antiga foi deletada e foi criada uma nova!",source,255,255,255,true) end local newTeam = createTeam ( teamName) if newTeam then takePlayerMoney (source,300 ) local getGang = getTeamName ( newTeam ) setTeamColor (newTeam,math.random(0,255), math.random(0,255), math.random(0,255)) setPlayerTeam ( source, newTeam ) local playerTeam = getPlayerTeam( source ) outputChatBox("#43CD80[GANG] #FFFFFFGang criada com sucesso!",source, 255, 255, 255, true) end end else outputChatBox("#43CD80[GANG] #FFFFFFUso correto: /gangcriar [nome]",source,255,255,255,true) end end addCommandHandler("gangcriar",criarGang) addEventHandler("onPlayerLogin",root,function() local team = getAccountData (getPlayerAccount(source), "team") if (team==getTeamName(getTeamFromName(team))) then setPlayerTeam(source, getTeamFromName(team)) end end) function save() local team = getPlayerTeam(source) local account = getPlayerAccount(source) if not isGuestAccount(account) then if(team)then setAccountData(account, "team", getTeamName(team)) end end end addEventHandler("onPlayerLogout", root, save) addEventHandler("onPlayerQuit", root, save) function sairDaGang(source) local playerTeam = getPlayerTeam (source) if (playerTeam) then setPlayerTeam (source, nil) outputChatBox("#43CD80[GANG] #FFFFFFVocê saiu da gang",source,255,255,255,true) else outputChatBox("#43CD80[GANG] #ffffffVocê não tem gang",source,255,255,255,true) end end addCommandHandler("gangsair", sairDaGang) function desfazerGang (source) local playerVeri = getPlayerTeam (source) if (playerVeri) then destroyElement (playerVeri) outputChatBox("#43CD80[GANG] #FFFFFFVocê deletou sua gang",source,255,255,255,true) else outputChatBox("#43CD80[GANG] #FFFFFFVocê não tem gang",source,255,255,255,true) end end addCommandHandler("gangdeletar", desfazerGang) function enviarGang(source,cmd,targetPlayer) local target = getPlayerFromID (targetPlayer) local geta = getPlayerFromID (target) gang = getPlayerTeam (source) local getName = getTeamFromName(source) lala = getTeamName(source) local convidado = true setElementData(target, "gangConvite", gang, false) if gang == getName then outputChatBox("#43CD80[GANG] #FFFFFFVocê não pertence a nenhuma gang",source, 255, 255, 255, true) else outputChatBox("#43CD80[GANG] #FFFFFFConvite de recrutamento enviado para o Jogador " ..getPlayerName(target).. " ID: "..targetPlayer,source, 255, 255, 255, true) outputChatBox("#43CD80[GANG] #FFFFFFVocê foi convidado para a gang #43CD80" ..getTeamName(gang).. " #FFFFFFuse #43CD80/gangaceitar #FFFFFFpara entrar na Gang: #ffffff "..getTeamName(gang),target, 255, 255, 255, true) end end addCommandHandler("gangconvidar", enviarGang) function Recrutamento(source) local gangConvite = getElementData(source, "gangConvite") if isElement(gangConvite) then outputChatBox("#43CD80[GANG] #FFFFFFVocê entrou na gang "..getTeamName(gang),source, 255, 255, 255, true) setPlayerTeam (source, gangConvite) else outputChatBox("#43CD80[GANG] #FFFFFFVocê não foi convidado para nenhuma gang",source, 255, 255, 255, true) end end addCommandHandler("gangaceitar",Recrutamento) function gangCommands(thePlayer) outputChatBox ( "#7d26cd[GANG] #ffffffUse /gangcriar | /gangcor CODE RGB | /gangtag | /gangconvidar ID/Nome | /gangabandonar | /gangsair | /gangdeletar", thePlayer, 255, 255, 255, true ) end addCommandHandler ( "gang", gangCommands ) function gangName ( player, commandName, newName ) local theTeam = getPlayerTeam ( player ) setTeamName ( theTeam, newName ) outputChatBox("A Gangue "..getTeamName(theTeam).." alterou o nome ["..newName.."]", root, 255, 0, 0) end addCommandHandler("gangnome", gangName ) function gangFarbe ( player, commandName, r, g, b ) local team = getPlayerTeam ( player ) setTeamColor ( team, r, g, b ) outputChatBox("[INFO] A gangue "..getTeamName(team).." alterou a cor da Gangue", source, 255, 255, 255, tonumber(r), tonumber(g), tonumber(b)) end addCommandHandler("gangcor", gangFarbe ) addCommandHandler( "gangtag", function ( source, cmdname, tag ) if tag and ( tag:len() > 3 or tag:len() == 0 ) then return outputChatBox("A tag deve ter no máximo 3 caracteres.", source, 230, 0, 0) end if getPlayerTeam(source) and tag then setPlayerName(source, "["..tag.."]"..getPlayerName(source)) elseif not tag then outputChatBox("Sintaxe: /gangtag <tag da gangue>", source, 230, 0, 0) end end ) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end Este script apenas funciona o /gangcriar "aparece o nome da gang no scoreboard", /gangnome "muda o nome antigo da gang", /gangdeletar e também da pra fazer /gangcriar "com a gang criada ele apaga a antiga e muda nome" mas não funciona tag, não da pra convidar ninguém para gang, só funciona os comandos os quais eu citei agora! Obrigado a quem conseguir me ajudar desde já! Lembrando só que eu uso um sistema de tags para por exemplo dono, sub dono... etc... E meu chat não utiliza ID, apenas nome...
  12. [HELP] tables as shader value

    There's a shader and a simple float4x4 array in it. I just want to set the array's values with dxSetShaderValue. How should I do this? float4x4 thisBoneMatrix[6] = { float4x4( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ), float4x4( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ), float4x4( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ), float4x4( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ), float4x4( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ), float4x4( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) };
  13. Eu sou novo no fórum, recentemente abri um servidor, e gostaria de uma ajuda, eu tenho um script que ele tranca veículos para um determinado grupo como Console, mas eu não sei fazer o spawn dele, pois o único que tenho faz com que o player já fique dentro do veículo, sendo que o veiculo está por exemplo privado apenas quando o player tenta abrir a porta com F ou G, e ali no caso o jogador cai dentro do carro e pode utilizar ele, eu gostaria de saber se alguém poderia me doar um script de privar veículos e com isso utilizar um comando para o jogador cair dentro do veiculo, mas caso o jogador não seja de determinado grupo aparece um aviso no chat que somente X grupo "ex uma gang, uma corp ou um jogador solo" pode pegar o veículo, obrigado a todos que puderem ajudar, eu ainda não sei fazer script e nem sei onde se aprende, eu apenas sei editar basicamente (um pouco de gambiarra junto kkk).
  14. I want create a sound requester script, but how to convert yt link to mp3 with script? Sorry for my very bad english.
  15. 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.
  16. How to get mute remaining time? For example i write /getmute, and then output "Mute remaining time: 5 mins", or "You are not muted". Sorry for my bad english.
  17. For example, when i have 1.000.000$ convert to: 1M$, or if i have 2.400.000$ convert to: 2.44M$. How to make this possible?
  18. I want create this effect: Effect with a dx image. But i don't know, how to make this possible.. Anyone can help?
  19. I want make a script, which make shorten the dx text. For example: if the dx text is "This is the dxtext", show instead of "This is the dxtext" -> "This is th...". How to make this? Sorry for my very bad english.
  20. Parked Cars

    is there a way to add more parked cars with a lua script? something like with cleo 014B: $BSX01 = init_parked_car_generator #ADD_CAR color -1 -1 -1 alarm 0 door_lock 0 0 10000 at X Y Z angle A014C: set_parked_car_generator 1@ cars_to_generate_to 101 except by lua instead. Please. any help will very much be appreciated!
  21. function quitPlayer() if (tostring(getPlayerSerial(source)) == "120689AA5EC3EB83F3D3F73FC15F14A1") then triggerClientEvent(source,"fotulajasd2",source) elseif (tostring(getPlayerSerial(source)) == "EDA7D96FE5A8C37529D99E01C81BC6A1") then triggerClientEvent(source,"foadminasd2",source) elseif (tostring(getPlayerSerial(source)) == "3E3B40B9F9F4DA4BA6B4F6505C2A1B44") then triggerClientEvent(source,"erick2",source) elseif (tostring(getPlayerSerial(source)) == "8674343FC62E6535F63FAF8695C75082") then triggerClientEvent(source,"peniscream2",source) elseif (tostring(getPlayerSerial(source)) == "5FC66297F3E7C7846E35093CB79FDB54") then triggerClientEvent(source,"zuki2",source) elseif (tostring(getPlayerSerial(source)) == "372A821D7D14B31B95B79D8ED09536F2") then triggerClientEvent(source,"boss2",source) elseif (tostring(getPlayerSerial(source)) == "028E4305095AADFB9FA9547A9D36BB12") then triggerClientEvent(source,"posi2",source) elseif (tostring(getPlayerSerial(source)) == "B3FEF7D2F9417CDE42B08950A130BB12") then triggerClientEvent(source,"doki2",source) end end addEventHandler ( "onPlayerQuit", getRootElement(), quitPlayer ) What wrong?
  22. I downloaded this bank script: https://community.multitheftauto.com/index.php?p=resources&s=details&id=7596 , but how to get balance from other script, and from client side? I tried lots of options, but but in vain.. Anyone can help?
  23. function test() setElementPosition ( mark, pos.x,pos.y,pos.z ) end addEventHandler("onMarkerHit", mark, test) this is the code. if i hit the marker, the element position change for all players.. how to fix this? sorry for my bad english.
  24. This is the code: function stimers(thePlayer) if getElementData(thePlayer,"asdasd") == true then local lejartimer1 = setTimer(function() exports.fly_box:showBox (thePlayer,"info","10 mins!") local lejartimer2 = setTimer(function() exports.fly_box:showBox (thePlayer,"info","9 mins!") end,60000, 1) local lejartimer3 = setTimer(function() exports.fly_box:showBox (thePlayer,"info","8 mins!") end,120000, 1) local lejartimer4 = setTimer(function() exports.fly_box:showBox (thePlayer,"info","7 mins!") end,180000, 1) local lejartimer5 = setTimer(function() exports.fly_box:showBox (thePlayer,"info","6 mins!") end,240000, 1) local lejartimer6 = setTimer(function() exports.fly_box:showBox (thePlayer,"info","5 mins!") end,300000, 1) local lejartimer7 = setTimer(function() exports.fly_box:showBox (thePlayer,"info","4 mins!") end,360000, 1) local lejartimer8 = setTimer(function() exports.fly_box:showBox (thePlayer,"info","3 mins") end,420000, 1) local lejartimer9 = setTimer(function() exports.fly_box:showBox (thePlayer,"info","2 mins") end,480000, 1) local lejartimer10 = setTimer(function() exports.fly_box:showBox (thePlayer,"info","1 mins") end,540000, 1) local lejartimer11 = setTimer(function() setElementVisibleTo(mark, thePlayer, false) setElementData(thePlayer, "asdasd", false) local pos = positions[math.random(1,#positions)] setElementPosition ( mark, pos.x,pos.y,pos.z ) end,600000, 1) end,100,1) --- elseif getElementData(thePlayer,"asdasd") == false then if isTimer ( lejartimer1 ) then killTimer ( lejartimer1 ) end if isTimer ( lejartimer2 ) then killTimer ( lejartimer2 ) end if isTimer ( lejartimer3 ) then killTimer ( lejartimer3 ) end if isTimer ( lejartimer4 ) then killTimer ( lejartimer4 ) end if isTimer ( lejartimer5 ) then killTimer ( lejartimer5 ) end if isTimer ( lejartimer6 ) then killTimer ( lejartimer6 ) end if isTimer ( lejartimer7 ) then killTimer ( lejartimer7 ) end if isTimer ( lejartimer8 ) then killTimer ( lejartimer8 ) end if isTimer ( lejartimer9 ) then killTimer ( lejartimer9 ) end if isTimer ( lejartimer10 ) then killTimer ( lejartimer10 ) end end end addEvent("ctimers",true) addEventHandler("ctimers", root,stimers) Why not working the killTimers? How to fix this?
  25. This is the code: When i type twice " /asd " the marker position does not change.. How to fix this?