Jump to content
  • 0

How to set can't input same values in NPC?


Lilori

Question


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  8
  • Reputation:   1
  • Joined:  07/23/17
  • Last Seen:  

Hi rA community!

I want to ask how to set an input NPC that can't duplicate same values (number only) and write it on sql?

For example player A already input number 10, then when player B tries to input number 10, NPC can't proceed it.

Thank you!

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  232
  • Reputation:   86
  • Joined:  06/30/18
  • Last Seen:  

mes "Pick your number!";
next;
input(.@number);
.@rowCount = query_sql("SELECT `number` FROM numberdb WHERE `number` = " + .@number + ";");
if(.@rowCount == 1) {
    mes "This number is already used. Try again.";
    close;
}
query_sql("INSERT INTO numberdb (`number`) VALUES (" + .@number + ");");

 

Edited by Winterfox
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  8
  • Reputation:   1
  • Joined:  07/23/17
  • Last Seen:  

On 7/29/2023 at 11:47 PM, Winterfox said:
mes "Pick your number!";
next;
input(.@number);
.@rowCount = query_sql("SELECT `number` FROM numberdb WHERE `number` = " + .@number + ";");
if(.@rowCount == 1) {
    mes "This number is already used. Try again.";
    close;
}
query_sql("INSERT INTO numberdb (`number`) VALUES (" + .@number + ");");

 

omg that's works like a charm! thank you! 😄

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