Panda Posted December 23, 2014 Share Posted December 23, 2014 Hello everyone, Sorry for disturbing you, but I made a new script when a crim enter to a col A sound will play, but it play for the whole server,i want it to be play only for cops. This is my script, function PlayMusic(element,sound) if element and getElementType(element) == "player" then local team = getPlayerTeam(element) if team and not (copTeams[getTeamName(team)]) then -- the player who entered jail area isn't a cop triggerClientEvent("playMyMusic", getRootElement(), copTeams) end end end addEventHandler("onColShapeLeave", prisonCol, PlayMusic) As you can see when a crim hits the col the sound will play, but when the cop hits the col nothing will happen, the problem is that i want to lock the sound to copTeams only. I really need help, thanks for reading. Cheers. Link to comment
manawydan Posted December 23, 2014 Share Posted December 23, 2014 change getRootElement() to your players cop Link to comment
Tomas Posted December 23, 2014 Share Posted December 23, 2014 function PlayMusic(element,sound) if element and getElementType(element) == "player" then local team = getPlayerTeam(element) if team --[[and not (copTeams[getTeamName(team)])]] then -- the player who entered jail area isn't a cop triggerClientEvent("playMyMusic", getRootElement(), copTeams) end end end addEventHandler("onColShapeLeave", prisonCol, PlayMusic) Link to comment
Panda Posted December 23, 2014 Author Share Posted December 23, 2014 @ Manawdyan, it won't work like that, i already tested it. @Tomas, i tested it but still, the music plays for the whole server not only for cops. Still need help Link to comment
manawydan Posted December 23, 2014 Share Posted December 23, 2014 try this function PlayMusic(element,sound) if element and getElementType(element) == "player" then local team = getPlayerTeam(element) if team then local cops = getPlayersInTeam(team) triggerClientEvent(cops,"playMyMusic", element, copTeams) end end end addEventHandler("onColShapeLeave", prisonCol, PlayMusic) or function PlayMusic(element,sound) if element and getElementType(element) == "player" then local team = getPlayerTeam(element) if team and team == "cops" then triggerClientEvent(element,"playMyMusic", element, copTeams) end end end addEventHandler("onColShapeLeave", prisonCol, PlayMusic) Link to comment
Panda Posted December 23, 2014 Author Share Posted December 23, 2014 nope still.. function PlayMusic(element,sound) if element and getElementType(element) == "player" then local team = getPlayerTeam(element) if team and not (copTeams[getTeamName(team)])]] then -- the player who entered jail area isn't a cop triggerClientEvent("playMyMusic", getRootElement(), copTeams) end end end addEventHandler("onColShapeLeave", prisonCol, PlayMusic) It should be like this one .. When the cops hit the marker nothing will play but when a crim hits the marker it will play, the problem is the sound plays for all the server, everyone can hear it, i just want to lock the sound to cops.. Help please, thanks. Link to comment
Panda Posted December 23, 2014 Author Share Posted December 23, 2014 Well, Done i fixed it D: damn. Thanks for helping anyway. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now