Groupmember SQLITE - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Groupmember SQLITE (
/showthread.php?tid=596814)
Groupmember SQLITE -
SilverStand - 22.12.2015
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 ?
Re: Groupmember SQLITE -
SilverStand - 23.12.2015
Quote:
Originally Posted by SilverStand
Someone can help me to fix this code ?
|
BUMP
Re: Groupmember SQLITE -
Gammix - 23.12.2015
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.
Re: Groupmember SQLITE -
SilverStand - 23.12.2015
Re: Groupmember SQLITE -
SilverStand - 23.12.2015
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
Re: Groupmember SQLITE -
thefirestate - 23.12.2015
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.
Re: Groupmember SQLITE -
Gammix - 24.12.2015
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");
}
}
Re: Groupmember SQLITE -
SilverStand - 24.12.2015
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 :<
Re: Groupmember SQLITE -
SilverStand - 24.12.2015
Solved by myself