Gtagasje Posted October 16, 2011 Share Posted October 16, 2011 I got a script for paycheck on team ect. but it shows the folowing error message in console : "WARNING: Core/copspaycheck.lua:2: Bad argument @ 'getPlayersInTeam'." and: "ERROR: Core/copspaycheck.lua:3: bad argument #1 to 'ipairs' (table expected, got boolean)" I don't know how to fix those things.. This is the script: function allPlayersPayDay() local allPlayers = getPlayersInTeam( "Police" ) for index,value in ipairs(allPlayers) do givePlayerMoney ( value, 5000 ) outputChatBox ( "PayTime! You have been given 5K! Enjoy!", value ) end end function onResourceStart(thisResource) setTimer ( allPlayersPayDay, 1000, 0 ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), onResourceStart ) Regards, Gtagasje Link to comment
Castillo Posted October 16, 2011 Share Posted October 16, 2011 That's because you put a string as team, but it requires a team element. function allPlayersPayDay() local allPlayers = getPlayersInTeam( getTeamFromName( "Police" ) ) for index,value in ipairs(allPlayers) do givePlayerMoney ( value, 5000 ) outputChatBox ( "PayTime! You have been given 5K! Enjoy!", value ) end end function onResourceStart(thisResource) setTimer ( allPlayersPayDay, 1000, 0 ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), onResourceStart ) Link to comment
Gtagasje Posted October 16, 2011 Author Share Posted October 16, 2011 Ahh, now I get it Thank you again 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