oalias for offline players

Started by Broly, Dec 08, 2017, 01:03 PM

Previous topic - Next topic

Broly

Hi friends
well first please don't laugh i am just a noob scripter ( beginner ) i am using this  Diego^ Alias System - IP/SUBNET/UID and trying to make Offline alias for irc  but its not work

else if ( cmd == "!ogetip" )
{

local q = QuerySQL(db, "SELECT * FROM Alias WHERE Name='" + text + "'");
  if ( !text ) StaffMessage(  ICOL_RED + "Syntax, " + cmd + " <full nickname>" );
else if ( GetSQLColumnData( q, 0 ) != text ) EchoMessage( ICOL_RED + "Error: This nickname is not registered." );
else if( (GetSQLColumnData( q, 0 ) == text ) || (GetSQLColumnData( q1, 0 ) == text ) )
{
 ShowAlias( text, plr, "ip" );
}

FreeSQLQuery( q );
}
}
and function
function ShowAlias( player, plr, option )
{
if ( option == "ip" )
{
local i = 0, a = Alias.len(), b;
while( i < a )
{
if ( plr.IP == Alias[i].IP && plr.Name != Alias[i].Nick )
{
if ( b ) b = b + ", " + Alias[i].Nick;
else b = Alias[i].Nick;
}
i ++;
}
if ( !b ) StaffMessage( " "+ plr.Name + " has no IP alias." );
else StaffMessage( "[IP-ALIAS] "+ plr.Name + "'s IP alias: " + b + "." );
}
else if ( option == "subnet" )
{
local i = 0, a = Alias.len(), b;
local getsub_1 = split( player.IP, "." ),
sub_1 = getsub_1[0] + getsub_1[1];
while( i < a )
{
local getsub_2 = split( Alias[i].IP, "." ),
sub_2 = getsub_2[0] + getsub_2[1];
if ( sub_1 == sub_2 && plr.Name != Alias[i].Nick )
{
if ( b ) b = b + ", " + Alias[i].Nick;
else b = Alias[i].Nick;
}
i ++;
}
if ( !b ) StaffMessage( "[Server] "+ plr.Name + " has no subnet alias." );
else StaffMessage( "[IP-ALIAS] "+ plr.Name + "'s IP alias: " + b + "." );
}
else if ( option == "uid" )
{
local i = 0, a = Alias.len(), b;
while( i < a )
{
if ( plr.UniqueID == Alias[i].UID && plr.Name != Alias[i].Nick )
{
if ( b ) b = b + ", " + Alias[i].Nick;
else b = Alias[i].Nick;
}
i ++;
}
if ( !b ) StaffMessage( "[Server]"+ plr.Name + " has no uid alias." );
else StaffMessage( "[IP-ALIAS] "+ plr.Name + "'s IP alias: " + b + "." );
}
}
Any help would appreciate

Milos


Broly


Saiyan Attack

#3
Here you go hope it works for you ...
else if ( cmd == "!ogetip" )
{
if ( !text ) StaffMessage(  ICOL_RED + "Syntax, " + cmd + " <full nickname>" );
else {
local q = QuerySQL(db, "SELECT Nicks FROM Alias WHERE Nicks='" + text + "'");
if (GetSQLColumnData( q, 0 ) != text) EchoMessage( ICOL_RED + "Error: This nickname is not registered." );
else ShowAlias( player, text, "ip" );
}
}
And Please Confirm that you've EchoMessage In StaffMessage ....

!

#4
Quote from: Saiyan Attack on Dec 08, 2017, 03:36 PMHere you go hope it works for you ...
else if ( cmd == "!ogetip" )
{
if ( !text ) StaffMessage(  ICOL_RED + "Syntax, " + cmd + " <full nickname>" );
else {
local q = QuerySQL(db, "SELECT Nicks FROM Alias WHERE Nicks='" + text + "'");
if (GetSQLColumnData( q, 0 ) != text) EchoMessage( ICOL_RED + "Error: This nickname is not registered." );
else ShowAlias( player, text, "ip" );
}
}
And Please Confirm that you've EchoMessage In StaffMessage ....

else if ( cmd == "!ogetip" )
{
   if ( !text ) StaffMessage(  ICOL_RED + "Syntax, " + cmd + " <full nickname>" );
   else
   {
      local q = QuerySQL(db, "SELECT Nicks FROM Alias WHERE Nicks='"+text+"'");
      if (!q) StaffMessage( ICOL_RED + "Error: This nickname is not registered." );
      else ShowAlias( player, text, "ip" );
   }
}

 :edit:
It wont work since you are using an instance in ShowAlias function while giving a string(plrnick) as input.

Discord: zeus#5155

Broly

Hi thanks for reply but sorry its not work it gives error at linke no 924 check the pic btw here's the real code of ShowAlias
function ShowAlias( player, plr, option )

Saiyan Attack

