Galactix Posted June 24, 2018 Share Posted June 24, 2018 Hello! I have scripted a pay command but I dont want guest accounts to be able to use it because they can send infinite amounts of money. I tried to put a condition with if that would make a guest account unable to use the command, but I get an error stating that condition is missing an "end". I tried to put dozens of end after or even just one but the result is always the same. addCommandHandler( 'pay', function( source,_,player,amount ) local find = findPlayer( player ) if find then local sourceAccount = getPlayerAccount ( playerSource ) local guestAccount = getPlayerAccount ( playerSource ) if (guestAccount == guest) then return else if amount then givePlayerMoney( find,tonumber( amount ) ) takePlayerMoney ( source, tonumber(amount) ) outputChatBox( '[Pay]:You transfered '..amount..'$ to '..getPlayerName( find ),source,255,0,0 ) outputChatBox( '[Pay]:You received '..amount..'$ from '..getPlayerName( source ),find,0,255,0 ) else outputChatBox( '[Pay]:/pay [playername][amount]!',source,255,0,0 ) end else outputChatBox( '[Pay]: You are not logged in!',source,255,0,0 ) end else outputChatBox( '[Pay]:Player not found!',source,255,0,0 ) end end end ) Link to comment
Moderators Patrick Posted June 24, 2018 Moderators Share Posted June 24, 2018 (edited) addCommandHandler( 'pay', function( source,_,player,amount ) local find = findPlayer( player ) if find then local sourceAccount = getPlayerAccount ( source ) local guestAccount = isGuestAccount ( sourceAccount ) if guestAccount then outputChatBox( '[Pay]: You are not logged in!',source,255,0,0 ) else if amount then givePlayerMoney( find,tonumber( amount ) ) takePlayerMoney ( source, tonumber(amount) ) outputChatBox( '[Pay]:You transfered '..amount..'$ to '..getPlayerName( find ),source,255,0,0 ) outputChatBox( '[Pay]:You received '..amount..'$ from '..getPlayerName( source ),find,0,255,0 ) else outputChatBox( '[Pay]:/pay [playername][amount]!',source,255,0,0 ) end end else outputChatBox( '[Pay]:Player not found!',source,255,0,0 ) end end) Edited June 24, 2018 by Patrick2562 1 Link to comment
Moderators Patrick Posted June 24, 2018 Moderators Share Posted June 24, 2018 You are welcome! 1 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