Jump to content
  • 0

Check Character Prefix


nobukadnezar

Question


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  163
  • Reputation:   7
  • Joined:  01/07/12
  • Last Seen:  

Hi there, it's me again lol /pat

 

Is there a code for check character prefix like "PRE Charname"

 

npc will check if the character name have prefix PRE, then they will pass.

 

Thank you

Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Try this : 

explode(.@pre$, strcharinfo(0), " ");
dispbottom "Prefix : " +.@pre$[0];
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

if( compare(strcharinfo(0),"PRE") ){ do this } else { end; }

However, this will only check to see if they have those 3 letters in there name. To check to see if they are the FIRST 3 letters we need to do this:

if( charat( strcharinfo(0), 0 ) == "P" && charat( strcharinfo(0), 1 ) == "R" && charat( strcharinfo(0), 2 ) == "E" ){ do this } else { end; }

The above will check to see if the FIRST 3 letters of the players name is PRE. Keep in mind though, it is checking for Case Sensitive PRE. There is a way to bypass that, but I didn't put that in since your looking for PRE specifically.

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

or

if ( substr( strcharinfo(0),0,2 ) == "PRE" )

or

if ( strpos( strcharinfo(0),"PRE",0 ) == 0 )

to check the 3 first letters

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

That will work as well. I forgot those commands are there >.>;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  163
  • Reputation:   7
  • Joined:  01/07/12
  • Last Seen:  

Wow guys thanks for ur reply. I will try after work /pat

Link to comment
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
Answer this question...

×   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.

×
×
  • Create New...