Here you Go :-
else if ( cmd == "!ogetip" )
{
if ( !text ) StaffMessage(  ICOL_RED + "Syntax, " + cmd + " <full nickname>" );
else {
local q = QuerySQL(db, "SELECT Nicks, UID FROM Alias WHERE Nicks='"+escapeSQLString(text)+"'");
if (!GetSQLColumnData(q,0)) StaffMessage( ICOL_RED + "Error: This nickname is not registered." );
else {
local b, a=0, q2 = QuerySQL(db,"SELECT Nicks FROM Alias WHERE UID='"+escapeSQLString(GetSQLColumnData(q,1))+"'");
while(GetSQLColumnData(q2,0) != null) {
if ( b ) b = b+", "+GetSQLColumnData(q2,0);
else b = GetSQLColumnData(q2,0);
GetSQLNextRow(q2);
a++;
}
if(a==1) StaffMessage( "[IP-ALIAS] "+ text + "'s IP alias: " + b + "." );
else if(a>=2) StaffMessage( "[IP-ALIAS] "+ text + "'s IP alias: " + b + "." );
else StaffMessage( " "+ text + " has no IP alias." );
FreeSQLQuery(q2);
}
}
}

Broly

Quote from: Saiyan Attack on Dec 08, 2017, 07:50 PMHere you Go :-
else if ( cmd == "!ogetip" )
{
if ( !text ) StaffMessage(  ICOL_RED + "Syntax, " + cmd + " <full nickname>" );
else {
local q = QuerySQL(db, "SELECT Nicks, UID FROM Alias WHERE Nicks='"+escapeSQLString(text)+"'");
if (!GetSQLColumnData(q,0)) StaffMessage( ICOL_RED + "Error: This nickname is not registered." );
else {
local b, a=0, q2 = QuerySQL(db,"SELECT Nicks FROM Alias WHERE UID='"+escapeSQLString(GetSQLColumnData(q,1))+"'");
while(GetSQLColumnData(q2,0) != null) {
if ( b ) b = b+", "+GetSQLColumnData(q2,0);
else b = GetSQLColumnData(q2,0);
GetSQLNextRow(q2);
a++;
}
if(a==1) StaffMessage( "[IP-ALIAS] "+ text + "'s IP alias: " + b + "." );
else if(a>=2) StaffMessage( "[IP-ALIAS] "+ text + "'s IP alias: " + b + "." );
else StaffMessage( " "+ text + " has no IP alias." );
FreeSQLQuery(q2);
}
}
}
Thank you Attack its work perfectly i will you give credits :)
and what about
SUBNET IP and UID ?

Saiyan Attack

Quote from: Broly on Dec 09, 2017, 04:30 AM
Quote from: Saiyan Attack on Dec 08, 2017, 07:50 PMHere you Go :-
else if ( cmd == "!ogetip" )
{
if ( !text ) StaffMessage(  ICOL_RED + "Syntax, " + cmd + " <full nickname>" );
else {
local q = QuerySQL(db, "SELECT Nicks, UID FROM Alias WHERE Nicks='"+escapeSQLString(text)+"'");
if (!GetSQLColumnData(q,0)) StaffMessage( ICOL_RED + "Error: This nickname is not registered." );
else {
local b, a=0, q2 = QuerySQL(db,"SELECT Nicks FROM Alias WHERE UID='"+escapeSQLString(GetSQLColumnData(q,1))+"'");
while(GetSQLColumnData(q2,0) != null) {
if ( b ) b = b+", "+GetSQLColumnData(q2,0);
else b = GetSQLColumnData(q2,0);
GetSQLNextRow(q2);
a++;
}
if(a==1) StaffMessage( "[IP-ALIAS] "+ text + "'s IP alias: " + b + "." );
else if(a>=2) StaffMessage( "[IP-ALIAS] "+ text + "'s IP alias: " + b + "." );
else StaffMessage( " "+ text + " has no IP alias." );
FreeSQLQuery(q2);
}
}
}
Thank you Attack its work perfectly i will you give credits :)
and what about
SUBNET IP and UID ?
this command get players name by Detecting their UID if one or more players have same UID Then This will display players name who have same UID and about subnet IP i leave the rest to you ...

Broly

Quote from: Saiyan Attack on Dec 09, 2017, 05:57 PM
Quote from: Broly on Dec 09, 2017, 04:30 AM
Quote from: Saiyan Attack on Dec 08, 2017, 07:50 PMHere you Go :-
else if ( cmd == "!ogetip" )
{
if ( !text ) StaffMessage(  ICOL_RED + "Syntax, " + cmd + " <full nickname>" );
else {
local q = QuerySQL(db, "SELECT Nicks, UID FROM Alias WHERE Nicks='"+escapeSQLString(text)+"'");
if (!GetSQLColumnData(q,0)) StaffMessage( ICOL_RED + "Error: This nickname is not registered." );
else {
local b, a=0, q2 = QuerySQL(db,"SELECT Nicks FROM Alias WHERE UID='"+escapeSQLString(GetSQLColumnData(q,1))+"'");
while(GetSQLColumnData(q2,0) != null) {
if ( b ) b = b+", "+GetSQLColumnData(q2,0);
else b = GetSQLColumnData(q2,0);
GetSQLNextRow(q2);
a++;
}
if(a==1) StaffMessage( "[IP-ALIAS] "+ text + "'s IP alias: " + b + "." );
else if(a>=2) StaffMessage( "[IP-ALIAS] "+ text + "'s IP alias: " + b + "." );
else StaffMessage( " "+ text + " has no IP alias." );
FreeSQLQuery(q2);
}
}
}
Thank you Attack its work perfectly i will you give credits :)
and what about
SUBNET IP and UID ?
this command get players name by Detecting their UID if one or more players have same UID Then This will display players name who have same UID and about subnet IP i leave the rest to you ...
I understand Thanks for you support :)