Jump to content

[DUVIDA] Mensagem de Login e Script de Celular


Recommended Posts

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)

 

Link to comment
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"

Link to comment
  • Moderators

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 by DNL291
  • Thanks 1
Link to comment
4 hours ago, Brendo said:

Acho que deu pra entender mais ou menos a que ponto quero chegar.

É, não muito! :lol:

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

  • Thanks 1
Link to comment

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.

Link to comment

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 by OverKILL
  • Thanks 1
Link to comment
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

Link to comment
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 by Brendo
Link to comment
  • Other Languages Moderators
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 by Lord Henry
  • Thanks 1
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...