Jump to content
  • 0
Sign in to follow this  
tmav94

Help me with MySql + Scripts + Restrictions.

Question

I want to prevent that the same player to open a multiples instance of an NPC in different account, tracking by ip [eg]...

 

 

I try many things to do this work, but whitout sucess.

 

Let explain...
When a player touch on specific npc, this send the IP to a MySql Table.
if he try to access the same npc in another account, the npc will say that he dont have permission while the another account instance is open.
 
How this npc will do that?
He (npc) will get with query_sql the IP and Name of character that initialize the dialog with npc.


Anyone know some easyway to do that? I unfortunately do not know.
Edited by tmav94

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0
if (query_sql("SELECT login.account_id FROM login LEFT JOIN `char` ON login.account_id=`char`.account_id WHERE login.last_ip=(SELECT last_ip FROM login WHERE account_id="+getcharid(3)+") AND `char`.online=1", .@account_id) > 1)
 
{
end script
}
else
{
run script
}

Share this post


Link to post
Share on other sites
  • 0

Hey, wait... I dont...Ok, listen...can you explain me the things that ill list in bold? I never see this structure of query's...
 

if (query_sql("SELECT login.account_id FROM login LEFT JOIN `char` ON login.account_id=`char`.account_id WHERE login.last_ip=(SELECT last_ip FROM login WHERE account_id="+getcharid(3)+") AND `char`.online=1", .@account_id) > 1)
 
{
end script
}
else
{
run script
}

Share this post


Link to post
Share on other sites
  • 0

it is selecting 'login' that got an 'online'(0 = offline) character from the same 'last_ip', since they are two different tables, it uses left join

Share this post


Link to post
Share on other sites
  • 0
In this case the script will prevent the player to access the npc while another accounts are connected...
Now, the script will unlock access when all other accounts on same ip are disconnected, is it?

Share this post


Link to post
Share on other sites
  • 0

it is selecting 'login' that got an 'online'(0 = offline) character from the same 'last_ip', since they are two different tables, it uses left join

 

 

Sorry for double posting, i think that my post will be merged with another one.

Edited by tmav94

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

×   Pasted as rich text.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.