Sign in to follow this  
MAD_DAD

Checking for certain names

Recommended Posts

I am looking into putting a script together to look at player names and to perform an action if criteria is true

I have pretty much done it but have one small problem

If I use the following script:

playername = self.name;
    if ( playername  == "È" )

and the player name has this character within the name it does not recognise it and won't perform the action I want.

but if the player name is just this one letter it works fine.

So my question is how do I get it to look at a name and if that name contains this character then it will perform the action I have set out.

Hope I am clear in what I ask

Cheers

MAD_DAD

Share this post


Link to post
Share on other sites

From the above mentioned line of code you are checking if the player name is "E" or not that's all. and it will not check for letter E in the player name.

you are asking about searching a character(letter) in a player name ? if so .. you need to get the player name which is a string and divide the string in to individual letters and put in to an array , and the check each letter by looping through array..

Share this post


Link to post
Share on other sites
4 hours ago, ultranewbie said:

From the above mentioned line of code you are checking if the player name is "E" or not that's all. and it will not check for letter E in the player name.

you are asking about searching a character(letter) in a player name ? if so .. you need to get the player name which is a string and divide the string in to individual letters and put in to an array , and the check each letter by looping through array..

Done and working cheers

Share this post


Link to post
Share on other sites

Look for the isSubStr() function. It checks to see if one string is part of another. Is 'player' part of 'playerone' for example. It will pass. However the other way around, is 'playerone' part of 'player', will fail.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this