Jump to content

Payday for someteam [HELP]


Sande

Recommended Posts

Hey, i try to make payday for only team. How i can code the message only for the team, can someode code it? if there are something wrong please fix it thaanks :) Im new in scripting.

- Sande

  
----Sande 
  
function teamPayday() 
  local allPlayers = getElementsByType("player") 
  for index,value in ipairs(allPlayers) do 
  if getTeamName(getPlayerTeam(value)) == "Police" then  
      givePlayerMoney ( value, 2000 )  
end 
    outputChatBox ("   ------Police-bonus------  ", value, 255, 255, 255, false) 
    outputChatBox ("|--------------------------|", value, 0, 100, 180, false) 
    outputChatBox ("+2000$", value, 0, 255, 0, false) 
    outputChatBox ("|--------------------------|", value, 0, 100, 180, false) 
  end 
end 
  
function onResourceStart(thisResource) 
  setTimer ( teamPayday, 990000, 0 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), onResourceStart ) 
  

Link to comment
  
function teamPayday( src) 
  local allPlayers = getElementsByType("player") 
  for index,value in ipairs(allPlayers) do 
  if getTeamName(getPlayerTeam(value)) == "Police" then 
      givePlayerMoney ( value, 2000 ) 
end 
    outputChatBox ("   ------Police-bonus------  ", value, src, 255, 255, 255, false) 
    outputChatBox ("|--------------------------|", value, src, 0, 100, 180, false) 
    outputChatBox ("+2000$", value, src, 0, 255, 0, false) 
    outputChatBox ("|--------------------------|", value, src, 0, 100, 180, false) 
  end 
end 
  
function onResourceStart(thisResource) 
  setTimer ( teamPayday, 990000, 0 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), onResourceStart ) 
  

Try this one

Link to comment

This is works, but the message shows everyone, i wanna it for team, if team Police, then this message show only police.

  
  
function teamPayday( src) 
  local allPlayers = getElementsByType("player") 
  for index,value in ipairs(allPlayers) do 
  if getTeamName(getPlayerTeam(value)) == "Police" then 
      givePlayerMoney ( value, 2000 ) 
end 
    outputChatBox ("   ------Police-bonus------  ", value, src, 255, 255, 255, false) 
    outputChatBox ("|--------------------------|", value, src, 0, 100, 180, false) 
    outputChatBox ("+2000$", value, src, 0, 255, 0, false) 
    outputChatBox ("|--------------------------|", value, src, 0, 100, 180, false) 
  end 
end 
  
function onResourceStart(thisResource) 
  setTimer ( teamPayday, 990000, 0 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), onResourceStart ) 
  

Link to comment

Try this

function teamPayday ( ) 
    for _, players in ipairs ( getPlayersInTeam ( getTeamFromName ( "Police" ) ) ) do 
        if ( players ) then 
        givePlayerMoney ( players, 2000 ) 
        outputChatBox ("   ------Police-bonus------  ", players, 255, 255, 255, false) 
        outputChatBox ("|--------------------------|", players, 0, 100, 180, false) 
        outputChatBox ("+2000$", players, 0, 255, 0, false) 
        outputChatBox ("|--------------------------|", players, 0, 100, 180, false) 
        end 
    end 
end 
  
function onResourceStart(thisResource) 
  setTimer ( teamPayday, 990000, 0 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), onResourceStart ) 

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