iPot Posted June 17, 2009 Share Posted June 17, 2009 Hey all, I got this error bad argument in line 3. Can anyone help me? Just started today with LUA function GiveMoney( thePlayer, reward, receiver ) if ( receiver ) and ( receiver ~= thePlayer ) then givePlayerMoney ( receiver, 10000 ) else outputChatBox("Syntax error: /reward <receiver>", thePlayer, 255, 0, 34, false ) end end addCommandHandler( "reward", GiveMoney ) Link to comment
robhol Posted June 17, 2009 Share Posted June 17, 2009 Receiver is either a string or nil, givePlayerMoney takes a player element. use getPlayerFromNick. function GiveMoney( thePlayer, reward, receiverName ) local receiver = getPlayerFromNick(receiverName) if ( receiver ) and ( receiver ~= thePlayer ) then givePlayerMoney ( receiver, 10000 ) else outputChatBox("Syntax error: /reward <receiver>", thePlayer, 255, 0, 34, false ) end end addCommandHandler( "reward", GiveMoney ) 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