Stop script if char's MAC address matches 2 or more other player's on same map.

jTynne

High Council
Messages
249
Points
0
Emulator
As the title suggests, I need a bit of code that will stop a script if the invoking character's "last_mac" column from login table.. using Harmony.. has two or more clients on the same map. 

Currently, I have it set up that when a player enters the event map, it inserts their MAC address into a database named "woe_records", and then continues on to another bit of code which awards participation points every 30 seconds they're on the event map.

What I need is for said script to stop running if there are two or more players on the current map who share the same MAC adress.

Below is the current script:

Code:
 aldeg_cas02,1,1,1	script	aldeg_cas02#timer	-1,{OnPCLoadMapEvent:getmapxy (.@map$, .@x, .@y, 0); if(agitcheck() > 0 && .@map$ == "aldeg_cas02" && gettime(4) == 0) {dispbottom "[WoE] Welcome to the War of Emperium. You will gain participation points for every 30 seconds you're on the map based on the number of players also in the castle. Good luck!";attachnpctimer;initnpctimer;}end; OnTimer30000:getmapxy (.@map$, .@x, .@y, 0); if(.@map$ != "aldeg_cas02") {detachnpctimer;stopnpctimer;end;}if(agitcheck() > 0 && .@map$ == "aldeg_cas02" && gettime(4) == 0) {detachnpctimer;set $aldeg_particip,getmapusers("aldeg_cas02")/2;set #woe_particip,#woe_particip+$aldeg_particip;stopnpctimer;dispbottom "[WoE] You've earned "+$aldeg_particip+" WoE participation points for being on the map for 30 seconds! You now have "+#woe_particip+" participation points.";attachnpctimer;initnpctimer;end;}} aldeg_cas02	mapflag	loadevent
 
We don't have available the command for getting char's MAC nor the table structure for your anti-cheat, so it's impossible to fulfill your request right now.

Anyways, I can give you some steps that could help to implement that, since you know some scripting. This is what I'd do:

  1. When a character enters in that map, log its MAC address (so your table would need to have space for that);
  2. Every 30 seconds, do the following: If the user is no longer in the map: Delete him from the log table;
  3. End script.
[*]If the user is still in the map:

  1. Make a SQL query like this: "SELECT * FROM `your_table_name` WHERE `your_MAC_column_name` = 'MAC_from_the_user'". Remember query_sql returns number of rows collected in addition to setting the arrays if needed;
  2. If there's only 1 result:
  3. Else (more than 1 result or failed to register its MAC):

    User is not legit, notify him;
  4. End script resetting timer.




Hope this helped.


[*]User is legit, give him the points and notify him;

[*]End script resetting the timer.



 
Last edited by a moderator:
It did! Thank you! I have it working now as I'd like, however, I do have a new issue.

For some reason, last_ip and last_mac are storing as a large number instead of a string when I use,

query_sql ("SELECT `last_mac` FROM `login` WHERE `account_id` = '"+getcharid(3)+"'", @mac$);

The @mac$ variable outputs like, 392859820935823. Not sure why that is..?

 
Last edited by a moderator:
No idea this time about that one. Maybe Harmony dev decided MAC addresses would be saved like that or so but can't figure out what happens.

 
If you check directly the database, are they also stored like that? 

If you check the table structure (Assuming you're using phpMyAdmin), both last_ip and last_max should be varchar. Make sure thats the type they're set to. 

 
That's how they're stored, and that's their storage method @ Xgear, it's strange. @_@; They're storing as the same value despite resembling nothing like a mac address, though, so I suppose it's fine? @_@;

 
They table structure says they're varchar yet they show up as a whole amount of numbers? O.o

Then the server is storing them wrongly O.o 

 
Back
Top