Jump to content

Reset points


Memory

Recommended Posts

Hi,

Doesn't work this code (points don't reset).

addCommandHandler ( "resetpoints", 
    function ( ) 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
            setElementData ( player, "Points", 0 ) 
            local account = getPlayerAccount ( player ) 
            if isGuestAccount ( account ) then 
                setAccountData ( account, "Points", 0 ) 
            end 
        end 
    end 
) 

Please, can you are fix?

Link to comment
Guest Guest4401
Again problem with it.

Points is reseted for only a players, who is online.

It should reset points for all accounts?

addCommandHandler("resetpoints", 
    function() 
        for _,player in ipairs(getElementsByType'player') do 
            setElementData(player,"Points",0) 
        end 
        for _,account in ipairs(getAccounts()) do 
            setAccountData(account,"Points",0) 
        end 
    end 
) 

Link to comment
addCommandHandler ( "resetpoints", 
    function ( ) 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
            setElementData ( player, "Points", 0 ) 
        end 
        for i,v in ipairs(getAccounts()) do 
            setAccountData ( v, "Points", 0 ) 
        end 
    end 
) 

Edit:

Again problem with it.

Points is reseted for only a players, who is online.

It should reset points for all accounts?

addCommandHandler("resetpoints", 
    function() 
        for _,player in ipairs(getElementsByType'player') do 
            setElementData(player,"Points",0) 
        end 
        for _,account in ipairs(getAccounts()) do 
            setAccountData(account,"Points",0) 
        end 
    end 
) 

you were faster :D btw will error in your code

line 3

Link to comment

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...