SphereCommunity
Find by name - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Find by name (/Thread-Find-by-name)

Pages: 1 2


Find by name - Dullais - 03-13-2013 10:55 PM

Hello everyone !
Can anybody tell me how to find charter by name ?
I don't mean goname.
I have discovered that people registering on shard can use the same name, so there can be 2 guys(or girls) with the same name and that is not acceptable for me. So i was wondering mby there is some way of not allowing to use the name that is already being used by another person ?
I was thinking about making script, that forces player Change name after loging in the first time (like dialog with textentry) that checks for given name and changes it if the name is not used by anyone) but i don't really know how to make this work ? I guess i could use FORCHARS but i have heard it is a very laggy thing to do for server.
Besides .goname already uses function like i need, so there must be a way !
Can anybody help me please ? Smile


RE: Find by name - Shaklaban - 03-13-2013 11:18 PM

using mysql is best solution for this.


RE: Find by name - Dullais - 03-13-2013 11:20 PM

(03-13-2013 11:18 PM)Shaklaban Wrote:  using mysql is best solution for this.

I was afraid of that Big Grin I really was...


RE: Find by name - admin phoenix - 03-13-2013 11:50 PM

using f_onchar_create and make a loop for the existing char on the account?
btw I am doing it via mysql because we create the char via homepage *g*


RE: Find by name - darksun84 - 03-13-2013 11:59 PM

Mysql apart, using a loop on f_onchar_create it's the only solution i think .

Also consider that character creation doesn't happen very often, so the "lag impact" of the possible implementation shouldn't affect much the server's performance.


RE: Find by name - Dullais - 03-14-2013 12:10 AM

(03-13-2013 11:59 PM)darksun84 Wrote:  Mysql apart, using a loop on f_onchar_create it's the only solution i think .

Also consider that character creation doesn't happen very often, so the "lag impact" of the possible implementation shouldn't affect much the server's performance.

I have heard that if you got 100+ clients online (man can dream Big Grin ) it can freez the server up to 20 seconds. Is that right ?


RE: Find by name - darksun84 - 03-14-2013 12:15 AM

yea possible, considering that if you have 100 clients online , your total character player base will be much higher than 100 Tongue


RE: Find by name - Staff_Stanic - 03-14-2013 05:40 AM

try with
Code:
FOR 0 <eval <SERV.ACCOUNTS>-1>



RE: Find by name - Mordaunt - 03-14-2013 05:59 AM

I had a thought....

It would involve recording player names as they are created (and deleting the record of them as they are deleted) but...

Code:
[FUNCTION f_onchar_create]
if <LIST.player_names.COUNT>
    if <LIST.player_names.FINDELEM <src.name>>
        src.sysmessage The name you have chosen is not available
        src.sysmessage Please chose a different name
        src.dialog d_name_change
    else
        LIST.player_names.ADD <src.name>
    endif
else
    LIST.player_names.ADD <src.name>
endif

[FUNCTION f_onchar_delete]
LIST.player_names.<LIST.player_names.FINDELEM <src.name>>.REMOVE

This is COMPLETELY untested, and obviously on a pre-existing server you would have to write and run a function to gather all player names and add them into the list.
I'm not even saying this method would be effective or efficient, I just started playing with lists properly and wondered if this might be viable.


Made it anyway: http://forum.spherecommunity.net/sshare.php?download=223


RE: Find by name - Dullais - 03-14-2013 07:03 AM

(03-14-2013 05:59 AM)Mordaunt Wrote:  I had a thought....

It would involve recording player names as they are created (and deleting the record of them as they are deleted) but...

Code:
[FUNCTION f_onchar_create]
if <LIST.player_names.COUNT>
    if <LIST.player_names.FINDELEM <src.name>>
        src.sysmessage The name you have chosen is not available
        src.sysmessage Please chose a different name
        src.dialog d_name_change
    else
        LIST.player_names.ADD <src.name>
    endif
else
    LIST.player_names.ADD <src.name>
endif

[FUNCTION f_onchar_delete]
LIST.player_names.<LIST.player_names.FINDELEM <src.name>>.REMOVE

This is COMPLETELY untested, and obviously on a pre-existing server you would have to write and run a function to gather all player names and add them into the list.
I'm not even saying this method would be effective or efficient, I just started playing with lists properly and wondered if this might be viable.

Looks interesting, it could and should work (i think) mby a little bit of tweaking and it's good to go.
But on second thought, i will make mysql database because i'am going to make serious connections with my webpage and list of all players will be there one way or another, so i think i will make this one with mysql later, when web page and server will be ready Smile
Anyway, Thanks for advise guys ! Smile