Jump to content

[SQL] DB error


Recommended Posts


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.02
  • Content Count:  40
  • Reputation:   1
  • Joined:  06/24/22
  • Last Seen:  

Hello, having trouble on this script, I really don't know how to fix it. Please help me!
if (query_sql("USE `ragnarok_accounts` SELECT `last_ip` FROM `login` WHERE `account_id` = '" + .@aid[.@j] + "'", .@last_ip$) < 1)

If I understand the query_sql correctly this is the setup just based on the script.

ragnarok_accounts

image.png.cd204d4bb687972b633ccc17ba13dfe7.png

last_ip
image.png.032f0eb84b6473f51cb8d688284f09a9.png

account_id
image.png.ca967f8ba999f31f9ddf709a2c84a201.png


image.thumb.png.8aae1aad238bdaa518c8eefd1653c31b.png

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.01
  • Content Count:  147
  • Reputation:   36
  • Joined:  05/15/20
  • Last Seen:  

23 minutes ago, rizsu0107 said:

Hello, having trouble on this script, I really don't know how to fix it. Please help me!
if (query_sql("USE `ragnarok_accounts` SELECT `last_ip` FROM `login` WHERE `account_id` = '" + .@aid[.@j] + "'", .@last_ip$) < 1)

If I understand the query_sql correctly this is the setup just based on the script.

ragnarok_accounts

image.png.cd204d4bb687972b633ccc17ba13dfe7.png

last_ip
image.png.032f0eb84b6473f51cb8d688284f09a9.png

account_id
image.png.ca967f8ba999f31f9ddf709a2c84a201.png


image.thumb.png.8aae1aad238bdaa518c8eefd1653c31b.png

Try this :

query_sql("SELECT `last_ip` FROM `login`.`ragnarok_accounts` WHERE `account_id` = "+.@aid[.@j]+"",.@last_ip$);
if(.@last_ip$ == ""){
	do things here when last ip is empty.
}

I don't know why you're using the < 1 on checking ip since the ip is a string so it won't be read if you're comparing it to an integer.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.02
  • Content Count:  40
  • Reputation:   1
  • Joined:  06/24/22
  • Last Seen:  

10 minutes ago, KazumaSatou said:

Try this :

query_sql("SELECT `last_ip` FROM `login`.`ragnarok_accounts` WHERE `account_id` = "+.@aid[.@j]+"",.@last_ip$);
if(.@last_ip$ == ""){
	do things here when last ip is empty.
}

I don't know why you're using the < 1 on checking ip since the ip is a string so it won't be read if you're comparing it to an integer.

I just copied this in Euphy's WOE Controller, the one that have " // " is the default, I just added the User `ragnarok_accounts` because I have multiple servers. It is also the same when the woe ends I receive SQL DB error too.
image.thumb.png.df5d2981994efc227f4e3f53f8b02a7c.png

image.png.2370a844474fb8916d9a53d3682b8e8b.png

Edited by rizsu0107
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.01
  • Content Count:  147
  • Reputation:   36
  • Joined:  05/15/20
  • Last Seen:  

10 minutes ago, rizsu0107 said:

I just copied this in Euphy's WOE Controller, the one that have " // " is the default, I just added the User `ragnarok_accounts` because I have multiple servers. It is also the same when the woe ends I receive SQL DB error too.
image.thumb.png.df5d2981994efc227f4e3f53f8b02a7c.png

image.png.2370a844474fb8916d9a53d3682b8e8b.png

Yes, that's why I added the database name on the table on my code, try to use the < 1 on the if(.@lastip$ if it works

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.02
  • Content Count:  40
  • Reputation:   1
  • Joined:  06/24/22
  • Last Seen:  

13 minutes ago, KazumaSatou said:

Yes, that's why I added the database name on the table on my code, try to use the < 1 on the if(.@lastip$ if it works

I still getting errors.

image.thumb.png.9dcecb27e1355f2f5b11e2e98fbeab5c.png

This is the script I am working on.

