Groupmember SQLITE
#1

What's Wrong with this code, it's not show anything when i type /groupmember <gname>
i'm using easydb by gammix


Код:
CMD:groupmember(playerid,params[])
{
	new gname[30],pname[MAX_PLAYER_NAME+1],str[1024],str2[128],id, query[256];
	if(sscanf(params,"s[30]",gname)) return SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}Usage: \"groupmember <groupname>\"");
	if(strlen(gname) > 30)return SendClientMessage(playerid,-1,"{FF0000}[ERROR] {FFFFFF}Name of group max is 30 Char");
	new DBResult:result;
	id = DB_RetrieveKey(Group_Table,"GroupName",gname);
 	if(id != DB_INVALID_KEY)
  	{
		format(query, sizeof query, "SELECT * FROM `GroupMembers` WHERE `GroupName`='%s'", DB::Escape(gname));
		result = DB::Query(query);
		for(new a;a<db_num_rows(result);a++)
		{
		    db_get_field_assoc(result, "UserName", pname, sizeof pname);
			strcat(str,pname);
	  		strcat(str,"\n");
			db_next_row(result);
		}
		format(str2,sizeof(str2),"Member Group : %s",gname);
		ShowPlayerDialog(playerid,DIALOG_GMEMBERS,DIALOG_STYLE_MSGBOX,str2,str,"Close","");
	}
	else SendClientMessage(playerid,-1,"{FF0000}[ERROR] {FFFFFF}Invalid Group name");
	return 1;
}
Someone can help me to fix this code ?
Reply
#2

Quote:
Originally Posted by SilverStand
Посмотреть сообщение
Someone can help me to fix this code ?
BUMP
Reply
#3

Could you show the structure of your database (an image of the table with field name). Because the query you are trying to run seems to be useless.
Reply
#4



Reply
#5

Quote:
Originally Posted by Gammix
Посмотреть сообщение
Could you show the structure of your database (an image of the table with field name). Because the query you are trying to run seems to be useless.
BUMP
Reply
#6

I am working with SQLite but, I am using the default sa-mp functions for it not easydb or something so if you want I can re-write it with the default functions from the samp include if not, I cannot help because I don't work with easydb.
Reply
#7

pawn Код:
for (new i, j = DB::GetRowsPoolSize(GroupMembers_Table); i <= j; i++)
{
    if (DB::GetStringEntry(GroupMembers_Table, i, "UserName", pname))
    {
        strcat(str, pname);
    strcat(str,"\n");
    }
}
Reply
#8

Quote:
Originally Posted by Gammix
Посмотреть сообщение
pawn Код:
for (new i, j = DB::GetRowsPoolSize(GroupMembers_Table); i <= j; i++)
{
    if (DB::GetStringEntry(GroupMembers_Table, i, "UserName", pname))
    {
        strcat(str, pname);
    strcat(str,"\n");
    }
}
undefined GetRowsPoolSize

sorry im using your old include :<
Reply
#9

Solved by myself
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)