COM(aka)
{
new id,query[250],string[5012] = "{FFFFFF}",DBResult:result,ip[16],hash[64],name[24];
if(sscanf(params,"u",id) && IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"USAGE: /aka [playerid]");
GetPlayerIp(id,ip,sizeof(ip));
format(query,sizeof(query),"SELECT * FROM iprecords WHERE name = '%s' OR ip = '%s' ORDER BY time DESC LIMIT 30",NAME(id),ip);
result = db_query(database,query);
do
{
db_get_field_assoc(result,"name",name,sizeof(name));
db_get_field_assoc(result,"ip",ip,sizeof(ip));
db_get_field_assoc(result,"hash",hash,sizeof(hash));
format(string,sizeof(string),"%sName: {FFFF00}%s{FFFFFF} | IP: {FFFF00}%s{FFFFFF} | Hash: {FFFF00}%d{FFFFFF}\n",string,name,ip,udb_hash(hash));
}
while(db_next_row(result));
db_free_result(result);
ShowPlayerDialog(playerid,0,DIALOG_STYLE_LIST,"Also Known As (Latest 30 results)",string,"Close","");
return 1;
}
[15:14:33] [debug] Server crashed while executing rockstar.amx [15:14:33] [debug] AMX backtrace: [15:14:33] [debug] #0 native db_get_field_assoc () [08139e70] from samp03 [15:14:33] [debug] #1 00027f20 in public cmd_aka (playerid=0, params[]=@0x0026e668 "0") at rockstar.pwn:930 [15:14:33] [debug] #2 native CallLocalFunction () [080d2960] from samp03 [15:14:33] [debug] #3 0001c5c8 in public S@@_OnPlayerCommandText (playerid=0, cmdtext[]=@0x0026e64c "/aka 0") at zcmd.inc:108 [15:14:33] [debug] System backtrace: [15:14:33] [debug] #0 b7466f41 in _ZN10StackTraceC1EPv () from plugins/crashdetect.so [15:14:33] [debug] #1 b745d41f in _ZN11crashdetect20PrintSystemBacktraceEPv () from plugins/crashdetect.so [15:14:33] [debug] #2 b745b963 in _ZN11crashdetect15SystemExceptionEPv () from plugins/crashdetect.so [15:14:33] [debug] #3 b74663c1 in ?? () from plugins/crashdetect.so [15:14:33] [debug] #4 b77e4600 in ?? () [15:14:33] [debug] #5 08139f6a in ?? () from /home/samp03 [15:14:33] [debug] #6 08093d14 in ?? () from /home/samp03 [15:14:33] [debug] #7 b745c5a2 in _ZN11crashdetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so [15:14:33] [debug] #8 b746465e in ?? () from plugins/crashdetect.so [15:14:33] [debug] #9 b746b926 in amx_Exec () from plugins/crashdetect.so [15:14:33] [debug] #10 b745c622 in _ZN11crashdetect9DoAmxExecEPii () from plugins/crashdetect.so [15:14:33] [debug] #11 b7464699 in ?? () from plugins/crashdetect.so [15:14:33] [debug] #12 080d2c02 in ?? () from /home/samp03 [15:14:33] [debug] #13 08093d14 in ?? () from /home/samp03 [15:14:33] [debug] #14 b745c5a2 in _ZN11crashdetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so [15:14:33] [debug] #15 b746465e in ?? () from plugins/crashdetect.so [15:14:33] [debug] #16 b746b926 in amx_Exec () from plugins/crashdetect.so [15:14:33] [debug] #17 b745c622 in _ZN11crashdetect9DoAmxExecEPii () from plugins/crashdetect.so [15:14:33] [debug] #18 b7464699 in ?? () from plugins/crashdetect.so [15:14:33] [debug] #19 080ad2c2 in ?? () from /home/samp03 [15:14:33] [debug] #20 080b8301 in ?? () from /home/samp03 [15:14:33] [debug] #21 08071b48 in ?? () from /home/samp03 [15:14:33] [debug] #22 08071c42 in ?? () from /home/samp03 [15:14:33] [debug] #23 0807ba60 in ?? () from /home/samp03 [15:14:33] [debug] #24 080b5a2d in ?? () from /home/samp03 [15:14:33] [debug] #25 080b5bc2 in ?? () from /home/samp03 [15:14:33] [debug] #26 080b14d3 in ?? () from /home/samp03 [15:14:33] [debug] #27 b753cc96 in __libc_start_main () from /lib/libc.so.6 [15:14:33] [debug] #28 0804b521 in ?? () from /home/samp03
Add SQLite plugin too. And make sure that if ur host is linux ur using .so plugins and if it is widows u must be using .dll plugins
|
COM(aka)
{
new
id,
query[250],
string[2048] = "{FFFFFF}",
DBResult:result,
ip[16],
hash[64],
name[24]
;
if(sscanf(params, "u", id) && IsPlayerConnected(id))
return SendClientMessage(playerid, -1, "USAGE: /aka [playerid]");
GetPlayerIp(id, ip, sizeof(ip));
format(query,sizeof(query),"SELECT * FROM iprecords WHERE name = '%s' OR ip = '%s' ORDER BY time DESC LIMIT 30", NAME(id), ip);
result = db_query(database, query);
for (new i = 0, rows = db_num_rows(result); i != rows; i ++)
{
db_get_field_assoc(result, "name", name, sizeof(name));
db_get_field_assoc(result, "ip", ip, sizeof(ip));
db_get_field_assoc(result, "hash", hash, sizeof(hash));
format(string, sizeof(string),"%sName: {FFFF00}%s{FFFFFF} | IP: {FFFF00}%s{FFFFFF} | Hash: {FFFF00}%d{FFFFFF}\n", string, name, ip, udb_hash(hash));
db_next_row(result);
}
db_free_result(result);
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "Also Known As (Latest 30 results)", string, "Close", "");
return 1;
}
Why would you possibly need a 5,012 cell string for? You're better off using 2,048 cells since you're limiting by 30 results.
Anyways, I split up the code and corrected some things for you: pawn Код:
|
COM(aka)
{
new id;
if(sscanf(params,"u",id) && id == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"USAGE: /aka [playerid]");
new query[125],ip[16],hash[64],name[24];
GetPlayerIp(id,ip,sizeof(ip));
format(query,sizeof(query),"SELECT * FROM iprecords WHERE name = '%s' OR ip = '%s' ORDER BY time DESC LIMIT 0,30",NAME(id),ip);
print(query);
new DBResult:result = db_query(database,query);
printf("db_num_rows: %d",db_num_rows(result));
new string[5012];
do
{
db_get_field_assoc(result,"name",name,sizeof(name));
db_get_field_assoc(result,"ip",ip,sizeof(ip));
db_get_field_assoc(result,"hash",hash,sizeof(hash));
format(string,sizeof(string),"%sName: {FFFF00}%s{FFFFFF} | IP: {FFFF00}%s{FFFFFF} | Hash: {FFFF00}%d{FFFFFF}\n",string,name,ip,udb_hash(hash));
}
while(db_next_row(result));
db_free_result(result);
ShowPlayerDialog(playerid,0,DIALOG_STYLE_LIST,"Also Known As (Latest 30 results)",string,"Close","");
return 1;
}
Try to debug
pawn Код:
|