CMD:aka(playerid,params[])
{
new ID,DBResult:Result,Query[250];
if(sscanf(params,"u",ID)) return SendClientMessage(playerid,-1,"USAGE: /aka [playerid]");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,-1,"ERROR: Player not connected.");
format(Query,sizeof(Query),"SELECT * FROM `Accounts` WHERE `IP` = '%s'",IP[ID]);
Result = db_query(DB,Query);
// How would I get the names?
db_free_result(Result);
return 1;
}
CMD:aka(playerid,params[])
{
new ID,DBResult:Result,Query[70];
if(sscanf(params,"u",ID)) SendClientMessage(playerid,-1,"USAGE: /aka [playerid]");
else if(!IsPlayerConnected(ID)) SendClientMessage(playerid,-1,"ERROR: Player not connected.");
else{
format(Query,sizeof(Query),"SELECT * FROM `Accounts` WHERE `IP` = '%s'",IP[ID]);
Result = db_query(DB,Query);
if(!db_num_rows(Result)) SendClientMessage(playerid,-1,"ERROR: Results not found.");
else{
new Nick[MAX_PLAYER_NAME + 1];
do
{
db_get_field_assoc(Result, "Name", Nick, sizeof(Nick)); // replace 'Name' to your real column name with player nicknames
SendClientMessage(playerid, -1, Nick);
}
while(db_next_row(Result))
}
db_free_result(Result);
}
return 1;
}
CMD:aka(playerid,params[])
{
new ID,DBResult:Result,Query[250];
if(sscanf(params,"u",ID)) return SendClientMessage(playerid,-1,"USAGE: /aka [playerid]");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,-1,"ERROR: Player not connected.");
format(Query,sizeof(Query),"SELECT * FROM `Accounts` WHERE `IP` = '%s'",IP[ID]);
Result = db_query(DB,Query);
if(db_num_rows(Result) == 1)
{
db_get_field_assoc(Result,"Field_Name_Here",Query,/* LENGHT/VALUE_OF_FIELD_HERE */);
}
db_free_result(Result);
return 1;
}
pawn Код:
|