Help me with MySql + Scripts + Restrictions.

tmav94

New member
Messages
55
Points
0
Github
tmav94
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.
 
Last edited by a moderator:
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
}
 
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
}
 
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

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

 
Last edited by a moderator:
Back
Top