Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Broly on Dec 08, 2017, 01:03 PM

Title: oalias for offline players
Post by: Broly on Dec 08, 2017, 01:03 PM
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 (http://forum.vc-mp.org/?topic=1906.msg14219#msg14219) 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
Title: Re: oalias for offline players
Post by: Milos on Dec 08, 2017, 02:16 PM
Errors in the console?
Title: Re: oalias for offline players
Post by: Broly on Dec 08, 2017, 03:02 PM
Well no there was no error
Title: Re: oalias for offline players
Post by: Saiyan Attack on Dec 08, 2017, 03:36 PM
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 ....
Title: Re: oalias for offline players
Post by: ! on Dec 08, 2017, 04:30 PM
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.
Title: Re: oalias for offline players
Post by: Broly on Dec 08, 2017, 04:48 PM
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 )
(https://s8.postimg.org/omfv3aer9/Untitled.png)
Title: Re: oalias for offline players
Post by: Saiyan Attack on Dec 08, 2017, 07:50 PM
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);
}
}
}
Title: Re: oalias for offline players
Post by: 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 ?
Title: Re: oalias for offline players
Post by: 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 ...
Title: Re: oalias for offline players
Post by: Broly on Dec 10, 2017, 05:21 AM
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 :)