About 1 Per Mac IP except vending or @AT

Hadeszeus

New member
Messages
651
Points
0
Location
Philippines
I have a problem with this script I found here source


I want to disable DUAL login using last_mac but I need to exclude the check on players in vending and @at mode.

How can I modify this script?

- script Only1perMAC -1,{OnPCLoginEvent: if (getgmlevel() >= 99) end; set .@name$, strcharinfo(0); if (query_sql("SELECT `char`.`name` FROM `char` LEFT JOIN login ON `char`.account_id=login.account_id WHERE login.last_mac=(SELECT last_mac FROM login WHERE account_id="+getcharid(3)+") AND `char`.online=1 AND `char`.char_id!="+getcharid(0), .@name$) >= 1) { for (set .@i,0; .@i<getarraysize(.@name$); set .@i,.@i+1) { if (checkvending(.@name$[.@i]) != 2) set .@samemac, .@samemac +1; } if (.@samemac >= 1) { announce "Sorry, only 1 account per computer can be logged in at a time.", bc_self; sleep 1000; atcommand "@kick " + .@name$; } } end;}

Thank you!
 

 
find and replace

if (checkvending(.@name$[.@i]) != 2)

with

if (!checkvending(.@name$[.@i]) )
Vendors still kick from the server
default_sad.png


 
hi i know its off- topic but can i ask even if he/she is not in @at/vendor still last_mac will be checked. and if 2 same mac is login, you will be @jail [hours/days]

 
Here's my own version, using temporary global vars for to allow for other uses of these MAC addresses (assuming you know what to do with them).

Code:
-	script	dual_check	-1,{	/*-----------------------------------------------------	Determine MAC address [Harmony]	-----------------------------------------------------*/	function getmacaddress {		query_sql "SELECT `last_mac` FROM `login` WHERE `account_id` = '"+ getcharid(3) +"'", .@mac_address$;		return .@mac_address$;	}			/*-----------------------------------------------------	Log MAC address to array	-----------------------------------------------------*/	OnPCLoginEvent:		// Log MAC address		.@user_mac$ = getmacaddress();				// Loop through all map exceptions (if enabled)		for (.@i = 0; .@i < getarraysize(.allow_map$) && .map_exceptions; .@i++) {			// Determine if player's map is excepted			if (strcharinfo(3) == .allow_map$[.@i]) {				// Bypass flag				.@bypass = 1;				break;			}		}				// Loop through entire MAC address list if no bypass flag		for (.@i = 0; .@i < getarraysize($@mac_list$) && !.@bypass; .@i++) {			// Determine if user's MAC address is already logged			if (.@user_mac$ == $@mac_list$[.@i]) {				// Jail user for dual-clienting				atcommand "@jailfor "+ .jail_time$ +" "+ strcharinfo(0);								// Message delay				sleep2 100;								// Error message				message strcharinfo(0), "Dual-clienting is not allowed.";				break;			}		}				// Add user's MAC address to log		$@mac_list$[getarraysize($@mac_list$)] = .@user_mac$;		end;					/*-----------------------------------------------------	Remove single MAC address entry	-----------------------------------------------------*/	OnPCLogoutEvent:		// Log MAC address		.@user_mac$ = getmacaddress();				// Loop through entire MAC address list		for (.@i = 0; .@i < getarraysize($@mac_list$); .@i++) {			// Find matching MAC address			if (.@user_mac$ == $@mac_list$[.@i]) {				// Delete single entry				deletearray $@mac_list$[.@i], 1;			}		}				end;					/*-----------------------------------------------------	Configuration	-----------------------------------------------------*/	OnInit:		// Jail for 10 years		.jail_time$ = "10y";				// Allow map exceptions? 1: yes, 0: no		.map_exceptions = 1;				// Map exceptions		setarray .allow_map$[0], "poring_w01", "poring_w02";		end;}
 
Last edited by a moderator:
find and replace

if (checkvending(.@name$[.@i]) != 2)

with

if (!checkvending(.@name$[.@i]) )
Vendors still kick from the server
default_sad.png
try the new one , after tested, it works for me
Code:
-	script	Only1perMAC	-1,{OnPCLoginEvent:	if (getgmlevel() >= 99) end;	if (query_sql("SELECT `char`.`name` FROM `char` LEFT JOIN login ON `char`.account_id=login.account_id WHERE login.last_mac=(SELECT last_mac FROM login WHERE account_id="+getcharid(3)+") AND `char`.online=1 AND `char`.char_id!="+getcharid(0), .@name$) >= 1) {		for (set .@i,0; .@i<getarraysize(.@name$); set .@i,.@i+1) {			if (!checkvending(.@name$[.@i]))				set .@samemac, .@samemac +1;		}		if (.@samemac >= 1) {			announce "Sorry, only 1 account per computer can be logged in at a time.", bc_self;			sleep2 1000;			atcommand "@kick "+strcharinfo(0);		}	}	end;}
 
Last edited by a moderator:
this script will work only if i have harmony installed in my emulator?

 
@Mumbles

I noticed that it can't detect player on Vending mode on loginevent. This way they can still dual log since i doesn;t check for vendors.
How can I include Online player on vending mode except accounts on @AUTOTRADE?

 
Back
Top