Jump to content

Need help with finding players


tigerman

Recommended Posts

Posted

ArmyTeam = {} 
  
function NewTeam() 
ArmyTeam[source] = true 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), NewTeam ) 
  
function OldTeam() 
ArmyTeam[source] = false 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), OldTeam ) 
  
function FindAllArmyTeamPlayers() 
for k,v in pairs(ArmyTeam) do 
local money = getPlayerMoney(v) 
setPlayerMoney ( v, money+500 ) 
end 
end 

The code should give 500 extra cash to all players who are in army when someone dies

Posted

1. You didn't say what happen it doesn't work? any errors or warnings?

2. Well, why you need to make a table with the army players when we got an awesome team system.

https://wiki.multitheftauto.com/wiki/Ser ... _functions

3. we have a function "givePlayerMoney" so you dont have to get the players money and add on it.

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

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