Hi, I made some modifications to inserting alias in the database.
I want a new entry whenever the player's IP or UID changes, but I know when the script reads the first entry ( where IP is changed), it kept entering the new try whenever the player joined.
![](https://i.postimg.cc/MKx55xK2/Untitled.png)
I want a new entry whenever the player's IP or UID changes, but I know when the script reads the first entry ( where IP is changed), it kept entering the new try whenever the player joined.
Quotefunction AddAlias(player) {
local q = QuerySQL(db, "SELECT * FROM Alias WHERE Name='" + player.Name + "'");
if (!GetSQLColumnData(q, 0)) {
QuerySQL(db, "INSERT INTO Alias (Name, IP, UID) VALUES ('" + player.Name + "', '" + player.IP + "', '" + player.UniqueID + "')");
} else {
local currentIP = GetSQLColumnData(q, 1);
local currentUID = GetSQLColumnData(q, 2);
if (currentUID != player.UniqueID) {
QuerySQL(db, "INSERT INTO Alias (Name, IP, UID) VALUES ('" + player.Name + "', '" + player.IP + "', '" + player.UniqueID + "')");
} else if (currentIP != player.IP) {
QuerySQL(db, "INSERT INTO Alias (Name, IP, UID) VALUES ('" + player.Name + "', '" + player.IP + "', '" + currentUID + "')");
}
}
}
![](https://i.postimg.cc/MKx55xK2/Untitled.png)