Jump to content

getAccounts() table!


X-Dray

Recommended Posts

Posted

Okay so,

  
function onAccountCreationAttempt(user,pass) 
    for i,account in ipairs(getAccounts()) do 
        if getAccountData(account,"bank.user") == user and account~= getPlayerAccount(source) then 
            triggerClientEvent(source,"onCreationFail",source) 
            outputChatBox("YO") -- added it just to test as there was nothing happening 
        elseif getAccountData(account,"bank.user") ~= user then 
            triggerClientEvent(source,"onCreationSuccess",source) 
            setAccountData(getPlayerAccount(source),"bank.user",user) 
        end 
    end 
end 
addEvent("onAccountCreationAttempt",true) 
addEventHandler("onAccountCreationAttempt",root,onAccountCreationAttempt) 
  

Anyway, what happens is;

the script outputs "YO" and triggers the both events and it sets the account data of the player to "user"

I mean, if there is an account with "bank.user" data as "user" it does say "YO" but in the same time it change my account data "bank.user" into "user" as well, and now two users have the same user.

I know why this happens, It is because when it says "YO", it says so because the script found an account with similar data. (and here it was suposed to stop), Anyway, The script calls (triggerClientEvent(source,"onCreationSuccess",source)) function and change my account data because it found another accounts with bank.user data not as "user"

Any solutions? Like to stop the script whenever it does find the data "bank.user" == user on one server account?

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...