[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


Messages In This Thread
Also Know As-(AKA) system - by xTURBOx - 12.08.2016, 12:44
Re: Also Know As-(AKA) system - by oMa37 - 12.08.2016, 13:12
Re: Also Know As-(AKA) system - by Crayder - 12.08.2016, 13:14
Re: Also Know As-(AKA) system - by Stinged - 12.08.2016, 13:26
Re: Also Know As-(AKA) system - by Gammix - 12.08.2016, 13:59
Re: Also Know As-(AKA) system - by xTURBOx - 14.08.2016, 16:23
Respuesta: Also Know As-(AKA) system - by Franco33 - 23.09.2016, 20:45
Re: Also Know As-(AKA) system - by vannesenn - 24.09.2016, 05:37
Re: Also Know As-(AKA) system - by SickAttack - 24.09.2016, 05:51
Re: Also Know As-(AKA) system - by Richie - 24.09.2016, 21:33
Respuesta: Also Know As-(AKA) system - by None - 15.10.2016, 07:25

Forum Jump:


Users browsing this thread: 3 Guest(s)