#Death Posted March 19, 2018 Posted March 19, 2018 Instalei um script de ID player para meu servidor MTA:SA, gostaria de saber como faço para mudar de player para id, o meu sistema de "PM, /pm", segue a forma em que está, espero esclarecimentos: if (getPlayerFromParticalName (sendToPlayerName)) then toPlayer = (getPlayerFromParticalName (sendToName)) Teria que modificar por if (getPlayerFromID (sendToPlayerID))?
Moderators Lord Henry Posted March 19, 2018 Moderators Posted March 19, 2018 Não tenho como lhe ajudar sem saber o código do sistema de ID. 1 Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanks! Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment Discord Oficial do MTA: https://mtasa.com/discord Blacklist e Whitelist de Scripters: Planilha Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.
SetMarcos Posted March 19, 2018 Posted March 19, 2018 (edited) Se oque você quer é um sistema de mensagens privadas, veja esse script: https://community.multitheftauto.com/index.php?p=resources&s=details&id=1562 Não sei se ela está compilado, mais quis ajudar. Edited March 19, 2018 by Marcos^v7 http://www.infeczumbi.ga/
#Death Posted March 19, 2018 Author Posted March 19, 2018 3 hours ago, Lord Henry said: Não tenho como lhe ajudar sem saber o código do sistema de ID. Não sei exatamente como é o código, ou qual parte apenas é o código, irei mandar o script inteiro: function privateMessage(thePlayer,commandName,sendToName,...) local pmWords = { ... } local pmMessage = table.concat( pmWords, " " ) if sendToName then if (getPlayerFromParticalName (sendToName)) then toPlayer = (getPlayerFromParticalName (sendToName)) if not (toPlayer == thePlayer) then if not (pmMessage == "") then outputChatBox("#0044FF[PM]#FFFFFF Enviada para #FFFFFF" .. getPlayerName(toPlayer) .. "#FFFFFF: " .. pmMessage, thePlayer, 255, 255, 255, true) outputChatBox("#0044FF[PM]#FFFFFF Recebida de #FFFFFF" .. getPlayerName(thePlayer) .. "#FFFFFF: " .. pmMessage, toPlayer, 255, 255, 255, true) else outputChatBox("#0044FF[PM]#FFFFFF Comando Inválido! Use:#FFFFFF /pm [nome do jogador] [Mensagem]", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#0044FF[PM]#FFFFFF Você não pode mandar PM para si mesmo#FFFFFF!", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#0044FF[PM]#FFFFFF Jogador não encontrado! #FFFF00(#FFFFFF"..sendToName.."#FFFF00)", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#0044FF[PM]#FFFFFF Comando Inválido! Use:#FFFFFF /pm [nome do jogador] [Mensagem]", thePlayer, 255, 255, 255, true) return false end end addCommandHandler("pm", privateMessage) function infoPM() outputChatBox ('#0044FF[PM]#FFFFFF Para mandar mensagens privadas digite #0044FF/pm #FFFFFF[#0044FFNome do Jogador#FFFFFF] [#0044FFMensagem#FFFFFF]',getRootElement(),255,255,255,true) end setTimer(infoPM, 350000, 350) 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
Moderators Lord Henry Posted March 19, 2018 Moderators Posted March 19, 2018 (edited) Cara, já lhe pedi para usar a ferramenta <> do fórum para postar códigos. Colar sem formatação fica muito difícil de interpretar. function privateMessage(thePlayer,commandName,sendToName,...) local pmWords = { ... } local pmMessage = table.concat( pmWords, " " ) if sendToName then if (getPlayerFromParticalName (sendToName)) then toPlayer = (getPlayerFromParticalName (sendToName)) if not (toPlayer == thePlayer) then if not (pmMessage == "") then outputChatBox("#0044FF[PM]#FFFFFF Enviada para #FFFFFF" .. getPlayerName(toPlayer) .. "#FFFFFF: " .. pmMessage, thePlayer, 255, 255, 255, true) outputChatBox("#0044FF[PM]#FFFFFF Recebida de #FFFFFF" .. getPlayerName(thePlayer) .. "#FFFFFF: " .. pmMessage, toPlayer, 255, 255, 255, true) else outputChatBox("#0044FF[PM]#FFFFFF Comando Inválido! Use:#FFFFFF /pm [nome do jogador] [Mensagem]", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#0044FF[PM]#FFFFFF Você não pode mandar PM para si mesmo#FFFFFF!", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#0044FF[PM]#FFFFFF Jogador não encontrado! #FFFF00(#FFFFFF"..sendToName.."#FFFF00)", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#0044FF[PM]#FFFFFF Comando Inválido! Use:#FFFFFF /pm [nome do jogador] [Mensagem]", thePlayer, 255, 255, 255, true) return false end end addCommandHandler("pm", privateMessage) function infoPM () outputChatBox ('#0044FF[PM]#FFFFFF Para mandar mensagens privadas digite #0044FF/pm #FFFFFF[#0044FFNome do Jogador#FFFFFF] [#0044FFMensagem#FFFFFF]',getRootElement(),255,255,255,true) end setTimer(infoPM, 350000, 350) 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 Agora da pra ler o código. 6 hours ago, #Death said: Teria que modificar por if (getPlayerFromID (sendToPlayerID))? Isso depende de como o sistema de ID funciona. A princípio não funcionaria fazer isso. Pois você teria que importar a função getPlayerFromID() que estaria no resource de ID. Edited March 19, 2018 by Lord Henry Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanks! Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment Discord Oficial do MTA: https://mtasa.com/discord Blacklist e Whitelist de Scripters: Planilha Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.
#Death Posted March 19, 2018 Author Posted March 19, 2018 40 minutes ago, Lord Henry said: Cara, já lhe pedi para usar a ferramenta <> do fórum para postar códigos. Colar sem formatação fica muito difícil de interpretar. function privateMessage(thePlayer,commandName,sendToName,...) local pmWords = { ... } local pmMessage = table.concat( pmWords, " " ) if sendToName then if (getPlayerFromParticalName (sendToName)) then toPlayer = (getPlayerFromParticalName (sendToName)) if not (toPlayer == thePlayer) then if not (pmMessage == "") then outputChatBox("#0044FF[PM]#FFFFFF Enviada para #FFFFFF" .. getPlayerName(toPlayer) .. "#FFFFFF: " .. pmMessage, thePlayer, 255, 255, 255, true) outputChatBox("#0044FF[PM]#FFFFFF Recebida de #FFFFFF" .. getPlayerName(thePlayer) .. "#FFFFFF: " .. pmMessage, toPlayer, 255, 255, 255, true) else outputChatBox("#0044FF[PM]#FFFFFF Comando Inválido! Use:#FFFFFF /pm [nome do jogador] [Mensagem]", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#0044FF[PM]#FFFFFF Você não pode mandar PM para si mesmo#FFFFFF!", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#0044FF[PM]#FFFFFF Jogador não encontrado! #FFFF00(#FFFFFF"..sendToName.."#FFFF00)", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#0044FF[PM]#FFFFFF Comando Inválido! Use:#FFFFFF /pm [nome do jogador] [Mensagem]", thePlayer, 255, 255, 255, true) return false end end addCommandHandler("pm", privateMessage) function infoPM () outputChatBox ('#0044FF[PM]#FFFFFF Para mandar mensagens privadas digite #0044FF/pm #FFFFFF[#0044FFNome do Jogador#FFFFFF] [#0044FFMensagem#FFFFFF]',getRootElement(),255,255,255,true) end setTimer(infoPM, 350000, 350) 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 Agora da pra ler o código. Isso depende de como o sistema de ID funciona. A princípio não funcionaria fazer isso. Pois você teria que importar a função getPlayerFromID() que estaria no resource de ID. Okay, muito obrigado por todos os esclarecimentos!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now