Jump to content

[AJUDA] Chat OLX


Recommended Posts

Oi gente, gostaria de saber como fazer um chat de vendas, por exemplo assim: 

Quando o jogador digitar /olx carro sem doc, vai aparecer no chat "O jogador "tal", está vendendo carro sem doc. E assim vai

Mas queria saber como faço para depois disso ele possa adicionar um valor do veiculo e iria ficar + ou - assim,  Exemplo:

,/olx carro sem doc 4000 O jogador X está vendendo carro sem doc por R$4000.  Tentei fazer a parte dos números mas n consegui




ComandoDoChatGlobal =                "olx" 


function adminchat ( thePlayer, _, ... )
    local message = table.concat ( { ... }, " " )
    if ( isPlayerOnGroup ( thePlayer ) ) then
    for _, player in ipairs ( getElementsByType ( "player" ) ) do
    if ( isPlayerOnGroup ( player ) ) then

	conta = getAccountName(getPlayerAccount(thePlayer))					

	if isObjectInACLGroup ("user."..conta, aclGetGroup ( "Console" ) ) then
	outputChatBox("#838B83[ #A020F0O#9ACD32L#FFA500X #838B83]#ffffff  #00FF00» : #ffffffO Jogador #00FF00"..getPlayerName(thePlayer).. ", #ffffffestá vendendo #ffffff #DAA520"..message, player, 255, 255, 255, true)
	
	elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Everyone" ) ) then
	outputChatBox("#838B83[ #A020F0O#9ACD32L#FFA500X #838B83]#ffffff  #00FF00» : #ffffffO Jogador #00FF00"..getPlayerName(thePlayer).. ", #ffffffestá vendendo #ffffff #DAA520"..message, player, 255, 255, 255, true)

	end
    end
    end
    end
	setElementData ( thePlayer, "Chat:Avisado", true )
	setElementData ( thePlayer, "Chat:Delay1",true )
    setTimer ( setElementData, 5000, 1, thePlayer, "Chat:Delay1", false )
end
addCommandHandler ( ComandoDoChatGlobal, adminchat )

--------------------------------------------------------------------------------------------

function isPlayerOnGroup ( thePlayer )
    local account = getPlayerAccount ( thePlayer )
    local inGroup = false
    for _, group in ipairs ( { "Everyone" } ) do  
    if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) )   then
    inGroup = true
    break
    end
    end
    return inGroup
end

 

Link to comment

Se o valor estiver sempre no final pode ser usado:

function adminchat ( thePlayer, _, ... )
	local tbl = {...}
	local valor = tbl[#tbl]
	table.remove(tbl)
	local message = table.concat ( tbl, " " )
	if ( isPlayerOnGroup ( thePlayer ) ) then
		-- resto do código

 

Link to comment

tentei mas n deu tipo era pra ser assim /olx carro sem doc 30.00 dai ia aparecer no final "jogar x esta vendendo carro sem doc por R$30.00"

 




ComandoDoChatGlobal =                "olx" 


function adminchat ( thePlayer, _, ... )
	local tbl = {...}
	local valor = tbl[#tbl]
	table.remove(tbl)
	local message = table.concat ( tbl, " " )
	if ( isPlayerOnGroup ( thePlayer ) ) then

	conta = getAccountName(getPlayerAccount(thePlayer))					

	if isObjectInACLGroup ("user."..conta, aclGetGroup ( "Console" ) ) then
	outputChatBox("#838B83[ #A020F0O#9ACD32L#FFA500X #838B83 ]#ffffff  #00FF00» : #ffffffO Jogador #00FF00"..getPlayerName(thePlayer).. ", #ffffffestá vendendo #ffffff #DAA520"..message, player, 255, 255, 255, true)
	
	elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Everyone" ) ) then
	outputChatBox("#838B83[ #A020F0O#9ACD32L#FFA500X #838B83 ]#ffffff  #00FF00» : #ffffffO Jogador #00FF00"..getPlayerName(thePlayer).. ", #ffffffestá vendendo #ffffff #DAA520"..message, player, 255, 255, 255, true)

	end
    end
    end
    end
	setElementData ( thePlayer, "Chat:Avisado", true )
	setElementData ( thePlayer, "Chat:Delay1",true )
    setTimer ( setElementData, 5000, 1, thePlayer, "Chat:Delay1", false )
end
addCommandHandler ( ComandoDoChatGlobal, adminchat )

--------------------------------------------------------------------------------------------

function isPlayerOnGroup ( thePlayer )
    local account = getPlayerAccount ( thePlayer )
    local inGroup = false
    for _, group in ipairs ( { "Everyone" } ) do  
    if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) )   then
    inGroup = true
    break
    end
    end
    return inGroup
end

 

Link to comment

Tente indentar o código @Laluis23 pra ficar mais fácil de entender e achar os erros exemplo:

 

local ComandoDoChatGlobal = "olx" 

function adminchat (thePlayer, _, ...)
	local tbl = {...}
	local valor = tbl[#tbl]
	table.remove(tbl)
	local message = table.concat (tbl, " ")
	if (isPlayerOnGroup (thePlayer)) then
		conta = getAccountName(getPlayerAccount(thePlayer))					
		if isObjectInACLGroup ("user."..conta, aclGetGroup ("Console")) then
			outputChatBox ("#838B83[ #A020F0O#9ACD32L#FFA500X #838B83 ]#ffffff  #00FF00» : #ffffffO Jogador #00FF00"..getPlayerName(thePlayer).. ", #ffffffestá vendendo #ffffff #DAA520"..message, player, 255, 255, 255, true)
		elseif isObjectInACLGroup ("user."..conta, aclGetGroup ("Everyone")) then
			outputChatBox ("#838B83[ #A020F0O#9ACD32L#FFA500X #838B83 ]#ffffff  #00FF00» : #ffffffO Jogador #00FF00"..getPlayerName(thePlayer).. ", #ffffffestá vendendo #ffffff #DAA520"..message, player, 255, 255, 255, true)
		end
	end
	setElementData (thePlayer, "Chat:Avisado", true)
	setElementData (thePlayer, "Chat:Delay1", true)
	setTimer (setElementData, 5000, 1, thePlayer, "Chat:Delay1", false)
end
addCommandHandler (ComandoDoChatGlobal, adminchat)

function isPlayerOnGroup (thePlayer)
	local account = getPlayerAccount (thePlayer)
	local inGroup = false
	for _, group in ipairs ( { "Everyone" } ) do  
		if isObjectInACLGroup ( "user.".. getAccountName (account), aclGetGroup (group))   then
			inGroup = true
			break
		end
	end
	return inGroup	
end

 

Edited by OverKILL
Correção.
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...