Brendo 0 Posted February 7 Opa, Estou com um projeto de servidor RP e sou novato em script's, quero ir aprendendo conforme a evolução do server e estou com 2 dúvidas... 1- Como removo a mensagem de login "You SuccessFully logged in" ? 2- Neste servidor que estou fazendo as profissões já estão configuradas e para chamar o uber por exemplo é só digitar "/uber" e para evitar do jogador ter que digitar o comando eu Estou com um script de celular no qual ele tem o botão de uber porém eu queria apenas que o botão do celular em si executasse apenas o comando "/uber" e já era mas pelo que eu vi ele está criando um novo sistema de uber no qual ele chama os players que estão na ACL uber e eu queria remover esse sistema e apenas fazer o botão executar o comando. Acho que deu pra entender mais ou menos a que ponto quero chegar. Código do "Botão Uber" Do script do celular: function ChamarTaxista () local x, y, z = getElementPosition(source) local loc = getZoneName ( x, y, z ) local city = getZoneName ( x, y, z, true ) outputChatBox("#00FFFFUber Acionado, aguarde no local.", source, 255, 255, 255, true) for theKey,player in ipairs (getElementsByType("player")) do local accName = getAccountName ( getPlayerAccount ( player ) ) if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( GroupName2) ) ) then outputChatBox("#00FFFF"..getPlayerName(source).." precisa de um uber em "..loc.." ("..city.."), localize-o em seu GPS", player, 255, 255, 255, true) displayServerMessage(player, ""..getPlayerName(source).." precisa de um uber em "..loc.." ("..city.."), localize-o em seu GPS", "warning") local blip = createBlipAttachedTo ( source, 56 ) setElementVisibleTo(blip, root, false) setElementVisibleTo(blip, player, true) setTimer ( function() destroyElement(blip) end, 270000, 1) end end end addEvent( "ChamarOTaxista", true ) addEventHandler( "ChamarOTaxista", root, ChamarTaxista) Share this post Link to post
Tommy. 39 Posted February 7 Talvez isso funcione: addEventHandler ( "onChatMessage", root, function ( msg ) if ( tostring ( msg ) : lower ( ) == "login: you successfully logged in" ) then cancelEvent ( ) end end ) EDIT: Não testei! 1 Share this post Link to post
Jonas^ 240 Posted February 7 Deixa eu ver se entendi, você quer tirar a permissão dessa função? 1 Share this post Link to post
Brendo 0 Posted February 7 2 hours ago, Tommy. said: Talvez isso funcione: addEventHandler ( "onChatMessage", root, function ( msg ) if ( tostring ( msg ) : lower ( ) == "login: you successfully logged in" ) then cancelEvent ( ) end end ) EDIT: Não testei! vou testar 37 minutes ago, OverKILL said: Deixa eu ver se entendi, você quer tirar a permissão dessa função? depende, ta falando de qual? se for de login eu só quero que não apareça a mensagem e a do celular eu quero remover esse sistema por inteiro e fazer com que ele execute apenas o comando "/uber" Share this post Link to post
DNL291 624 Posted February 7 (edited) Procure pela função do clique no botão do celular e chame o evento no lado server que vai executar a função do /uber. Edit: E esse código não é do botão do celular, o código com certeza só pode estar no lado cliente. Edited February 7 by DNL291 1 Share this post Link to post
MaligNos 138 Posted February 7 4 hours ago, Brendo said: Acho que deu pra entender mais ou menos a que ponto quero chegar. É, não muito! Eu acho que ele quer executar o comando /uber quando clicar em um botão: function ChamarTaxista () executeCommandHandler ( "uber", client ) addEvent( "ChamarOTaxista", true ) addEventHandler( "ChamarOTaxista", root, ChamarTaxista) addCommandHandler ( "uber", function(player) -- código uber end end * Precisa conceder privilégios de admin ao resource na ACL 1 Share this post Link to post
Brendo 0 Posted February 7 Vms por parte rapaziada, Vou postar todo o código aqui pra vocês entenderem. Aqui está o código da parte cliente: (Coloquei o código inteiro para melhor você entenderem...) addEventHandler("onClientMouseEnter",root, function () if source == sendmoney then guiSetText (phon_LBL,"Enviar Dinheiro") elseif source == Callingm then guiSetText (phon_LBL,"Solicitar Samu") elseif source == animshe then guiSetText (phon_LBL,"Danças") elseif source == top10pivp then guiSetText (phon_LBL,"Navegador") elseif source == putplibss then guiSetText (phon_LBL,"Envie localização") elseif source == Callingp then guiSetText (phon_LBL,"Chame a polícia") elseif source == top10 then guiSetText (phon_LBL,"10 melhores jogadores") elseif source == Calculatorpanel then guiSetText (phon_LBL,"Calculadora") elseif source == policePanel then guiSetText (phon_LBL,"Procurados(desativado)") elseif source == PlayerInfo then guiSetText (phon_LBL,"Suas informações") elseif source == sms then guiSetText (phon_LBL,"Whatsapp!") elseif source == mecanicolig then guiSetText (phon_LBL,"Solicitar Mecânico!") elseif source == taxilig then guiSetText (phon_LBL,"Solicitar Uber!") --TA AQUI O CÓDIGO DO UBER, POSTEI O CÓDIGO INTEIRO SÓ PRA ENTENDER MELHOR. end end ) O código acima leva pra esse código --------------------------------------------------calling------------------------------- addEventHandler("onClientGUIClick",root, function () if( source == Callingp ) then triggerServerEvent('ChamarAPolicia', localPlayer) guiSetEnabled (Callingp,false) setTimer (function ( ) guiSetEnabled (Callingp,true) end,60000,1) elseif( source == Callingm ) then triggerServerEvent('ChamarOSamu', localPlayer) guiSetEnabled (Callingm,false) setTimer (function ( ) guiSetEnabled (Callingm,true) end,60000,1) elseif( source == mecanicolig ) then triggerServerEvent('ChamarOMecanico', localPlayer) guiSetEnabled (mecanicolig,false) setTimer (function ( ) guiSetEnabled (mecanicolig,true) end,60000,1) elseif( source == taxilig ) then ------------------------------------------UBER AQ triggerServerEvent('ChamarOTaxista', localPlayer) guiSetEnabled (taxilig,true) setTimer (function ( ) guiSetEnabled (taxilig,true) end,60000,1) end end ) E por ultimo a Parte do servidor coloquei só a parte que interessa que é a do uber. function ChamarTaxista () local x, y, z = getElementPosition(source) local loc = getZoneName ( x, y, z ) local city = getZoneName ( x, y, z, true ) outputChatBox("#00FFFFUber Acionado, aguarde no local.", source, 255, 255, 255, true) for theKey,player in ipairs (getElementsByType("player")) do local accName = getAccountName ( getPlayerAccount ( player ) ) if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( GroupName2) ) ) then outputChatBox("#00FFFF"..getPlayerName(source).." precisa de um uber em "..loc.." ("..city.."), localize-o em seu GPS", player, 255, 255, 255, true) displayServerMessage(player, ""..getPlayerName(source).." precisa de um uber em "..loc.." ("..city.."), localize-o em seu GPS", "warning") local blip = createBlipAttachedTo ( source, 56 ) setElementVisibleTo(blip, root, false) setElementVisibleTo(blip, player, true) setTimer ( function() destroyElement(blip) end, 270000, 1) end end end addEvent( "ChamarOTaxista", true ) addEventHandler( "ChamarOTaxista", root, ChamarTaxista) Pelo visto é coisa simples mais como sou leigo no assunto não sei nem por onde vou. Se quiserem posso deixar o link p download do script, que daí fica mais facil pra me auxiliarem, mais deis de ja agradeço. Share this post Link to post
Jonas^ 240 Posted February 7 Ainda não entendi o que você quer fazer sinceramente , podeira tentar explicar de uma forma melhor?? 1 Share this post Link to post
Brendo 0 Posted February 7 Eu quero que esse botão do uber não faça nada além de executar o comando /uber pra evitar dos players ter que ficar digitando no chat. o meu sistema de uber é por fora do script de celular entendeu? Share this post Link to post
Jonas^ 240 Posted February 7 (edited) Então use o código do malignos. Edit: Indente o código pra ficar mais legível e fácil de você entender. Tente desta forma: SERVER-SIDE function ChamarTaxista () executeCommandHandler ( "uber", client ) addEvent( "ChamarOTaxista", true ) addEventHandler( "ChamarOTaxista", root, ChamarTaxista) addCommandHandler ( "uber", function () local x, y, z = getElementPosition(source) local loc = getZoneName ( x, y, z ) local city = getZoneName ( x, y, z, true ) outputChatBox("#00FFFFUber Acionado, aguarde no local.", source, 255, 255, 255, true) for theKey,player in ipairs (getElementsByType("player")) do local accName = getAccountName ( getPlayerAccount ( player ) ) if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( GroupName2) ) ) then outputChatBox("#00FFFF"..getPlayerName(source).." precisa de um uber em "..loc.." ("..city.."), localize-o em seu GPS", player, 255, 255, 255, true) displayServerMessage(player, ""..getPlayerName(source).." precisa de um uber em "..loc.." ("..city.."), localize-o em seu GPS", "warning") local blip = createBlipAttachedTo ( source, 56 ) setElementVisibleTo(blip, root, false) setElementVisibleTo(blip, player, true) setTimer ( function() destroyElement(blip) end, 270000, 1) end end end ) CLIENT-SIDE addEventHandler("onClientMouseEnter",root, function () if source == sendmoney then guiSetText (phon_LBL, "Enviar Dinheiro") elseif source == Callingm then guiSetText (phon_LBL, "Solicitar Samu") elseif source == animshe then guiSetText (phon_LBL, "Danças") elseif source == top10pivp then guiSetText (phon_LBL, "Navegador") elseif source == putplibss then guiSetText (phon_LBL, "Envie localização") elseif source == Callingp then guiSetText (phon_LBL, "Chame a polícia") elseif source == top10 then guiSetText (phon_LBL, "10 melhores jogadores") elseif source == Calculatorpanel then guiSetText (phon_LBL, "Calculadora") elseif source == policePanel then guiSetText (phon_LBL, "Procurados(desativado)") elseif source == PlayerInfo then guiSetText (phon_LBL, "Suas informações") elseif source == sms then guiSetText (phon_LBL, "Whatsapp!") elseif source == mecanicolig then guiSetText (phon_LBL, "Solicitar Mecânico!") elseif source == taxilig then guiSetText (phon_LBL, "Solicitar Uber!") --TA AQUI O CÓDIGO DO UBER, POSTEI O CÓDIGO INTEIRO SÓ PRA ENTENDER MELHOR. end end) addEventHandler("onClientGUIClick",root, function () if( source == Callingp ) then triggerServerEvent('ChamarAPolicia', localPlayer) guiSetEnabled (Callingp,false) setTimer (function ( ) guiSetEnabled (Callingp,true) end, 60000,1) elseif( source == Callingm ) then triggerServerEvent('ChamarOSamu', localPlayer) guiSetEnabled (Callingm,false) setTimer (function ( ) guiSetEnabled (Callingm,true) end, 60000,1) elseif( source == mecanicolig ) then triggerServerEvent('ChamarOMecanico', localPlayer) guiSetEnabled (mecanicolig,false) setTimer (function ( ) guiSetEnabled (mecanicolig,true) end, 60000,1) elseif( source == taxilig ) then ------------------------------------------UBER AQ triggerServerEvent('ChamarOTaxista', localPlayer) guiSetEnabled (taxilig,true) setTimer (function ( ) guiSetEnabled (taxilig,true) end, 60000,1) end end) ( Não testado ) Edited February 7 by OverKILL 1 Share this post Link to post
Brendo 0 Posted February 8 1 hour ago, OverKILL said: Então use o código do malignos. Edit: Indente o código pra ficar mais legível e fácil de você entender. Tente desta forma: SERVER-SIDE function ChamarTaxista () executeCommandHandler ( "uber", client ) addEvent( "ChamarOTaxista", true ) addEventHandler( "ChamarOTaxista", root, ChamarTaxista) addCommandHandler ( "uber", function () local x, y, z = getElementPosition(source) local loc = getZoneName ( x, y, z ) local city = getZoneName ( x, y, z, true ) outputChatBox("#00FFFFUber Acionado, aguarde no local.", source, 255, 255, 255, true) for theKey,player in ipairs (getElementsByType("player")) do local accName = getAccountName ( getPlayerAccount ( player ) ) if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( GroupName2) ) ) then outputChatBox("#00FFFF"..getPlayerName(source).." precisa de um uber em "..loc.." ("..city.."), localize-o em seu GPS", player, 255, 255, 255, true) displayServerMessage(player, ""..getPlayerName(source).." precisa de um uber em "..loc.." ("..city.."), localize-o em seu GPS", "warning") local blip = createBlipAttachedTo ( source, 56 ) setElementVisibleTo(blip, root, false) setElementVisibleTo(blip, player, true) setTimer ( function() destroyElement(blip) end, 270000, 1) end end end ) CLIENT-SIDE addEventHandler("onClientMouseEnter",root, function () if source == sendmoney then guiSetText (phon_LBL, "Enviar Dinheiro") elseif source == Callingm then guiSetText (phon_LBL, "Solicitar Samu") elseif source == animshe then guiSetText (phon_LBL, "Danças") elseif source == top10pivp then guiSetText (phon_LBL, "Navegador") elseif source == putplibss then guiSetText (phon_LBL, "Envie localização") elseif source == Callingp then guiSetText (phon_LBL, "Chame a polícia") elseif source == top10 then guiSetText (phon_LBL, "10 melhores jogadores") elseif source == Calculatorpanel then guiSetText (phon_LBL, "Calculadora") elseif source == policePanel then guiSetText (phon_LBL, "Procurados(desativado)") elseif source == PlayerInfo then guiSetText (phon_LBL, "Suas informações") elseif source == sms then guiSetText (phon_LBL, "Whatsapp!") elseif source == mecanicolig then guiSetText (phon_LBL, "Solicitar Mecânico!") elseif source == taxilig then guiSetText (phon_LBL, "Solicitar Uber!") --TA AQUI O CÓDIGO DO UBER, POSTEI O CÓDIGO INTEIRO SÓ PRA ENTENDER MELHOR. end end) addEventHandler("onClientGUIClick",root, function () if( source == Callingp ) then triggerServerEvent('ChamarAPolicia', localPlayer) guiSetEnabled (Callingp,false) setTimer (function ( ) guiSetEnabled (Callingp,true) end, 60000,1) elseif( source == Callingm ) then triggerServerEvent('ChamarOSamu', localPlayer) guiSetEnabled (Callingm,false) setTimer (function ( ) guiSetEnabled (Callingm,true) end, 60000,1) elseif( source == mecanicolig ) then triggerServerEvent('ChamarOMecanico', localPlayer) guiSetEnabled (mecanicolig,false) setTimer (function ( ) guiSetEnabled (mecanicolig,true) end, 60000,1) elseif( source == taxilig ) then ------------------------------------------UBER AQ triggerServerEvent('ChamarOTaxista', localPlayer) guiSetEnabled (taxilig,true) setTimer (function ( ) guiSetEnabled (taxilig,true) end, 60000,1) end end) ( Não testado ) Cara, acho que nenhum de vocês entenderam ainda kkk, isso deve ser pelo fato de eu ser horrivel tentando explicar as coisas... Mas repetindo, deis de já agradeço pela força q vcs tao dando. Bom, Pra deixar bem detalhado vou explicar como ta o servidor, Os trabalhos já estão prontos e não tem nada a ver com o script de celular! Esse código que vocês estão vendo acima é o código que ja veio com o script do celular, que aliás, todos eles são publicos, mas isto não vem ao caso.. O trabalho de uber está em uma pasta distinta, longe da pasta do celular e repetindo não tem nada a ver um com um outro e como o trabalho de uber tem que digitar /uber para chamar um uber oque eu queria é que o botão do uber no celular executasse esse comando para que os players não precisem digitar, apenas ir no celular e apertar o botão que o comando seria executado. somente, eu quero apagar todo esse sistema de uber do script de celular e fazer com que o botão execute um comando, e agora deu pra entender? kkk Share this post Link to post
Jonas^ 240 Posted February 8 Sim, então usa apenas o executeCommandHandler 1 Share this post Link to post
Brendo 0 Posted February 8 (edited) 19 minutes ago, OverKILL said: Sim, então usa apenas o executeCommandHandler Se eu for usar ele é na parte client ne? como ficaria mais ou menos? edit: eu sou leigo a nivel hard Edited February 8 by Brendo Share this post Link to post
Jonas^ 240 Posted February 8 Usa no server e coloca o resource na acl admin. 1 Share this post Link to post
Lord Henry 1,044 Posted February 8 Tbm não entendi nada. E por acaso aquela primeira dúvida referente ao login já foi resolvido? 1 Share this post Link to post
Brendo 0 Posted February 8 (edited) 12 hours ago, Lord Henry said: Tbm não entendi nada. E por acaso aquela primeira dúvida referente ao login já foi resolvido? Pelo que eu vi não tem como, a não ser que eu criasse um outputchatbox pra mandar a mensagem la pra cima. E rapaziada, problema resolvido! Apaguei todo o código e deixei apenas o ExecuteCommandhandler e funcionou! Como ja sabia, era coisa simples mais ser leigo é foda kkkk EDIT PRINT COMPROVANDO: https://prnt.sc/mifyxt Então o código disso: function ChamarTaxista () local x, y, z = getElementPosition(source) local loc = getZoneName ( x, y, z ) local city = getZoneName ( x, y, z, true ) outputChatBox("#00FFFFUber Acionado, aguarde no local.", source, 255, 255, 255, true) for theKey,player in ipairs (getElementsByType("player")) do local accName = getAccountName ( getPlayerAccount ( player ) ) if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( GroupName2) ) ) then outputChatBox("#00FFFF"..getPlayerName(source).." precisa de um uber em "..loc.." ("..city.."), localize-o em seu GPS", player, 255, 255, 255, true) displayServerMessage(player, ""..getPlayerName(source).." precisa de um uber em "..loc.." ("..city.."), localize-o em seu GPS", "warning") local blip = createBlipAttachedTo ( source, 56 ) setElementVisibleTo(blip, root, false) setElementVisibleTo(blip, player, true) setTimer ( function() destroyElement(blip) end, 270000, 1) end end end addEvent( "ChamarOTaxista", true ) addEventHandler( "ChamarOTaxista", root, ChamarTaxista) Passou a ser apenas isso: function ChamarTaxista () executeCommandHandler ( "uber", client ) end addEvent( "ChamarOTaxista", true ) addEventHandler( "ChamarOTaxista", root, ChamarTaxista) Vlw a todos que deram uma força, vou ta ajudando geral com thanks! tmj rapaziada. Edited February 8 by Brendo Share this post Link to post
Lord Henry 1,044 Posted February 8 (edited) 2 hours ago, Brendo said: Pelo que eu vi não tem como, a não ser que eu criasse um outputchatbox pra mandar a mensagem la pra cima. Tem certeza? client-side function onChatMessage (text) if (text == "login: You successfully logged in" or text == "logout: You logged out") then cancelEvent() -- Cancela as mensagens. end end addEventHandler ("onClientChatMessage", root, onChatMessage) Obs: Código testado. Edited February 8 by Lord Henry 1 Share this post Link to post
MaligNos 138 Posted February 8 2 hours ago, Brendo said: Pelo que eu vi não tem como, a não ser que eu criasse um outputchatbox pra mandar a mensagem la pra cima. Exemplo do LordHenry deve funcionar, pois com onClientChatMessage (lado cliente), mensagens nativas também são captadas. “This event is triggered when any text is output to chatbox, including MTA's hardcoded messages.” by: WIKI 1 Share this post Link to post