script help
#1

hi.i have a database and table and it has id , ip , aka , how can i get all rows with same ip with easy-mysql and then get aka?
Reply
#2

We can help more if you show us code.
Reply
#3

is it true?
Код:
if(SQL::RowExistsEx("mrp_aka","ip",PlayerIp(playerid)))
    {
        while(handle=SQL::OpenEx(SQL::READ,"mrp_aka","ip",PlayerName(playerid)))
		{
		    new str[256];SQL::ReadString(handle,"ip",str);print(str);
		}
	}
Reply
#4

Sorry, can I ask what MYSQL plugin you are you using?

I don't recognize the plugin you are using.
Reply
#5

R6 of this https://sampforum.blast.hk/showthread.php?tid=56564
and this include https://sampforum.blast.hk/showthread.php?tid=606930
Reply
#6

i got this in my script:

PHP код:
public recentlyUsedNicks(playerid)
{
    new 
query[200], ip[16], pName[24],pName1[10][24], playerName[24];
    
GetPlayerIp(playeridipsizeof(ip));
    
GetPlayerName(playeridplayerNamesizeof(playerName));
    
mysql_format(1querysizeof(query),"SELECT playerName FROM `playerdata` WHERE `playerIP`='%s' LIMIT 10"ip);
    new 
Cache:cacheid mysql_query(1query);
    new 
rows cache_num_rows(); 
    new 
string[128];//, string1[128];
    
if(rows 1)
    {
        
format(stringsizeof(string),"Player %s has previously connected with following %d names:"playerNamerows);
    
//    adminchat(COLOR_GREEN, string);

        
for(new 0rowsi++)
        {
            
cache_get_field_content(i"playerName"pName150);
            
pName1[i] = pName;
            
format(stringsizeof(string),"%s \n%s",stringpName1[i]);
        }
        
adminchat(COLOR_GREENstring);
        
IRC_GroupSay(gGroupIDIRC_CHANNELstring);

    }
    
cache_delete(cacheid);

and call the function once player has logged in.
Reply
#7

is it working?
Reply
#8

obv (lol).

remember to replace the tables names etc
Reply
#9

That's R33+ version of the plugin.

Can you post the table's structure for "mrp_aka" table? I can only write an example of it with the normal way (without the use of that include) if you want to and are there any duplicates (same ip and aka in more than one row) in the table?
Reply
#10

I don't know why I decided to do this, other then the fact I hate messing code. But I fixed up your code for your recentlyUsedNicks( playerid ) function.

Код:
public recentlyUsedNicks(playerid)
{
    static 
    	query[ 84 ], 
    	ip[ 16 ], 
    	pName[ 24 ], 
    	playerName[ 24 ]
    ;

    GetPlayerIp( playerid, ip, sizeof( ip ) );
    GetPlayerName( playerid, playerName, sizeof( playerName ) );

    mysql_format( 1, query, sizeof( query ),"SELECT `playerName` FROM `playerdata` WHERE `playerIP` = '%s' LIMIT 10", ip );

    new 
    	Cache:cacheid = mysql_query( 1, query ),
    	rows = cache_num_rows(),
    	string[ 256 ]
    ;

    if( rows )
    {
        format( string, sizeof( string ),"Player %s has previously connected with following %d names:", playerName, rows );

        for( new i = 0; i < rows; i++ )
        {
            cache_get_field_content( i, "playerName", pName, 1, sizeof( pName ) );
            format( string, sizeof( string ),"%s\n%s", string, pName );
        }

        adminchat( COLOR_GREEN, string );
        IRC_GroupSay( gGroupID, IRC_CHANNEL, string );
    }

    cache_delete(cacheid); // Your deleting the cache right after saving it? This makes it pointless to cache
}
However as long as you code works in other places with the same setup, it should work here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)