Lilori Posted July 29, 2023 Posted July 29, 2023 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! Quote
0 Winterfox Posted July 29, 2023 Posted July 29, 2023 (edited) 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 July 29, 2023 by Winterfox 1 Quote
0 Lilori Posted July 31, 2023 Author Posted July 31, 2023 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! Quote
Question
Lilori
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!
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.