Aristates Posted October 13, 2015 Share Posted October 13, 2015 Where The Problems ? debug say's ; :6 attempt to compare number with nil. addEvent("AristatesOnServer", true) addEventHandler("AristatesOnServer", getRootElement(), function() local Aristates = getPlayerAccount(source) if Aristates then if tonumber(getAccountData(Aristates,"cash")) >= 50000 then setAccountData(Aristates,"cash",(tonumber(getAccountData(Aristates,"cash")) or 0)-50000) else outputChatBox ( "Yetersiz Para", source, 255, 255, 255, true ) end end end ) Link to comment
Fist Posted October 13, 2015 Share Posted October 13, 2015 if it is nil then player account data "cash" is nil. if you want to dont give error until he gets actual money and saves it then use this code addEvent("AristatesOnServer", true) addEventHandler("AristatesOnServer", getRootElement(), function() local Aristates = getPlayerAccount(source) if Aristates then if tonumber(getAccountData(Aristates,"cash")) == nil then return end if tonumber(getAccountData(Aristates,"cash")) >= 50000 then setAccountData(Aristates,"cash",(tonumber(getAccountData(Aristates,"cash")) or 0)-50000) else outputChatBox ( "Yetersiz Para", source, 255, 255, 255, true ) end end end ) Link to comment
Al3grab Posted October 13, 2015 Share Posted October 13, 2015 just add the 'or 0' next to the account data check Link to comment
jingzhi Posted November 19, 2015 Share Posted November 19, 2015 Where The Problems ? debug say's ; :6 attempt to compare number with nil. addEvent("AristatesOnServer", true) addEventHandler("AristatesOnServer", getRootElement(), function() local Aristates = getPlayerAccount(source) if Aristates then if tonumber(getAccountData(Aristates,"cash")) >= 50000 then setAccountData(Aristates,"cash",(tonumber(getAccountData(Aristates,"cash")) or 0)-50000) else outputChatBox ( "Yetersiz Para", source, 255, 255, 255, true ) end end end ) AccountData of "cash" is nil, maybe you didnt set it correctly 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