cheez3d Posted October 14, 2013 Share Posted October 14, 2013 (edited) I have a little problem with this code right here. What I'm trying to do is get this script go trough all the accounts that are on the server and get the string contained by the "name" data for each account. I want this for a name checker. If the name already exists in one of the server's accounts then the player will have to choose other name. But I can't get this script working. I can't find a way to get the account name to check the data for form getAccounts(). I hope you understand what im trying to accomplish. Alright then. Here's the code. Any help would be appreciated. addEvent("checkIfNameTaken",true) addEventHandler("checkIfNameTaken",getRootElement(),function() for i,account in ipairs (getAccounts()) do checkedAccountName = getAccountData(getAccount(account),"name") if checkedAccountName == thisAccountName then triggerClientEvent("showErrorOutputNameTaken",getRootElement()) end end end ) Edited March 29, 2014 by Guest Link to comment
myonlake Posted October 14, 2013 Share Posted October 14, 2013 getAccounts() returns a table with accounts, you are trying to getAccount() an account. addEvent("checkIfNameTaken", true) addEventHandler("checkIfNameTaken", root, function(thisAccountName) for _,account in ipairs(getAccounts()) do if (tostring(getAccountData(account, "name")) == thisAccountName) then triggerClientEvent("showErrorOutputNameTaken", root) break end end end ) 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