Raised This Month: $51 Target: $400
 12% 

[HELP] I need help for reading an argument


Post New Thread Reply   
 
Thread Tools Display Modes
Software15
Junior Member
Join Date: Feb 2022
Old 02-24-2022 , 13:40   Re: [HELP] I need help for reading an argument
Reply With Quote #11

Quote:
Originally Posted by CrazY. View Post
Delete the sizeof data in ArrayGetArray

Code:
#include <amxmodx>
#include <amxmisc>

enum _:UserData_e
{
	User_Authid[64],
	User_Password[35],
	User_Flags,
	User_Access,
	User_Date[32],
	User_DateTimestamp
}

new Array:g_users
new g_playerDate[33][32]
new g_playerDateTimestamp[33]

public plugin_init()
{
	g_users = ArrayCreate(UserData_e)

	LoadFile()
}

public client_authorized(index)
{
	new authid[64]
	get_user_authid(index, authid, charsmax(authid))

	for (new i = 0, data[UserData_e], count = ArraySize(g_users); i < count; i++)
	{
		ArrayGetArray(g_users, i, data)

		if (equal(data[User_Authid], authid))
		{
			copy(g_playerDate[index], charsmax(g_playerDate[]), data[User_Date])
			g_playerDateTimestamp[index] = data[User_DateTimestamp]

			break
		}
	}
}

LoadFile()
{
	new filename[128]
	get_configsdir(filename, charsmax(filename))
	add(filename, charsmax(filename), "/yourfile.ini")

	new file = fopen(filename, "rb")

	if (file == 0)
	{
		return
	}

	new buffer[200], flags[27], access[10], data[UserData_e]

	while (fgets(file, buffer, charsmax(buffer)) > 0)
	{
		trim(buffer)

		switch (buffer[0])
		{
			// skip blank lines or comments
			case EOS, ';', '#', '/':
			{
				continue
			}
		}

		parse(buffer, data[User_Authid], charsmax(data[User_Authid]), 
			data[User_Password], charsmax(data[User_Password]), 
			flags, charsmax(flags), 
			access, charsmax(access),
			data[User_Date], charsmax(data[User_Date]))

		data[User_Flags] = read_flags(flags)
		data[User_Access] = read_flags(access)
		data[User_DateTimestamp] = parse_time(data[User_Date], "%d.%m.%Y")

		ArrayPushArray(g_users, data)
	}

	fclose(file)
}
Code:
public date_expiring(id)
{

ColorChat(id,TEAM_COLOR,"[Prefix] Your VIP is expiring on : ^4-= %d =- !", What variable? );

What variable have I to use for showing player his expiring date?
	
}
Software15 is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 02-24-2022 , 13:44   Re: [HELP] I need help for reading an argument
Reply With Quote #12

g_playerDate if you need the string
g_playerDateTimestamp if you need the timestamp

Code:
ColorChat(id,TEAM_COLOR,"[Prefix] Your VIP is expiring on : ^4-= %s =- !", g_playerDate[id] );
__________________








CrazY. is offline
Software15
Junior Member
Join Date: Feb 2022
Old 02-24-2022 , 13:57   Re: [HELP] I need help for reading an argument
Reply With Quote #13

It doesn't work, it gives me empty statement , " -= =-!"

Last edited by Software15; 02-24-2022 at 14:02.
Software15 is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 02-24-2022 , 14:30   Re: [HELP] I need help for reading an argument
Reply With Quote #14



The plugin is currently loading from addons/amxmodx/configs/yourfile.ini, check if you didn't forget to replace yourfile.ini with the file you are loading vips from.
__________________









Last edited by CrazY.; 02-24-2022 at 14:34.
CrazY. is offline
Software15
Junior Member
Join Date: Feb 2022
Old 02-24-2022 , 14:49   Re: [HELP] I need help for reading an argument
Reply With Quote #15

Quote:
Originally Posted by CrazY. View Post


The plugin is currently loading from addons/amxmodx/configs/yourfile.ini, check if you didn't forget to replace yourfile.ini with the file you are loading vips from.
Thanks you a lot, it works, I have one more question, where can I add and what, to check if today is 09.03.2022 is equal to g_playerDate[id] to set ";" before "STEAM ID" "..." "...." "...." "..."

Last edited by Software15; 02-24-2022 at 14:58.
Software15 is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 02-25-2022 , 08:11   Re: [HELP] I need help for reading an argument
Reply With Quote #16

You would do it as my first post, where timestamp is the value of g_playerDateTimestamp.

Quote:
Originally Posted by CrazY. View Post
check if get_systime() is greater than the timestamp. If it is, the account has expired.

Code:
    if (get_systime() > timestamp)     {         server_print("^t account has expired")     }
To add the semicolon at the beginning of the line, you would have to create a temporary file, read the original one line by line, check if the date has expired, if yes put the semicolon, finally delete the original file and rename the temporary one. There are already answers on that, take a few minutes to search.

https://stackoverflow.com/questions/...line-in-a-file

To be honest, what I would do is not load expired users at all, it will be easier and faster than rewriting the whole file.
__________________








CrazY. 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 12:59.


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