Jump to content
  • 0

kill/disconnect someone from SQL?


Question

6 answers to this question

Recommended Posts

  • 0
Posted

yes, you can do some sort of trick, though, running query_sql repeatedly might eats your server resources

I don't really recommend though

-	script	kdhfksfjs	FAKE_NPC,{
OnInit:
	query_sql "create table if not exists disconnect_char( account_id int(11) primary key, char_id int(11), name varchar(23) ) engine = innodb;";
	while ( true ) {
		.@nb = query_sql( "select * from disconnect_char", .@aid, .@cid, .@name$ );
		for ( .@i = 0; .@i < .@nb; .@i++ ) {
			if ( .@aid[.@i] ) {
				if ( isloggedin( .@aid[.@i] ) ) {
					atcommand "@kick "+ rid2name( .@aid[.@i] );
					debugmes "the player AID "+ .@aid[.@i] +" has been kick.";
				}
				else
					debugmes "the player AID "+ .@aid[.@i] +" is not online";
				query_sql "delete from disconnect_char where account_id = "+ .@aid[.@i];
			}
			else if ( .@cid[.@i] ) {
				if ( query_sql( "select account_id from `char` where char_id = "+ .@cid[.@i], .@taid ) ) {
					if ( isloggedin( .@taid ) ) {
						atcommand "@kick "+ rid2name( .@taid );
						debugmes "the player CID "+ .@cid[.@i] +" has been kick.";
					}
					else
						debugmes "the player CID "+ .@cid[.@i] +" is not online";
				}
				else
					debugmes "the player CID "+ .@cid[.@i] +" doesn't exist";
				query_sql "delete from disconnect_char where char_id = "+ .@cid[.@i];
			}
			else if ( .@name$[.@i] ) {
				if ( query_sql( "select account_id from `char` where name = '"+ escape_sql(.@name$[.@i]) +"'", .@taid ) ) {
					if ( isloggedin( .@taid ) ) {
						atcommand "@kick "+ rid2name( .@taid );
						debugmes "the player name "+ .@name$[.@i] +" has been kick.";
					}
					else
						debugmes "the player name "+ .@name$[.@i] +" is not online";
				}
				else
					debugmes "the player name "+ .@name$[.@i] +" doesn't exist";
				query_sql "delete from disconnect_char where name = '"+ escape_sql(.@name$[.@i]) +"'";
			}
		}
		sleep 5000;
	}
}
.

.

One last question, Do you know where I can find the sql to see the autotrade players? or any sql to see the buffs from each player. Or it's a kind of custom table?

its inside `vendings` table

and the buffs is `sc_data`

  • Upvote 1
  • 0
Posted

you mean IP Ban List?

 

or

 

loop through a custom SQL table for table

then get the data and disconnect/kill thee characters ?

 

No, I mean a custom table that will just disconnect the players, if theres someway to do it, can you help me?

 

Just disconnect someone via sql, even players with autotrade.

 

Thanks sir Emistry.

 

 

  • 0
Posted

SQL Table is used to store data, it doesnt execute out any command to interfere with the game.

 

The part that executing the command to kick players is the NPC Script or the Source Modication.

 

If this is a NPC script that you're looking for, you shall elaborate how the NPC script should work to disconnect the users.

  • Upvote 1
  • 0
Posted

SQL Table is used to store data, it doesnt execute out any command to interfere with the game.

 

The part that executing the command to kick players is the NPC Script or the Source Modication.

 

If this is a NPC script that you're looking for, you shall elaborate how the NPC script should work to disconnect the users.

 

 

Thanks sir Emirtry, I understand that SQL can't interfere directly with the game.

 

So I should use npc+sql to make it work.

 

One last question, Do you know where I can find the sql to see the autotrade players? or any sql to see the buffs from each player. Or it's a kind of custom table?

 

Thanks again.

  • 0
Posted

yes, you can do some sort of trick, though, running query_sql repeatedly might eats your server resources

I don't really recommend though

-	script	kdhfksfjs	FAKE_NPC,{
OnInit:
	query_sql "create table if not exists disconnect_char( account_id int(11) primary key, char_id int(11), name varchar(23) ) engine = innodb;";
	while ( true ) {
		.@nb = query_sql( "select * from disconnect_char", .@aid, .@cid, .@name$ );
		for ( .@i = 0; .@i < .@nb; .@i++ ) {
			if ( .@aid[.@i] ) {
				if ( isloggedin( .@aid[.@i] ) ) {
					atcommand "@kick "+ rid2name( .@aid[.@i] );
					debugmes "the player AID "+ .@aid[.@i] +" has been kick.";
				}
				else
					debugmes "the player AID "+ .@aid[.@i] +" is not online";
				query_sql "delete from disconnect_char where account_id = "+ .@aid[.@i];
			}
			else if ( .@cid[.@i] ) {
				if ( query_sql( "select account_id from `char` where char_id = "+ .@cid[.@i], .@taid ) ) {
					if ( isloggedin( .@taid ) ) {
						atcommand "@kick "+ rid2name( .@taid );
						debugmes "the player CID "+ .@cid[.@i] +" has been kick.";
					}
					else
						debugmes "the player CID "+ .@cid[.@i] +" is not online";
				}
				else
					debugmes "the player CID "+ .@cid[.@i] +" doesn't exist";
				query_sql "delete from disconnect_char where char_id = "+ .@cid[.@i];
			}
			else if ( .@name$[.@i] ) {
				if ( query_sql( "select account_id from `char` where name = '"+ escape_sql(.@name$[.@i]) +"'", .@taid ) ) {
					if ( isloggedin( .@taid ) ) {
						atcommand "@kick "+ rid2name( .@taid );
						debugmes "the player name "+ .@name$[.@i] +" has been kick.";
					}
					else
						debugmes "the player name "+ .@name$[.@i] +" is not online";
				}
				else
					debugmes "the player name "+ .@name$[.@i] +" doesn't exist";
				query_sql "delete from disconnect_char where name = '"+ escape_sql(.@name$[.@i]) +"'";
			}
		}
		sleep 5000;
	}
}
.

.

One last question, Do you know where I can find the sql to see the autotrade players? or any sql to see the buffs from each player. Or it's a kind of custom table?

its inside `vendings` table

and the buffs is `sc_data`

 

 

Thanks lady AnnieRuru. I really appreciate your job.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...