WelCome Posted March 7, 2018 Share Posted March 7, 2018 function timer(player) if getPlayerTeam(player)==team then print("Work") local losuj = math.random(1,3) if losuj==1 then givePlayerMoney(player,2000) elseif losuj==2 then setPedArmor(player,100) setElementHealth(player,100) elseif losuj==3 then giveWeapon(player,36,3) end end end setTimer(timer,2000,0,source) DebugScript 3 : Bad argument 'getPlayerTeam' [Expected player at argument 1,got nil] Link to comment
Captain Cody Posted March 7, 2018 Share Posted March 7, 2018 May you please put this in a properly formatted lua bracket? After you do that I'll be glad to help you. Link to comment
Mega9 Posted March 7, 2018 Share Posted March 7, 2018 (edited) Because you are passing an invalid player element with setTimer(timer,2000,0,source) where is 'source' player element defined? And that's not the only thing wrong in your code. Edited March 7, 2018 by Mega9 Link to comment
WelCome Posted March 7, 2018 Author Share Posted March 7, 2018 (edited) 15 minutes ago, Mega9 said: Because you are passing an invalid player element with setTimer(timer,2000,0,source) where is 'source' player element defined? And that's not the only thing wrong in your code. I changed it, but it does not work sry for bad english i use google translator Edited March 7, 2018 by WelCome Link to comment
Mega9 Posted March 7, 2018 Share Posted March 7, 2018 Then I suggest that you find a section that is designated for your region and ask there: https://forum.multitheftauto.com/forum/94-other-languages/ Link to comment
WelCome Posted March 7, 2018 Author Share Posted March 7, 2018 You can't help me here ? Link to comment
Saml1er Posted March 7, 2018 Share Posted March 7, 2018 Can you please explain what you are trying to achieve? Link to comment
Storm-Hanma Posted March 8, 2018 Share Posted March 8, 2018 dude get player team means valid team not a 'team' correct code will be like these if ( getTeamName(getPlayerTeam(thePlayer)) == "Staff" ) then it will work now take a look! Link to comment
NeXuS™ Posted March 8, 2018 Share Posted March 8, 2018 @Khadeer143 it won't work. This script isn't passing a valid player element. Link to comment
Mahlukat Posted March 8, 2018 Share Posted March 8, 2018 can u try this ? function timer(player) -- if getPlayerTeam(player)==team then print("Work") local losuj = math.random(1,3) if losuj==1 then givePlayerMoney(player,2000) elseif losuj==2 then setPedArmor(player,100) setElementHealth(player,100) elseif losuj==3 then giveWeapon(player,36,3) end --end end function allPlayers() for i,player in pairs(getElementsByType("player")) do if getPlayerTeam(player)==team then -- check timer(player) end end setTimer(allPlayers,2000,1) end allPlayers() 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