Jump to content

Chat message only visible to people on a certain team


Captain Cody

Recommended Posts

Posted
taxidriver = getPlayersInTeam ( TaxiDriverTeam ) 
outputChatBox ( "(source) needs a taxi", taxidriver ) 
  
Debug - Expected element, got table 

How would I do this, cannot find any thing on wiki to do this.

And how would I define the person who did the command, using source gives me debug expected element got nil.

addCommandHandler ("taxi", taxiMessage)  
function taxiMessage () 
  

Wolf Inc Discord

Youtube channel
Github

Posted (edited)
  
addCommandHandler ("taxi",function(player) 
-- player is the source of the server-executed command 
outputChatBox ( "This is only seen by you", player ) 
  
  
taxidriver = getPlayersInTeam ( TaxiDriverTeam ) 
for i,drivers in ipairs (taxidriver) do --This gets all the players in the team 
outputChatBox ( "(source) needs a taxi", drivers) --This outputs to every player in the team 
end 
  
  
end) 

I've fused both funcions in the same command.

EDIT: Edited the code, it was wrong

Edited by Guest

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted

Two methods.

1.

  
local team = createTeam (...)  
outputChatBox ( "(source) needs a taxi", team ) 
  

2.

  
for _, v in pairs ( getPlayersInTeam ( team ) ) do 
      outputChatBox ( "(source) needs a taxi", v ) 
end 

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...