Raised This Month: $32 Target: $400
 8% 

Does not load the vips are connected


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 02-28-2020 , 09:32   Does not load the vips are connected
Reply With Quote #1

I'm trying to test that as soon as PLAYER connects to the server it will get/set FLAGS and then print/show up on LOG AMX but for some reason it doesn't work properly

Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

// Flags
#define FLAG_A (1<<0)
#define FLAG_B (1<<1)
#define FLAG_C (1<<2)
#define FLAG_D (1<<3)
#define FLAG_E (1<<4)
#define FLAG_K (1<<10)

enum _:DATA_PREM {
	auth[50],
	password[50],
	accessflags,
	flags
};

new amx_password_field_string[32];
new g_iUserFlags[MAX_PLAYERS + 1];
new g_aPremium[DATA_PREM];
new Array:g_aDataPremiums;

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	get_cvar_string("amx_password_field", amx_password_field_string, charsmax(amx_password_field_string));
}

public client_putinserver(id) {
	set_flags(id);
}

public plugin_cfg() {
	reload_vips();
}
	
public set_flags(id) {
	static szAuthId[31], szIp[31], szName[32], szPassword[30];
	get_user_authid(id, szAuthId, charsmax(szAuthId));
	get_user_ip(id, szIp, charsmax(szIp), 1);
	get_user_name(id, szName, charsmax(szName));
	get_user_info(id, amx_password_field_string, szPassword, charsmax(szPassword));
	
	g_iUserFlags[id] = 0
	for(new i; i < ArraySize(g_aDataPremiums); i++) {
		ArrayGetArray(g_aDataPremiums, i, g_aPremium);
		
		if(g_aPremium[flags] & FLAG_D) 
		{
			if(equal(szIp, g_aPremium[auth])) 
			{
				if(~g_aPremium[flags] & FLAG_E)
				{
					if(equal(szPassword, g_aPremium[password]))
						g_iUserFlags[id] = g_aPremium[accessflags];
					else if(g_aPremium[flags] & FLAG_A) {
						server_cmd("kick #%d ^"Ivalid password!^"", get_user_userid(id));
						break;
					}
				}
				else 
					g_iUserFlags[id] = g_aPremium[accessflags];
				
				log_amx("%s become Premium. (SteamID: ^"%s^") (IP: ^"%s^") (Flags: ^"%s^")", szName, szAuthId, szIp, get_flags_string(g_aPremium[accessflags]));
				break;
			}
		}
		else if(g_aPremium[flags] & FLAG_C) 
		{
			if(equal(szAuthId, g_aPremium[auth])) 
			{
				if(~g_aPremium[flags] & FLAG_E)
				{
					if(equal(szPassword, g_aPremium[password]))
						g_iUserFlags[id] = g_aPremium[accessflags];
					else if(g_aPremium[flags] & FLAG_A) {
						server_cmd("kick #%d ^"Ivalid password!^"", get_user_userid(id));
						break;
					}
				}
				else
					g_iUserFlags[id] = g_aPremium[accessflags];
				
				log_amx("%s become Premium. (SteamID: ^"%s^") (IP: ^"%s^") (Flags: ^"%s^")", szName, szAuthId, szIp, get_flags_string(g_aPremium[accessflags]));
				break;
			}
		}
		else 
		{
			if(g_aPremium[flags] & FLAG_K) {
				if((g_aPremium[flags] & FLAG_B && contain(szName, g_aPremium[auth]) != -1) || equal(szName, g_aPremium[auth])) 
				{
					if(~g_aPremium[flags] & FLAG_E)
					{
						if(equal(szPassword, g_aPremium[password]))
							g_iUserFlags[id] = g_aPremium[accessflags];
						else if(g_aPremium[flags] & FLAG_A) 
						{
							server_cmd("kick #%d ^"Ivalid password!^"", get_user_userid(id));
							break;
						}
					}
					else 
						g_iUserFlags[id] = g_aPremium[accessflags];
					
					log_amx("%s become Premium. (SteamID: ^"%s^") (IP: ^"%s^") (Flags: ^"%s^")", szName, szAuthId, szIp, get_flags_string(g_aPremium[accessflags]));
					break;
				}
			}
			else 
			{
				if((g_aPremium[flags] & FLAG_B && containi(szName, g_aPremium[auth]) != -1) || equali(szName, g_aPremium[auth])) 
				{
					if(~g_aPremium[flags] & FLAG_E)
					{
						if(equal(szPassword, g_aPremium[password]))
							g_iUserFlags[id] = g_aPremium[accessflags];
						else if(g_aPremium[flags] & FLAG_A) {
							server_cmd("kick #%d ^"Ivalid password!^"", get_user_userid(id));
							break;
						}
					}
					else 
						g_iUserFlags[id] = g_aPremium[accessflags];
					
					log_amx("%s become Premium. (SteamID: ^"%s^") (IP: ^"%s^") (Flags: ^"%s^")", szName, szAuthId, szIp, get_flags_string(g_aPremium[accessflags]));
					break;
				}
			}
		}
	}
	return 1;
}