world_boss.txt

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.01
  • Content Count:  147
  • Reputation:   36
  • Joined:  05/15/20
  • Last Seen:  

26 minutes ago, rizsu0107 said:

I still getting errors.

image.thumb.png.9dcecb27e1355f2f5b11e2e98fbeab5c.png

This is the script I am working on.

world_boss.txt

query_sql("SELECT `last_ip` FROM `ragnarok_accounts`.`login` WHERE `account_id` = "+getcharid(3)+"",.@IP );
query_sql("SELECT `account_id` FROM `ragnarok_accounts`.`login` WHERE `last_ip` = "+.@IP+"",.@Accountlist );

Here. The database and table has been swapped. 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.02
  • Content Count:  40
  • Reputation:   1
  • Joined:  06/24/22
  • Last Seen:  

24 minutes ago, KazumaSatou said:
query_sql("SELECT `last_ip` FROM `ragnarok_accounts`.`login` WHERE `account_id` = "+getcharid(3)+"",.@IP );
query_sql("SELECT `account_id` FROM `ragnarok_accounts`.`login` WHERE `last_ip` = "+.@IP+"",.@Accountlist );

Here. The database and table has been swapped. 

I don't receive any errors now. Thank you so much. Also my Woe Controller is Fixed thank you so much for this.
image.png.ec25f08c7ed55248d7185c8a1a72793f.png

image.thumb.png.65a1549aa94e9f247c61e471a768eb09.png

Also, can I ask about this. It is not detecting the same user IP, if you don't mind :).

image.png.2bb6dc42f0d1766d39e0acedebe8e73b.png

-    script    No_Multiple_Accounts    -1,{
OnPCLoadMapEvent:
if( strcharinfo(3) == .Map$ ){

query_sql("SELECT `last_ip` FROM `ragnarok_accounts`.`login` WHERE `account_id` = "+getcharid(3)+"",.@IP );
query_sql("SELECT `account_id` FROM `ragnarok_accounts`.`login` WHERE `last_ip` = "+.@IP+"",.@Accountlist );

for( set .@i,0; .@i < getarraysize( .@Accountlist ); set .@i,.@i + 1 )
    if( isloggedin( .@Accountlist[.@i] ) ) 
        set .@DetectedOnline,.@DetectedOnline + 1;

    if( .@DetectedOnline > .Limit ){
        mes "We detected there is "+.@DetectedOnline+" Users with same IP Logged in.";
        mes "Please log off these unused account.";
        close2;
        warp "thana_town",100,100;
    }
}
end;

OnInit:
// How many User with Same IP can logged in and stay at the specific map
set .Limit,1;
// What map will be restricted
set .Map$,"jupe_ele";
setmapflag .Map$,mf_loadevent;
end;
}

Edited by rizsu0107
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  55
  • Topics Per Day:  0.01
  • Content Count:  1190
  • Reputation:   161
  • Joined:  06/12/12
  • Last Seen:  

4 hours ago, rizsu0107 said:

I don't receive any errors now. Thank you so much. Also my Woe Controller is Fixed thank you so much for this.
image.png.ec25f08c7ed55248d7185c8a1a72793f.png

image.thumb.png.65a1549aa94e9f247c61e471a768eb09.png

Also, can I ask about this. It is not detecting the same user IP, if you don't mind :).

image.png.2bb6dc42f0d1766d39e0acedebe8e73b.png

