You are asking because of a DarkRP Server, correct?
[lua]
if CLIENT then print("run it as server") return end
hook.Add("PlayerCanHearPlayersVoice", "hearplayer", function(listener, talker)
if listener:Team() == talker:Team() then
return true, false
end
end )
[/lua]
place in an autorun lua server file
[QUOTE=tyguy;49424260][lua]
if CLIENT then print("run it as server") return end
hook.Add("PlayerCanHearPlayersVoice", "hearplayer", function(listener, talker)
if listener:Team() == talker:Team() then
return true, false
end
end )
[/lua]
place in an autorun lua server file[/QUOTE]
Wouldn't that do it for all players, so that they had to be on the same team? I think he/she might have been wanted something more like this. Please correct me if I'm wrong.
[CODE]
if CLIENT then print("run it as server") return end
hook.Add("PlayerCanHearPlayersVoice", "hearplayer", function(listener, talker)
if listener:Team() == TEAM_POLICE && talker:Team() == TEAM_POLICE then
return true, false
end
end )
[/CODE]
what i want to use it for is my starwars server that has multiple teams like 14 teams for comms link. how would i go to set that up???
Get the teams, compare values, return true, false
Or judging about how much do you know about lua...Just hire someone at scriptfodder and don't worry about this
[lua]if CLIENT then print("run it as server") return end
local teams =
{
TEAM_POLICE,
}
hook.Add("PlayerCanHearPlayersVoice", "hearplayer", function(listener, talker)
for k,v in pairs(teams) do
if talker:Team() == v then
local teamIs = v
if listener:Team() == teamIs then
return true, false
end
end
end
end )
[/lua]
not the most efficient way but it will do what you want, edit the table with whatever jobs you want to communicate with eachother
He'll ask about where he should put this and how to make this work...
yes you are correct because unlike lazy people i wanna learn this stuff :D so where do i put it and how do i make it work??? :D
Oh no...That's not how do you learn stuff...Go to wiki.garrysmod.com and look for lua tutorials, you don't learn nothing with asking "Where do i put it and how do i make it work"
ya you do buddy. Once shown once you will get it the next so why do you reply about this stuff anyways? just give me the info or not simple as that. I thank everyone that helped me cause i learn stuff. Dont reply if your gonna be a cock munch :D have a nice day though!
You haven't asked a single question about actually writing code. You've only begged for people to spoonfeed you results. This is not how you learn stuff.
Stop being a cock tomato
[sp]Seriously, lastly for new server owners if you don't code for free, automatly this turns you into a cock for some reason[/sp]
Sorry, you need to Log In to post a reply to this thread.