public reload_vips() {
	new szBuffer[256], szArg[2][8], iFile = fopen("addons/amxmodx/configs/premium.ini", "a+");
	if(!iFile) 
		return set_fail_state("File ^"addons/amxmodx/configs/premium.ini^" not found");
	
	if(g_aDataPremiums) 
		ArrayDestroy(g_aDataPremiums);
	g_aDataPremiums = ArrayCreate(DATA_PREM);
	
	while(!feof(iFile)) {
		fgets(iFile, szBuffer, charsmax(szBuffer));
		trim(szBuffer);
		if(!szBuffer[0] || szBuffer[0] == ';')
			continue;
		
		if(parse(szBuffer,
			g_aPremium[auth], charsmax(g_aPremium[auth]),
			g_aPremium[password], charsmax(g_aPremium[password]),
			szArg[0], charsmax(szArg[]),
			szArg[1], charsmax(szArg[])
		))
			continue;
			
		g_aPremium[accessflags] = read_flags(szArg[0]);
		g_aPremium[flags] = read_flags(szArg[1]);
	}
	return 1;
}

stock get_flags_string(iFlags) {
	new szBuffer[16];
	get_flags(iFlags, szBuffer, charsmax(szBuffer));
	return szBuffer;
}
Quote:
after someone here explains to me the problem I would love to explain to me how I can define that I can give by command and not by anyone who comes in server flags

Last edited by Fuck For Fun; 02-28-2020 at 12:35.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-28-2020 , 12:08   Re: Does not load the vips are connected
Reply With Quote #2

Before I look further, your g_aDataPremiums array is empty and you attempt to pull data from it
Code:
new Array:g_aDataPremiums;
public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         get_cvar_string("amx_password_field", amx_password_field_string, charsmax(amx_password_field_string)); } public client_putinserver(id) {     set_flags(id); }     public set_flags(id) {     static szAuthId[31], szIp[31], szName[32], szPassword[30];     get_user_authid(id, szAuthId, charsmax(szAuthId));     get_user_ip(id, szIp, charsmax(szIp), 1);     get_user_name(id, szName, charsmax(szName));     get_user_info(id, amx_password_field_string, szPassword, charsmax(szPassword));         g_iUserFlags[id] = 0
    for(new i; i < ArraySize(g_aDataPremiums); i++) {
        ArrayGetArray(g_aDataPremiums, i, g_aPremium);
__________________
Bugsy is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 02-28-2020 , 12:31   Re: Does not load the vips are connected
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
Before I look further, your g_aDataPremiums array is empty and you attempt to pull data from it
Code:
new Array:g_aDataPremiums;
public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         get_cvar_string("amx_password_field", amx_password_field_string, charsmax(amx_password_field_string)); } public client_putinserver(id) {     set_flags(id); }     public set_flags(id) {     static szAuthId[31], szIp[31], szName[32], szPassword[30];     get_user_authid(id, szAuthId, charsmax(szAuthId));     get_user_ip(id, szIp, charsmax(szIp), 1);     get_user_name(id, szName, charsmax(szName));     get_user_info(id, amx_password_field_string, szPassword, charsmax(szPassword));         g_iUserFlags[id] = 0
    for(new i; i < ArraySize(g_aDataPremiums); i++) {
        ArrayGetArray(g_aDataPremiums, i, g_aPremium);
PHP Code:
public reload_vips() {
    new 
szBuffer[256], szArg[2][8], iFile fopen("addons/amxmodx/configs/premium.ini""a+");
    if(!
iFile
        return 
set_fail_state("File ^"addons/amxmodx/configs/premium.ini^" not found");
    
    if(
g_aDataPremiums
        
ArrayDestroy(g_aDataPremiums);
    
g_aDataPremiums ArrayCreate(DATA_PREM);
    
    while(!
feof(iFile)) {
        
fgets(iFileszBuffercharsmax(szBuffer));
        
trim(szBuffer);
        if(!
szBuffer[0] || szBuffer[0] == ';')
            continue;
        
        if(
parse(szBuffer,
            
g_aPremium[auth], charsmax(g_aPremium[auth]),
            
g_aPremium[password], charsmax(g_aPremium[password]),
            
szArg[0], charsmax(szArg[]),
            
szArg[1], charsmax(szArg[])
        ))
            continue;
            
        
g_aPremium[accessflags] = read_flags(szArg[0]);
        
g_aPremium[flags] = read_flags(szArg[1]);
    }
    return 
1;

Yes i was working on it at the time and did not know if i did it right so now i have edited and added to CODE
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-28-2020 , 12:35   Re: Does not load the vips are connected
Reply With Quote #4

ReloadVIP's is never called.
__________________
Bugsy is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 02-28-2020 , 12:50   Re: Does not load the vips are connected
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
ReloadVIP's is never called.
Ok so here I am trying to create a command that I can give access by command, and I did that someone coming in would bring it SETFLAGS and load CFG
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-28-2020 , 20:01   Re: Does not load the vips are connected
Reply With Quote #6

Quote:
Originally Posted by Fuck For Fun View Post
Ok so here I am trying to create a command that I can give access by command, and I did that someone coming in would bring it SETFLAGS and load CFG
What?? Do you still have an issue or did you figure it out?
__________________
fysiks is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 02-29-2020 , 10:54   Re: Does not load the vips are connected
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
What?? Do you still have an issue or did you figure it out?
I got it, just trying to figure something out for myself
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
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 14:29.


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