Raised This Month: $ Target: $400
 0% 

Admins loading function...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ashcan
Senior Member
Join Date: May 2008
Old 08-03-2011 , 15:12   Admins loading function...
Reply With Quote #1

Hello
I downloaded nice plugin:
http://forums.alliedmods.net/showthread.php?t=130658

its very nice but its unapproved for now.
Im changing it little but i got a problem now...

The function of loading admins:
Code:
LoadTotalAdmins()
{
	new szUsersIni[48];
	get_configsdir(szUsersIni, 47);
	add(szUsersIni, 47, "/users.ini");
	
	if(!gAdmsNum)
		return 0;
	
	static Text[256], szAdmins[64], szFlags[10],
	RealName[48], Email[48], Status[48];
	
	new iFlags, f = fopen(szUsersIni, "rt");
	
	while(!feof(f) )
	{
		fgets(f, Text, 255);
		
		if(!strlen(Text) ) continue;
		if(Text[0] == ';') continue;
		if(Text[0] == '/' && Text[1] == '/') continue;
		
		parse(Text, szAdmins, 63, "", 0, "", 0, szFlags, 9, RealName, 47, Email, 47, Status, 47);
		
		iFlags = read_flags(szFlags);
		
		if(iFlags & FLAG_AUTHID) continue;
		
		ArrayPushString(TotalAdmins, szAdmins);
		
		ArrayPushString(RealNames, RealName);
		ArrayPushString(Emails, Email);
		ArrayPushString(AdmStatus, Status);
		
		gTotalAdms++;
	}
	
	fclose(f);
	
	return 1;
}
And i just wonder...
How can i change reading admins from file to reading admins from sql?

Just thinking...
i would do that this way:
Code:
queryAdmin = SQL_PrepareQuery(sql,"SELECT * FROM `%s` WHERE `admin_group_id` = '%s'", table, AdminGroup)
new qcolmember_sid = SQL_FieldNameToNum(queryAdmin, "member_sid");
SQL_ReadResult(queryAdmin, qcolmember_sid, szAdmins, sizeof(szAdmins)-1);
so now i would delete the lines above "parse" that are connected to reading admins from users.ini, and the next part would be like...
Code:
ArrayPushString(TotalAdmins, szAdmins);
but im not sure if it will work.
Can u tell me if i understand it correctly? and/or tell me what should i know ?
Ashcan is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:43.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode