Jump to content
  • 0

Can someone correct this script?


trizzy

Question


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  92
  • Reputation:   2
  • Joined:  01/04/15
  • Last Seen:  

	if (query_sql("SELECT `name` FROM `char` WHERE `name` = '"+escape_sql(.@new$)+"'")) {
        mes .NPC$;
        mes "This name already exists";
        close;
    }

The script that i found is working fine, but whenever i put this code, event the "Name" is available it keeps telling me

"This name already exists". can someone  correct it?

Thank You.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  92
  • Reputation:   2
  • Joined:  01/04/15
  • Last Seen:  

 

I believe query_sql is returning -1 if nothing was found. I'm not sure if this was changed in the default rAthena or just some other server I've encountered it before, but personally I think it's dumb. Anyways... 

if ( query_sql( "SELECT `name` FROM `char` WHERE `name` = '"+escape_sql(.@new$)+"'", .@name$ ) <= 0 ) {

is not working too. But i found a Solution from the script that i posted i just change the .@new$ into .@name$ and it works. here where i found http://www.eathena.ws/board/lofiversion/index.php/t265846.htmlso this topic is closed. [sOLVED]

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

I believe query_sql is returning -1 if nothing was found. I'm not sure if this was changed in the default rAthena or just some other server I've encountered it before, but personally I think it's dumb. Anyways... 

if ( query_sql( "SELECT `name` FROM `char` WHERE `name` = '"+escape_sql(.@new$)+"'", .@name$ ) <= 0 ) {
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

 

is not working too. But i found a Solution from the script that i posted i just change the .@new$ into .@name$ and it works. here where i found http://www.eathena.ws/board/lofiversion/index.php/t265846.htmlso this topic is closed. [sOLVED]

 

 

Actually I was going to suggest that but you didn't give me enough of the code to work with. Next time paste full code and what emulator you're using so the problem can be resolved more effectively. Otherwise you're just wasting our time, thank you!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  92
  • Reputation:   2
  • Joined:  01/04/15
  • Last Seen:  

 

 

is not working too. But i found a Solution from the script that i posted i just change the .@new$ into .@name$ and it works. here where i found http://www.eathena.ws/board/lofiversion/index.php/t265846.htmlso this topic is closed. [sOLVED]

 

 

Actually I was going to suggest that but you didn't give me enough of the code to work with. Next time paste full code and what emulator you're using so the problem can be resolved more effectively. Otherwise you're just wasting our time, thank you!

 

Ohh sorry i thought knew the problem when you comment about what i'm asking. sorry my bad ,but anyway thanks for your appreciation.

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