SphereCommunity
How to delete accounts without charters? - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: How to delete accounts without charters? (/Thread-How-to-delete-accounts-without-charters)



How to delete accounts without charters? - Russian - 01-09-2015 07:02 PM

Hello!
I have very more accounts without charters. Please help me tho write this function, for delete all accounts without charters. Thank you!
I does not know how to write it.


RE: How to delete accounts without charters? - Gyros - 01-09-2015 07:30 PM

SERV.ACCOUNT UNUSED DELETE x
SERV.ACCOUNT UNUSED x DELETE


RE: How to delete accounts without charters? - Russian - 01-10-2015 02:25 AM

This function delete unused accounts.

This is not help if player was registered from site and have registration on forum of game.
And this function does not help with accounts, who registered some days ago and not created charters.


RE: How to delete accounts without charters? - darksun84 - 01-10-2015 06:03 AM

Try this:

PHP Code:
[FUNCTION deleteEmptyAccounts]
FOR 
<eval <serv.accounts> - 1>

 if <
serv.account.<dlocal._for>.chars> == 0
    serv
.log Preparing <serv.account.<dlocal._for>.name> for deletion..
    
args .= <serv.account.<dlocal._for>.name>,   
 endif
ENDFOR

FOR 
<eval <argv> - 1>
 
serv.log Deleting Account <argv[<dlocal._for>]>
 
account <argv[<dlocal._for>]> delete
ENDFOR
serv.account UPDATE 
Why two FOR ? Because if the account is deleted inside the first FOR, the serv.account is automatically reduced by 1, and this will cause problem with the first FOR loop condition (not noticeable with one empty account). I think it's possible to do that in a single loop by using while and a more strong condition check.


RE: How to delete accounts without charters? - Russian - 01-10-2015 06:16 PM

(01-10-2015 06:03 AM)darksun84 Wrote:  ...

Thanks you, i was some edited, but function some broken

[Image: 16522378585807002370.png]

Function find accounts without charters, but second loop have some error.

Code:
[FUNCTION DELETE_CLEAR_ACCOUNTS]
FOR 0 <EVAL <SERV.ACCOUNTS> - 1>
IF (<SERV.ACCOUNT.<dlocal._for>.chars> == 0) && (<ISEMPTY <SERV.ACCOUNT.<dlocal._for>.DTAG0.EMAIL>>)
SERV.LOG Preparing <SERV.ACCOUNT.<dlocal._for>.name> for deletion...
args .= <SERV.ACCOUNT.<dlocal._for>.name>,
ENDIF
ENDFOR

FOR 0 <EVAL <argv> - 1>
SERV.log Deleting ACCOUNT <argv[<dlocal._for>]>
ACCOUNT <argv[<dlocal._for>]> delete
ENDFOR
SERV.ACCOUNT UPDATE

Than you!
I was got account list, who have not charters and delete them.


RE: How to delete accounts without charters? - XuN - 01-11-2015 02:04 AM

(01-10-2015 06:03 AM)darksun84 Wrote:  Try this:

PHP Code:
[FUNCTION deleteEmptyAccounts]
FOR 
<eval <serv.accounts> - 1>

 if <
serv.account.<dlocal._for>.chars> == 0
    serv
.log Preparing <serv.account.<dlocal._for>.name> for deletion..
    
args .= <serv.account.<dlocal._for>.name>,   
 endif
ENDFOR

FOR 
<eval <argv> - 1>
 
serv.log Deleting Account <argv[<dlocal._for>]>
 
account <argv[<dlocal._for>]> delete
ENDFOR
serv.account UPDATE 
Why two FOR ? Because if the account is deleted inside the first FOR, the serv.account is automatically reduced by 1, and this will cause problem with the first FOR loop condition (not noticeable with one empty account). I think it's possible to do that in a single loop by using while and a more strong condition check.

Use reverse loop:
Code:
for <eval <serv.accounts>-1> 0
serv.log Deleting account <dlocal._for> (<serv.account.<dlocal._for>.name>).
serv.account.<dlocal._for>.delete
endfor



RE: How to delete accounts without charters? - darksun84 - 01-11-2015 03:51 AM

ihhh Blush