SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 02/11/2018, 01:07 PM   #1
TheToretto
Gangsta
 
TheToretto's Avatar
 
Join Date: Jul 2015
Posts: 593
Reputation: 66
Default [MySQL R41-4] IP Logger (dialogs)

samp-ip-logger



What this library*does is basic:*every time someone connects to the server, when he disconnects, even if he doesn’t register, it saves: The username, the IP, the date and exact time he connected, and disconnected. So four fields. How can this be useful? Well, an example is: You can detect multi-accounts. (manually ofc, I can release an automated one if requested.)

Installation

Simply install to your project:

Code:
sampctl package install itsToretto/samp-ip-logger
Include in your code and begin using the library:

PHP Code:
#include <iplogger> 
Testing

To test, simply run the package:

Code:
sampctl package run
Note:*there is a command in test.pwn that you will need to display dialogs, include it or copy it to your gamemode/the library itself.

Screenshots



*
*



Dependencies
__________________






Toretto#9902

Rest in peace grandpa, 03 November 2018

Last edited by TheToretto; 21/05/2019 at 12:42 PM. Reason: sampctl friendly
TheToretto is offline   Reply With Quote
Old 02/11/2018, 01:24 PM   #2
Franovitch
Little Clucker
 
Join Date: Sep 2018
Posts: 1
Reputation: 0
Default Re: [MySQL R41-4] IP Logger (dialogs)

brilliant !
Franovitch is offline   Reply With Quote
Old 02/11/2018, 01:57 PM   #3
Zeus666
Gangsta
 
Join Date: Mar 2015
Posts: 674
Reputation: 50
Default Re: [MySQL R41-4] IP Logger (dialogs)

Nice
Zeus666 is offline   Reply With Quote
Old 02/11/2018, 02:18 PM   #4
Heress
Huge Clucker
 
Heress's Avatar
 
Join Date: Mar 2018
Location: Lithuania
Posts: 262
Reputation: 7
Default Re: [MySQL R41-4] IP Logger (dialogs)

It's AMAZING!!
__________________
==============
Sorry for my bad English









Respect: Kalcor, ******. Thank you for this great game!
Heress is offline   Reply With Quote
Old 02/11/2018, 02:26 PM   #5
Calisthenics
Gangsta
 
Join Date: May 2018
Posts: 559
Reputation: 92
Default Re: [MySQL R41-4] IP Logger (dialogs)

Provide a .sql file about the table structure please.

Few tips to consider:
  • Save dates as TIMESTAMP OR DATETIME datatype and not as string. There is mysql function to format a readable form and an integrated system can even allow you retrieving total online time and many more benefits.
  • Avoid non-threaded queries as it can lead to memory leaks (you forgot to delete the cache instance).
  • Do not copy strings directly as this:
    pawn Code:
    g_ConnectionDate[playerid] = ReturnDate();
    g_pIP[playerid] = ReturnIP(playerid);

    g_DisconnectionDate[playerid] = ReturnDate();
    There is `strcpy` (macro of `strcat`) or `memcpy` function. Avoid `format` function.
  • Select columns you want to retrieve and not everything. `Name` or `Disconnected` columns are never retrieved.
  • Set appropriate keys to table structure. Searching by a string is slower than an integer. Searching by a non-indexed string is even slower.
Calisthenics is offline   Reply With Quote
Old 02/11/2018, 03:31 PM   #6
TheToretto
Gangsta
 
TheToretto's Avatar
 
Join Date: Jul 2015
Posts: 593
Reputation: 66
Default Re: [MySQL R41-4] IP Logger (dialogs)

Quote:
Originally Posted by Calisthenics View Post
Provide a .sql file about the table structure please.

