Thread Rating:
- 0 Votes - 0 Average
- 1
- 2
- 3
- 4
- 5
Find by name
|
Author |
Message |
Dullais
Journeyman
Posts: 65
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Feb 2013
Reputation: 0
|
Find by name
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 ?
|
|
03-13-2013 10:55 PM |
|
|
Mordaunt
Super Moderator
Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35
|
RE: Find by name
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....wnload=223
(This post was last modified: 03-15-2013 05:59 AM by Mordaunt.)
|
|
03-14-2013 05:59 AM |
|
|
Dullais
Journeyman
Posts: 65
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Feb 2013
Reputation: 0
|
RE: Find by name
(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
Anyway, Thanks for advise guys !
|
|
03-14-2013 07:03 AM |
|
|
User(s) browsing this thread: 3 Guest(s)