xXMADEXx Posted December 6, 2012 Share Posted December 6, 2012 Hey guys, i have two problems with my script. 1. For some weird reason it dosn't come out in color. 2. Im not sure how to make it only viewable to teams Staff, Police, Military, Swat function PRbackup(player,cmd) local nick=getPlayerName(player) local name = getTeamName(getPlayerTeam(player)) if ( name == "Police" ) or ( name == "Staff" ) or ( name == "Military" ) or ( name == "SWAT" ) then outputChatBox("Police Dispatch: "..nick.." Needs Backup!",0,0,255) end end addCommandHandler("backup", PRbackup) function PRAir(player,cmd) local nick=getPlayerName(player) local name = getTeamName(getPlayerTeam(player)) if ( name == "Police" ) or ( name == "Staff" ) or ( name == "Military" ) or ( name == "SWAT" ) then outputChatBox("Police Dispatch: "..nick.." Air Support!",0,0,255) end end addCommandHandler("requestair", PRAir) function PRMili(player,cmd) local nick=getPlayerName(player) local name = getTeamName(getPlayerTeam(player)) if ( name == "Police" ) or ( name == "Staff" ) or ( name == "Military" ) or ( name == "SWAT" ) then outputChatBox("Police Dispatch: "..nick.." Military Support!",0,0,255) end end addCommandHandler("requestmilitary", PRMili) function PRSWAT(player,cmd) local nick=getPlayerName(player) local name = getTeamName(getPlayerTeam(player)) if ( name == "Police" ) or ( name == "Staff" ) or ( name == "Military" ) or ( name == "SWAT" ) then outputChatBox("Police Dispatch: "..nick.." SWAT Support!",0,0,255) end end addCommandHandler("requestswat", PRSWAT) Link to comment
Castillo Posted December 6, 2012 Share Posted December 6, 2012 To output a message with colors, you need to define to who you want to output it. function PRbackup ( player ) outputMessageToTeams ( "Police Dispatch: ".. getPlayerName ( player ) .." Needs Backup!", { "Police", "Staff", "Military", "SWAT" }, 0, 0, 255 ) end addCommandHandler ( "backup", PRbackup ) function PRAir ( player ) outputMessageToTeams ( "Police Dispatch: ".. getPlayerName ( player ) .." Air Support!", { "Police", "Staff", "Military", "SWAT" }, 0, 0, 255 ) end addCommandHandler ( "requestair", PRAir ) function PRMili ( player ) outputMessageToTeams ( "Police Dispatch: ".. getPlayerName ( player ) .." Military Support!", { "Police", "Staff", "Military", "SWAT" }, 0, 0, 255 ) end addCommandHandler ( "requestmilitary", PRMili ) function PRSWAT ( player, cmd ) outputMessageToTeams ( "Police Dispatch: ".. getPlayerName ( player ) .." SWAT Support!", { "Police", "Staff", "Military", "SWAT" }, 0, 0, 255 ) end addCommandHandler ( "requestswat", PRSWAT ) function outputMessageToTeams ( message, teams, r, g, b ) if ( message and teams and type ( teams ) == "table" and #teams > 0 ) then for _, player in ipairs ( getElementsByType ( "player" ) ) do for _, team in ipairs ( teams ) do if ( getPlayerTeam ( player ) == getTeamFromName ( team ) ) then outputChatBox ( message, player, r, g, b ) break end end end end end Haven't tested it. Link to comment
xXMADEXx Posted December 7, 2012 Author Share Posted December 7, 2012 To output a message with colors, you need to define to who you want to output it. function PRbackup ( player ) outputMessageToTeams ( "Police Dispatch: ".. getPlayerName ( player ) .." Needs Backup!", { "Police", "Staff", "Military", "SWAT" }, 0, 0, 255 ) end addCommandHandler ( "backup", PRbackup ) function PRAir ( player ) outputMessageToTeams ( "Police Dispatch: ".. getPlayerName ( player ) .." Air Support!", { "Police", "Staff", "Military", "SWAT" }, 0, 0, 255 ) end addCommandHandler ( "requestair", PRAir ) function PRMili ( player ) outputMessageToTeams ( "Police Dispatch: ".. getPlayerName ( player ) .." Military Support!", { "Police", "Staff", "Military", "SWAT" }, 0, 0, 255 ) end addCommandHandler ( "requestmilitary", PRMili ) function PRSWAT ( player, cmd ) outputMessageToTeams ( "Police Dispatch: ".. getPlayerName ( player ) .." SWAT Support!", { "Police", "Staff", "Military", "SWAT" }, 0, 0, 255 ) end addCommandHandler ( "requestswat", PRSWAT ) function outputMessageToTeams ( message, teams, r, g, b ) if ( message and teams and type ( teams ) == "table" and #teams > 0 ) then for _, player in ipairs ( getElementsByType ( "player" ) ) do for _, team in ipairs ( teams ) do if ( getPlayerTeam ( player ) == getTeamFromName ( team ) ) then outputChatBox ( message, player, r, g, b ) break end end end end end Haven't tested it. Thanks Castillo 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