Ryan123 Posted February 10, 2016 Posted February 10, 2016 Hello, I've here one trouble. When I'm alone, this function is working fine, but when someone login, need only more 1, my chat will be spammed. Someone could help me please?: local civilianTeam = false function messageForCivilians (name, en, c, m, b, z) for i, plr in ipairs(getElementsByType ( "player" )) do if (isPlayerInTeam(plr, "Civilian Workers")) and (civilianTeam == false) then civilianTeam = true if (not m) and (not b) and (not z) then outputChatBox("State Official "..name.." is hosting a event "..en, plr) outputChatBox("Clue: "..c, plr) else outputChatBox("State Official "..name.." is hosting a event "..en, plr) outputChatBox("Location: "..z..", "..c, plr) setElementVisibleTo(m, plr, true) setElementVisibleTo(b, plr, true) end elseif (not isPlayerInTeam(plr, "Civilian Workers")) and (civilianTeam == true) then civilianTeam = false setElementVisibleTo(m, plr, false) setElementVisibleTo(b, plr, false) end end end ---- timer = setTimer(messageForCivilians,50,0,name, eventName, city, pMarker, pBlip, zone )
Bonus Posted February 11, 2016 Posted February 11, 2016 If the 1. player is in the team and the 2. player not it will get spamed. A setTimer with 50 ms is a bad idea, specifically with for ipairs getElementsByType.
Ryan123 Posted February 11, 2016 Author Posted February 11, 2016 So I'll set it for 1 second. If doesn't work, I'll post here again
Ryan123 Posted February 11, 2016 Author Posted February 11, 2016 Sorry for double post, but I'll provide the Screenshot. And I increased for 1 second.
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