April 27, 2024, 12:21:38 pm

Author Topic: Simple alias script.  (Read 233 times)

0 Members and 1 Guest are viewing this topic.

GiTo

  • Regular
  • ***
  • Posts: 78
  • Country: pk
    • View Profile
Simple alias script.
« on: February 10, 2023, 02:42:19 pm »
Tried making alias system on my own
Tested working fine 101%!

Creating Database
Code: [Select]
Alias <- ConnectSQL("Alias.db");
QuerySQL(Alias, "CREATE TABLE IF NOT EXISTS Alias(Name VARCHAR(255), IP FLOAT, UID VARCHAR(255))");

ADD THIS LINE ON REGISTER COMMAND ->
Code: [Select]
QuerySQL(Alias,"insert into Alias VALUES('"+escapeSQLString(player.Name.tolower())+"','"+player.IP+"', '"+player.UID+"')");

ADD THIS ON onPlayerCommand ->
Code: [Select]
else if (cmd == "alias")
  {
    if(!text) MessagePlayer("/alias <target_plr> <ip/uid>",player);
    else {
  local plr = GetPlayer( GetTok( text, " ", 1 ) );
  local iu = GetTok( text, " ", 2 );
        if(!plr) MessagePlayer("-> target player not found.",player);
        else if(iu==null) MessagePlayer("-> please use the correct syntax.",player);
    else {
     if(iu == "ip"){
        MessagePlayer("IP Alias Of "+plr.Name+"",player);
        local q = QuerySQL(Alias, "select * from Alias where IP='"+plr.IP+"'");
        if(q){
                while( GetSQLColumnData( q, 0 ) )
        {
        MessagePlayer(""+GetSQLColumnData(q,0)+"",player);
      GetSQLNextRow( q );
           }
        }
    }
}
     if(iu == "uid"){
        MessagePlayer("UID Alias Of "+plr.Name+"",player);
        local q = QuerySQL(Alias, "select * from Alias where UID='"+plr.UID+"'");
        if(q){
                while( GetSQLColumnData( q, 0 ) )
        {
        MessagePlayer(""+GetSQLColumnData(q,0)+"",player);
      GetSQLNextRow( q );
              }
            }
        }
    }
}


although this one is better -> https://viceunderdogs.com/index.php?topic=1842.0
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

What happens when the poison expires?