Jump to content

[HELP]Spam at my chatbox


Ryan123

Recommended Posts

Posted

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 ) 

Posted

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.

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