Limmek / MStats-for-rust

Logs player statistics and other server stuff to MySql
https://buymeacoffee.com/Limmek
5 stars 3 forks source link

Can u update? #6

Closed csaksapi closed 5 years ago

csaksapi commented 5 years ago

Only 3 things pls... CargoShip Log PatrolHelicopter Log Chinook Log

For my website ^^,

This is the best stat logger plugin!

Limmek commented 5 years ago

Amazing this plugin still works! I haven't played in a while.. maybe even years..

I think this plugin should be rewritten in to a uMod plugin. Will do some research on uMod's api and Hooks Extended and see if its possible and not to much work.

csaksapi commented 5 years ago

I am currently using this for my website. About 1 year every day. And i solved the events too... sooo primitive but work... (the php is not c# :D)

 void OnEntitySpawned(BaseEntity entity)

{ if (entity is BaseHelicopter) { executeQuery("INSERT INTO server_log_heli (plane, location, time) VALUES (@0, @1, @2)", "HELIVAN", " ", getDateTime()); } else if (entity is CargoShip){ executeQuery("INSERT INTO server_log_ship (plane, location, time) VALUES (@0, @1, @2)", "CARGOSHIP", " ", getDateTime()); } else if (entity is CH47Helicopter){ executeQuery("INSERT INTO server_log_ch47 (plane, location, time) VALUES (@0, @1, @2)", "CH47", " ", getDateTime()); } else if (entity is BradleyAPC){ executeQuery("INSERT INTO server_log_b (plane, location, time) VALUES (@0, @1, @2)", "BRADLEY", " ", getDateTime()); } }

sql eg: CREATE TABLE IF NOT EXISTS server_log_b (id INT(11) NOT NULL AUTO_INCREMENT, plane VARCHAR(128) NULL, location VARCHAR(128) NULL, time TIMESTAMP NULL, PRIMARY KEY (id) ) ENGINE=InnoDB; etc...

and that is worked for me!! kep

Limmek commented 5 years ago

Ahh okay i see, nice man! I'm glad u find if useful and u solved it by your self :) I think i will spend some time this weekend and update it and maybe alto see if i can add it on uMod.

csaksapi commented 5 years ago

ragezone.hu (if u want to watch)

Limmek commented 5 years ago

Evening!

Quiet late response but since it worked i did not look in to it more at that point. I will update the script when i'm done.

I edited your void OnEntitySpawned(BaseEntity entity) code to add the name and location.

void OnEntitySpawned(BaseEntity entity) {
  //PrintWarning(entity.ToString());
  //PrintWarning(entity.transform.position.ToString());
  if (entity is BaseHelicopter && entity.ToString().Contains("patrolhelicopter")) {
      executeQuery("INSERT INTO server_log_heli (plane, location, time) VALUES (@0, @1, @2)", entity.ToString(), entity.transform.position.ToString(), getDateTime());
  }
  else if (entity is CargoShip && entity.ToString().Contains("cargoship")) {
    executeQuery("INSERT INTO server_log_ship (plane, location, time) VALUES (@0, @1, @2)", entity.ToString(), entity.transform.position.ToString(), getDateTime());
  }
  else if (entity is CH47Helicopter && entity.ToString().Contains("ch47")) {
    executeQuery("INSERT INTO server_log_ch47 (plane, location, time) VALUES (@0, @1, @2)", entity.ToString(), entity.transform.position.ToString(), getDateTime());
  }
  else if (entity is BradleyAPC && entity.ToString().Contains("bradleyapc")) {
    executeQuery("INSERT INTO server_log_b (plane, location, time) VALUES (@0, @1, @2)", entity.ToString(), entity.transform.position.ToString(), getDateTime());
  }            
}

This plugin should be rewritten and follow the umod plugin standard I will close this now.