Jump to content

Get amount of players on team and blacklisted words.


Xeno

Recommended Posts

function getCashFromTeamPlayers(team) 
    local amount = 0 
    if isElement(team) and getElementType(team) == "team" then 
        for i, v in ipairs(getPlayersInTeam(team)) do 
            amount = amount + (getPlayerMoney(v) or 0) 
        end 
    end 
    return amount 
end 

2nd, what do you mean by that?

Link to comment
local g_pCensoredWords = 
{ 
    "bitch", 
    "gay"; 
}; 
  
addEventHandler( "onPlayerChat", root, 
    function( szMsg ) 
        for index, word in ipairs( g_pCensoredWords ) do 
            if ( szMsg:find( word, 0 ) ) then 
                szMsg = szMsg:gsub( word, "****" ); 
                szMsg = string.format( "%s: %s", getPlayerName( source ), szMsg ); 
  
                cancelEvent(); 
                outputChatBox( szMsg, root, 255, 255, 255, true ); 
            end 
        end 
    end 
) 

Not tested but should work.

Link to comment
local g_pCensoredWords = 
{ 
    "bitch", 
    "gay"; 
}; 
  
addEventHandler( "onPlayerChat", root, 
    function( szMsg ) 
        for index, word in ipairs( g_pCensoredWords ) do 
            if ( szMsg:find( word, 0 ) ) then 
                szMsg = szMsg:gsub( word, "****" ); 
                szMsg = string.format( "%s: %s", getPlayerName( source ), szMsg ); 
  
                cancelEvent(); 
                outputChatBox( szMsg, root, 255, 255, 255, true ); 
            end 
        end 
    end 
) 

Not tested but should work.

Why do you use idiotic variable names and whatsup with the ";"?

Link to comment
Why do you use idiotic variable names and whatsup with the ";"?

It's not "idiotic", it's called hungarian notation: http://en.wikipedia.org/wiki/Hungarian_notation - Almost all programmers use it.

I use ";" because I want so, any problems? I can script whatever way I want.

+1 Anderl, although you shouldn't waste any time on Sebbe for future reference since he fails at scripting anyway.

Let's see how long it'll take for Símon to delete this post.

Link to comment

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