[Include] Also Know As-(AKA) system
#1

Introduction
AKA(Alias) include allows to retrieve the names of different accounts on the same ip(very easily)

Why did i make this?
Few months ago i wanted a aka system, i could not find one, so i thought why not make one and today i finally got enough free time to make one...

Features
-Uses SQLite for storing AKA data
-Simple and Easy
-You can choose the maximum number of names retrieved from database

How to use?
  1. Put "#include <aka>" under samp include
  2. Put "LoadAKADatabase();" Under "OnGameModeInt"(or "FilterscriptInit" , if you want to use it in a filterscript)
  3. Put "InitAKAOnConnect(playerid);" under "OnPlayerConnect"
  4. Then use the function "AKA" to retrieve the multiple accounts where needed
Usage Examples
Command
PHP код:
CMD:aka(playerid,params[])  
{  
    new 
pID;  
    if(!
sscanf(params,"u",pID)) return SendClientMessage(playerid,-1,"/aka (playerid)");  
    if(!
IsPlayerConnected(pID)) return SendClientMessage(playerid,-1,"Invalid playerid");  
    new 
accounts[*][MAX_PLAYER_NAME],string[256]; //change * to the maximum number of names you want to retrieve.
    
AKA(playerid,accounts);  
    if(
accounts[0][0] == '\0') return SendClientMessage(playerid,-1,"This Player has no mutli accounts!");  
    for(new 
ii<sizeof(accounts); i++)  
    {  
        if(
accounts[i][0] == '\0') break;  
        
format(string,sizeof(string),"%sPlayerName: %s\n",string,accounts[i]);  
    }  
    return 
ShowPlayerDialog(playerid,999,DIALOG_STYLE_MSGBOX,"All Player Accounts",string,!"Okay",!"");  

Example Filterscript
coming soon

Download V1.0
PHP код:
#if !defined _samp_included
    #error samp is not included
#endif
#if defined _AKA
    #endinput
#endif
#define _AKA
static DB:database;
LoadAKADatabase()
{
    
database db_open("aka.db");
    
db_query(database,"CREATE TABLE IF NOT EXISTS `akas` (`Username`,`Ip`)");
}
InitAKAOnConnect(playerid)
{
    if(
IsPlayerNPC(playerid)) return 1;
    new 
ip[16],name[MAX_PLAYER_NAME],DBResult:result,string[128];
    
GetPlayerIp(playerid,ip,16);
    
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    
format(string,sizeof(string),"SELECT `Ip` FROM `akas` WHERE `Username`='%s'",name);
    
result db_query(database,string);
    switch(
db_num_rows(result)) 
    {
        case 
0format(string,sizeof(string),"INSERT INTO `akas` (`Username`,`Ip`) VALUES ('%s','%s')",name,ip);
        default: 
format(string,sizeof(string),"UPDATE `akas` SET `Ip`='%s' WHERE `Username`='%s'",ip,name);
    }
    
db_free_result(result);
    
db_query(database,string);
    return 
1;
}
stock AKA(playerid,accs[][],const size=sizeof(accs))
{
    new 
ip[16],name[MAX_PLAYER_NAME],DBResult:result,string[128],rows;
    
GetPlayerIp(playerid,ip,16);
    
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    
format(string,sizeof(string),"SELECT `Username` FROM `akas` WHERE `Ip`='%s'",ip);
    
result db_query(database,string);
    
rows db_num_rows(result);
    if(
rows>1)
    {
        for(new 
i,ji<rowsi++)
        {
            if(
j==size) break;
            
db_get_field(result,0,accs[j++],MAX_PLAYER_NAME);
            
db_next_row(result);
        }
    }
    return 
db_free_result(result);

Reply
#2

If it's MySQL I would use it. =/
Anyway, Good job.
Reply
#3

Quote:
Originally Posted by oMa37
Посмотреть сообщение
If it's MySQL I would use it. =/
Anyway, Good job.
So make your own personal version. This system is meant to be a localized system.
Reply
#4

You should escape the player names (%q), or else an SQL Injection might occur.

Also, read this: https://sampforum.blast.hk/showthread.php?tid=570910
If you convert to that (Which would eliminate the need to add stuff to the script like InitAKA and LoadAKA),
make sure to check if FILTERSCRIPT is defined, so you'd do it under OnFilterScriptInit, if not, under OnGameModeInit
Reply
#5

http://forum.sa-mp.com/showpost.php?...postcount=4569

Use ipmatch to detect similar IPs, because this is the main purpose of AKA. Your code just checks accounts registered on same IPs not similar.

So in case of IP match, you have to: go through all rows > get their IP > use ipmatch > store matched ones.
Reply
#6

Quote:
Originally Posted by oMa37
Посмотреть сообщение
If it's MySQL I would use it. =/
Anyway, Good job.
Why so?
I don't think the data stored in the db needed to be retrieved by another application

Quote:
Originally Posted by Stinged
Посмотреть сообщение
You should escape the player names (%q), or else an SQL Injection might occur.

Also, read this: https://sampforum.blast.hk/showthread.php?tid=570910
If you convert to that (Which would eliminate the need to add stuff to the script like InitAKA and LoadAKA),
make sure to check if FILTERSCRIPT is defined, so you'd do it under OnFilterScriptInit, if not, under OnGameModeInit
Thanks I will improve this

Quote:
Originally Posted by Gammix
Посмотреть сообщение
http://forum.sa-mp.com/showpost.php?...postcount=4569

Use ipmatch to detect similar IPs, because this is the main purpose of AKA. Your code just checks accounts registered on same IPs not similar.

So in case of IP match, you have to: go through all rows > get their IP > use ipmatch > store matched ones.
okay thanks..

Thanks all
Reply
#7

filtercript please!!!
Reply
#8

Why you don't use GPCI?
Reply
#9

Quote:
Originally Posted by vannesenn
Посмотреть сообщение
Why you don't use GPCI?
It isn't accurate.
Reply
#10

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
It isn't accurate.
More accurate when combined with IP, compared to IP only.
Reply
#11

SOLVED!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)