Jump to content
  • 0

Fix not working properly


Azeroth

Question


  • Group:  Members
  • Topic Count:  36
  • Topics Per Day:  0.01
  • Content Count:  383
  • Reputation:   121
  • Joined:  03/31/12
  • Last Seen:  

Hello ;) i don't know whos the author of this script i just found it somehwere and i can't remember.

Yeah there's a problem in this script, it should be in a map. because when i try it ingame, i set it to geffen

when i teleport to geffen it pop-up the message although the player is only 1 in the map, and the other player is in the prontera.

 

And also it pop-up in my mapserv when it message.

post-3539-0-65110000-1444742073_thumb.png

 

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

query_sql( "SELECT `last_ip` FROM `login` WHERE account_id="+getcharid(3)+"",.@IP );
query_sql( "SELECT `account_id` FROM `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 "savepoint",0,0;
    }
}
end;

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

 

Thank you in advance :D

Edited by Azeroth
Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Content Moderator
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  639
  • Reputation:   609
  • Joined:  11/25/11
  • Last Seen:  

Hum, I dislike the way that script was created, so...

function	script	checkmap	{
	setarray .@maps$[0],"geffen";		// List of Maps

	set .@map$, getarg(0);
	set .@count, getarraysize(.@maps$);
	for(set .@i,0; .@i < .@count; set .@i,.@i+1){
		if (.@map$ == .@maps$[.@i]){
			return 1;
		}
	}
	return 0;
}

-	script	blockdc	-1,{
	end;

OnPCLoadMapEvent:
	getmapxy .@map$, .@x, .@y, 0;
	set .@result, callfunc("checkmap", .@map$);
	if (.@result == 0){
		end;
	}
	set .@account_id, getcharid(3);
	
	set .@query$, "SELECT `last_ip` FROM `login` WHERE `account_id` =" + .@account_id;
	set .@result, query_sql(.@query$, .@last_ip$);
	
	set .@query$, "SELECT DISTINCT `login`.`account_id` FROM `char`,`login` WHERE `login`.`last_ip` = '" + .@last_ip$ + "' AND `char`.`online` = 1";
	set .@result, query_sql(.@query$, .@account_id2);

	set .@count, .@result;
	if (.@result > 1){
		for (set .@i,0; .@i < .@count; set .@i,.@i+1){
			if (.@account_id != .@account_id2[.@i]){
				if (attachrid(.@account_id2[.@i])){
					getmapxy .@map$, .@x, .@y, 0;
					set .@result, callfunc("checkmap", .@map$);
					if (.@result == 1){
						// Change here what you want the script to do
						atcommand "@kick "+strcharinfo(0);
					}
					detachrid;
				}
			}
		}
	}
}

// List of Maps to Load the OnPCLoadMapEvent
geffen	mapflag	loadevent

I made it to work on Geffen, when a second Account enters into Geffen and there's already a Account with some IP, the first one will be kicked.
Change it the way you like.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  36
  • Topics Per Day:  0.01
  • Content Count:  383
  • Reputation:   121
  • Joined:  03/31/12
  • Last Seen:  

Hum, I dislike the way that script was created, so...

function	script	checkmap	{
	setarray .@maps$[0],"geffen";		// List of Maps

	set .@map$, getarg(0);
	set .@count, getarraysize(.@maps$);
	for(set .@i,0; .@i < .@count; set .@i,.@i+1){
		if (.@map$ == .@maps$[.@i]){
			return 1;
		}
	}
	return 0;
}

-	script	blockdc	-1,{
	end;

OnPCLoadMapEvent:
	getmapxy .@map$, .@x, .@y, 0;
	set .@result, callfunc("checkmap", .@map$);
	if (.@result == 0){
		end;
	}
	set .@account_id, getcharid(3);
	
	set .@query$, "SELECT `last_ip` FROM `login` WHERE `account_id` =" + .@account_id;
	set .@result, query_sql(.@query$, .@last_ip$);
	
	set .@query$, "SELECT DISTINCT `login`.`account_id` FROM `char`,`login` WHERE `login`.`last_ip` = '" + .@last_ip$ + "' AND `char`.`online` = 1";
	set .@result, query_sql(.@query$, .@account_id2);

	set .@count, .@result;
	if (.@result > 1){
		for (set .@i,0; .@i < .@count; set .@i,.@i+1){
			if (.@account_id != .@account_id2[.@i]){
				if (attachrid(.@account_id2[.@i])){
					getmapxy .@map$, .@x, .@y, 0;
					set .@result, callfunc("checkmap", .@map$);
					if (.@result == 1){
						// Change here what you want the script to do
						atcommand "@kick "+strcharinfo(0);
					}
					detachrid;
				}
			}
		}
	}
}

// List of Maps to Load the OnPCLoadMapEvent
geffen	mapflag	loadevent

I made it to work on Geffen, when a second Account enters into Geffen and there's already a Account with some IP, the first one will be kicked.

Change it the way you like.

 

i'll try this one Haziel, Thank you very 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
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...