-    script    No_Multiple_Accounts    -1,{
OnPCLoadMapEvent:
if( strcharinfo(3) == .Map$ ){

query_sql("SELECT `last_ip` FROM `ragnarok_accounts`.`login` WHERE `account_id` = "+getcharid(3)+"",.@IP );
query_sql("SELECT `account_id` FROM `ragnarok_accounts`.`login` WHERE `last_ip` = "+.@IP+"",.@Accountlist );

for( set .@i,0; .@i < getarraysize( .@Accountlist ); set .@i,.@i + 1 )
    if( isloggedin( .@Accountlist[.@i] ) ) 
        set .@DetectedOnline,.@DetectedOnline + 1;

    if( .@DetectedOnline > .Limit ){
        mes "We detected there is "+.@DetectedOnline+" Users with same IP Logged in.";
        mes "Please log off these unused account.";
        close2;
        warp "thana_town",100,100;
    }
}
end;

OnInit:
// How many User with Same IP can logged in and stay at the specific map
set .Limit,1;
// What map will be restricted
set .Map$,"jupe_ele";
setmapflag .Map$,mf_loadevent;
end;
}

for disable dual client, try my script below

you can change the map for disable dual client.

-	script	dualclientkicker	-1,{
OnPCLoadMapEvent:
set .@charmap$, strcharinfo(3);
if(!compare(.tmp$,.@charmap$)) end;
set .@len, query_sql("SELECT DISTINCT `account_id` FROM `char` WHERE`account_id` IN (SELECT `account_id` FROM `login` WHERE `last_ip` =(SELECT `last_ip` FROM `login` WHERE `account_id`="+getcharid(3)+")) AND`online` <> 0;",.@a);
for(set(.@d,0);.@d<.@len;set(.@d,.@d+1)) {
	if(!getmapxy(.@map$,.@x,.@y,0,rid2name(.@a[.@d])) && .@charmap$==.@map$)
	set .@c,.@c+ 1;     
	}
if(.@c > .limitacc ) {
dispbottom "Dual accounts not allowed in PVP.";
	warp "prontera",0,0;
	}    
	end;
OnInit:
set .limitacc,1;
setarray .maps$,"guild_vs1","guild_vs2","guild_vs3","guild_vs4","guild_vs5","turbo_e_4","turbo_e_8","turbo_e_16",
"pvp_y_1-1","pvp_y_1-2","pvp_y_1-3","pvp_y_1-4","pvp_y_1-5","pvp_y_2-1","pvp_y_2-2","pvp_y_2-3","pvp_y_2-4","pvp_y_2-5",
"pvp_y_3-1","pvp_y_3-2","pvp_y_3-3","pvp_y_3-4","pvp_y_3-5","pvp_y_4-1","pvp_y_4-2","pvp_y_4-3","pvp_y_4-4","pvp_y_4-5",
"pvp_y_5-1","pvp_y_5-2","pvp_y_5-3","pvp_y_5-4","pvp_y_5-5","pvp_y_6-1","pvp_y_6-2","pvp_y_6-3","pvp_y_6-4","pvp_y_6-5",
"pvp_y_7-1","pvp_y_7-2","pvp_y_7-3","pvp_y_7-4","pvp_y_7-5","pvp_y_8-1","pvp_y_8-2","pvp_y_8-3","pvp_y_8-4","pvp_y_8-5",
"pvp_n_1-1","pvp_n_1-2","pvp_n_1-3","pvp_n_1-4","pvp_n_1-5","pvp_n_2-1","pvp_n_2-2","pvp_n_2-3","pvp_n_2-4","pvp_n_2-5",
"pvp_n_3-1","pvp_n_3-2","pvp_n_3-3","pvp_n_3-4","pvp_n_3-5","pvp_n_4-1","pvp_n_4-2","pvp_n_4-3","pvp_n_4-4","pvp_n_4-5",
"pvp_n_5-1","pvp_n_5-2","pvp_n_5-3","pvp_n_5-4","pvp_n_5-5","pvp_n_6-1","pvp_n_6-2","pvp_n_6-3","pvp_n_6-4","pvp_n_6-5",
"pvp_n_7-1","pvp_n_7-2","pvp_n_7-3","pvp_n_7-4","pvp_n_7-5","pvp_n_8-1","pvp_n_8-2","pvp_n_8-3","pvp_n_8-4","pvp_n_8-5",
"pvp_2vs2";
set .lens ,    getarraysize(.maps$) ;
for(set(.a,0);.a<.lens;set(.a,.a+1)) {
	setmapflag .maps$[.a],    mf_loadevent ;
	set .tmp$ ,.tmp$+.maps$[.a]+",";
}
}

 

