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.
SERV.ACCOUNT UNUSED DELETE x
SERV.ACCOUNT UNUSED x DELETE
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.
Try this:
PHP Code:
[FUNCTION deleteEmptyAccounts]
FOR 0 <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 0 <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.
(01-10-2015 06:03 AM)darksun84 Wrote: [ -> ]...
Thanks you, i was some edited, but function some broken
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.
(01-10-2015 06:03 AM)darksun84 Wrote: [ -> ]Try this:
PHP Code:
[FUNCTION deleteEmptyAccounts]
FOR 0 <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 0 <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
ihhh