Few tips to consider:
  • Save dates as TIMESTAMP OR DATETIME datatype and not as string. There is mysql function to format a readable form and an integrated system can even allow you retrieving total online time and many more benefits.
  • Avoid non-threaded queries as it can lead to memory leaks (you forgot to delete the cache instance).
  • Do not copy strings directly as this:
    pawn Code:
    g_ConnectionDate[playerid] = ReturnDate();
    g_pIP[playerid] = ReturnIP(playerid);

    g_DisconnectionDate[playerid] = ReturnDate();
    There is `strcpy` (macro of `strcat`) or `memcpy` function. Avoid `format` function.
  • Select columns you want to retrieve and not everything. `Name` or `Disconnected` columns are never retrieved.
  • Set appropriate keys to table structure. Searching by a string is slower than an integer. Searching by a non-indexed string is even slower.
Hey, thanks a lot for the tips, I really appreciate it, I've done everything you mentioned, (Commit) except the datetime, do you have an example or something? And I want to keep the same actual form displayed in the dialogs, if possible.
__________________






Toretto#9902

Rest in peace grandpa, 03 November 2018
TheToretto is offline   Reply With Quote
Old 02/11/2018, 04:59 PM   #7
CaptainBoi
Huge Clucker
 
CaptainBoi's Avatar
 
Join Date: May 2018
Location: Inside Game
Posts: 234
Reputation: 26
Default Re: [MySQL R41-4] IP Logger (dialogs)

Well really good job!
__________________
Code:
Releases
[FilterScript] Dynamic MySQL GPS System
[Tutorial] How to make TDM Team Selection.
[Include] moneybar.inc || Coloured Moneybar || Released
[Tutorial] PAWN Compiler In Notepad++
[FilterScript] Perks System (v: [On Update]) [DINI, ZCMD]
[FilterScript] Realistic Transmission Speedometer
CaptainBoi is offline   Reply With Quote
Old 02/11/2018, 05:51 PM   #8
zakariacaspeer
Little Clucker
 
zakariacaspeer's Avatar
 
Join Date: Oct 2018
Location: Morrocain
Posts: 13
Reputation: 0
Default Re: [MySQL R41-4] IP Logger (dialogs)

wow nice bro
__________________
zakariacaspeer is offline   Reply With Quote
Old 02/11/2018, 08:22 PM   #9
KinderClans
Banned
 
Join Date: May 2018
Location: Italy
Posts: 726
Reputation: 43
Default Re: [MySQL R41-4] IP Logger (dialogs)

Quote:
Originally Posted by TheToretto View Post
Hey, thanks a lot for the tips, I really appreciate it, I've done everything you mentioned, (Commit) except the datetime, do you have an example or something? And I want to keep the same actual form displayed in the dialogs, if possible.
pawn Code:
INSERT INTO yourtable (time_column) VALUES (NOW())

To show it:

pawn Code:
new date[36], string[40];
cache_get_value_name(i,"time_column", date, 36);
format(string, sizeof(string), "Date: %s", date);
KinderClans is offline   Reply With Quote
Old 02/11/2018, 08:48 PM   #10
TheToretto
Gangsta
 
TheToretto's Avatar
 
Join Date: Jul 2015
Posts: 593
Reputation: 66
Default Re: [MySQL R41-4] IP Logger (dialogs)

Quote:
Originally Posted by KinderClans View Post
pawn Code:
INSERT INTO yourtable (time_column) VALUES (NOW())

To show it:

pawn Code:
new date[36], string[40];
cache_get_value_name(i,"time_column", date, 36);
format(string, sizeof(string), "Date: %s", date);
Thanks, but what if I want to just store the time? Because, I send only one query, to save both the connection date & disconnection. I don't want to use multiple queries.
__________________






Toretto#9902

Rest in peace grandpa, 03 November 2018
TheToretto is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] [SQLite] Advanced IP Logger (dialogs + save up to 50 ips per user with next buttons) OverflowJ Filterscripts 14 28/10/2018 07:16 PM
[FilterScript] HTML Command logger Floriian Filterscripts 3 29/01/2016 02:50 PM
key logger? Anak Everything and Nothing 22 27/05/2013 03:53 AM
[FilterScript] [FS] RCON Logger _[HuN]_Epsilon_ Filterscripts 4 03/02/2010 03:29 PM
ip logger Commander_Shaw Help Archive 5 14/03/2009 08:17 AM


All times are GMT. The time now is 06:15 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.