Edited by hendra814
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.02
  • Content Count:  40
  • Reputation:   1
  • Joined:  06/24/22
  • Last Seen:  

7 hours ago, hendra814 said:

for disable dual client, try my script below

you can change the map for disable dual client.

-	script	dualclientkicker	-1,{
OnPCLoadMapEvent:
set .@charmap$, strcharinfo(3);
if(!compare(.tmp$,.@charmap$)) end;
set .@len, query_sql("SELECT DISTINCT `account_id` FROM `char` WHERE`account_id` IN (SELECT `account_id` FROM `login` WHERE `last_ip` =(SELECT `last_ip` FROM `login` WHERE `account_id`="+getcharid(3)+")) AND`online` <> 0;",.@a);
for(set(.@d,0);.@d<.@len;set(.@d,.@d+1)) {
	if(!getmapxy(.@map$,.@x,.@y,0,rid2name(.@a[.@d])) && .@charmap$==.@map$)
	set .@c,.@c+ 1;     
	}
if(.@c > .limitacc ) {
dispbottom "Dual accounts not allowed in PVP.";
	warp "prontera",0,0;
	}    
	end;
OnInit:
set .limitacc,1;
setarray .maps$,"guild_vs1","guild_vs2","guild_vs3","guild_vs4","guild_vs5","turbo_e_4","turbo_e_8","turbo_e_16",
"pvp_y_1-1","pvp_y_1-2","pvp_y_1-3","pvp_y_1-4","pvp_y_1-5","pvp_y_2-1","pvp_y_2-2","pvp_y_2-3","pvp_y_2-4","pvp_y_2-5",
"pvp_y_3-1","pvp_y_3-2","pvp_y_3-3","pvp_y_3-4","pvp_y_3-5","pvp_y_4-1","pvp_y_4-2","pvp_y_4-3","pvp_y_4-4","pvp_y_4-5",
"pvp_y_5-1","pvp_y_5-2","pvp_y_5-3","pvp_y_5-4","pvp_y_5-5","pvp_y_6-1","pvp_y_6-2","pvp_y_6-3","pvp_y_6-4","pvp_y_6-5",
"pvp_y_7-1","pvp_y_7-2","pvp_y_7-3","pvp_y_7-4","pvp_y_7-5","pvp_y_8-1","pvp_y_8-2","pvp_y_8-3","pvp_y_8-4","pvp_y_8-5",
"pvp_n_1-1","pvp_n_1-2","pvp_n_1-3","pvp_n_1-4","pvp_n_1-5","pvp_n_2-1","pvp_n_2-2","pvp_n_2-3","pvp_n_2-4","pvp_n_2-5",
"pvp_n_3-1","pvp_n_3-2","pvp_n_3-3","pvp_n_3-4","pvp_n_3-5","pvp_n_4-1","pvp_n_4-2","pvp_n_4-3","pvp_n_4-4","pvp_n_4-5",
"pvp_n_5-1","pvp_n_5-2","pvp_n_5-3","pvp_n_5-4","pvp_n_5-5","pvp_n_6-1","pvp_n_6-2","pvp_n_6-3","pvp_n_6-4","pvp_n_6-5",
"pvp_n_7-1","pvp_n_7-2","pvp_n_7-3","pvp_n_7-4","pvp_n_7-5","pvp_n_8-1","pvp_n_8-2","pvp_n_8-3","pvp_n_8-4","pvp_n_8-5",
"pvp_2vs2";
set .lens ,    getarraysize(.maps$) ;
for(set(.a,0);.a<.lens;set(.a,.a+1)) {
	setmapflag .maps$[.a],    mf_loadevent ;
	set .tmp$ ,.tmp$+.maps$[.a]+",";
}
}

 

Thank you. I've been looking for something like this. thank you so much!

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
Reply to this topic...

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