Jump to content
  • 0
Sign in to follow this  
jTynne

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

Question

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:

 

 

 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

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

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:
    1. If the user is no longer in the map:
      1. Delete him from the log table;
      2. 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:

        [*]Else (more than 1 result or failed to register its MAC):

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




        Hope this helped.

    2. User is legit, give him the points and notify him;
    3. End script resetting the timer.

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites
  • 0

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. 

Share this post


Link to post
Share on other sites
  • 0

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? @_@;

Share this post


Link to post
Share on other sites
  • 0

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 

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.