[bug] Vip system by raheem

Coding Help/Re-API Supported
Post Reply
User avatar
Supremache
Member
Member
Egypt
Posts: 9
Joined: 3 years ago
Contact:

[bug] Vip system by raheem

#1

Post by Supremache » 3 years ago

Hi there,
I used vip system by raheem and i edit somethings and added more features for another mod but there's bug everytime when i connecting to the server i getting this message "You have no entry to the server..." !!! but i already has typed the password in the console, so where's the wrong, any help plz..

Code: Select all

public client_authorized(id)
{
	// Get password from Setinfo
	new szPassword[65]
	get_user_info(id, g_szPasswordKey, szPassword, charsmax(szPassword))
	
	// Player VIP?
	get_vip_flags(id)
	
	if (g_bIsUserVIP[id] )
	{
		if (equal(szPassword, g_szPassword))
		{
			client_cmd(id, "echo ^"* VIP Password Accepted!^"")
		}
		else
		{
			// VIP and wrong Password? Kick him
			client_cmd(id, "echo ^"* VIP Invalid Password!^"")
			server_cmd("kick #%d ^"You have no entry to the server...^"", get_user_userid(id))
		}
	}
	
}

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#2

Post by Night Fury » 3 years ago

Did you edit anything related to passwords/parsing the file? Have u even set a password in the file?
Show how you type the password in the console
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

User avatar
Supremache
Member
Member
Egypt
Posts: 9
Joined: 3 years ago
Contact:

#3

Post by Supremache » 3 years ago

Night Fury wrote: 3 years ago Did you edit anything related to passwords/parsing the file? Have u even set a password in the file?
Show how you type the password in the console
Hi Night Fury,
Thanks for your answer...
I added more features and edit some functions but I didn't touch “get_user_vip function".
I already set the password in file and I set the same password in user.ini.
set info _pw "password".
Do you want to see the full code after editing?
P.s: I'm scripter but I left scripting for 8 months and I forgot much things.

User avatar
Supremache
Member
Member
Egypt
Posts: 9
Joined: 3 years ago
Contact:

#4

Post by Supremache » 3 years ago

Can you please tell me where is the issuse !!!

Code: Select all

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <ColorChat>
#include <fun>
#include <zombie_vip>

#pragma library fun
#pragma loadlib fun

// Defines

#define VIP_MESSAGES   		VIP_A
#define SCOREBOARD		VIP_B
#define MULTIJUMP		VIP_C
#define HEALTH			VIP_D
#define ARMOR			VIP_E
#define GRAVITY			VIP_F
#define NoClip			VIP_G
#define DAMAGE			VIP_H
#define FALLDAMAGE		VIP_I
#define MODEL			VIP_M
#define NON_VIP			VIP_Z

#define NO_RECOIL_WEAPONS_BITSUM ((1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4))
#define FLAG_SCOREATTRIB_VIP (1<<2)
#define VERSION "1.5.1"

	/*--------------------------+
	|       <*> Features	    |
	|---------------------------|
	|   1- Multi Jump           |
	|   2- SCOREBOARD           |
	|   3- NOFALLDAMAGE         |
	|   4- DAMAGE+++            |
	|   5- NOCLIP               |
	|   6- HP+++                |
	|   7- ARMOR+++             |
	|   8- GRAVITY+++           |
	|   9- ARMOR+++             |
	|   10- Connect Message     |
	|   11- Happy Hours         |
	+--------------------------*/

/*....................Natives....................*/

native set_user_model( _index, _model[ ] ); 
native get_user_model( _index, _model[ ], _length );

/*...................Variables...................*/

new g_szPasswordKey[65], 
	g_szPassword[65],
	bool:g_bIsUserVIP[33], 
	bool:g_bSetVIP[33], 
	g_iFlags[33],
	g_bZombie[33],
	g_iPlayerType[33],
	Float:g_fLastChangedModel,
	jumpnum[33],
	bool:dojump[33],
	bool:g_bIsHappyHour,
	g_iMaxPlayers

/*.....................Const.....................*/


static const g_szLocalFile[] = "addons/amxmodx/configs/users/VipAcount.ini"
static const g_szConfigFile[] = "vip.cfg"
static const g_szVipModels[] = "vip"

new const g_iMaxClips[] = {0, 13, 0, 10, 0, 7, 0, 30, 30, 0, 15, 20, 25, 30, 35, 25, 12, 20, 10, 30, 100, 8, 30, 30, 20, 0, 7, 30, 30, 0, 50};

new const szCommands[][] =
{
	"say /vip",
	"say /vips",
	"say_team /vip",
	"say_team /vips"
}
/*..................Global Vars..................*/

// Cvars
new g_pCvarVIPScoreboard, 
	g_pCvarConnectMessage,
	g_pCvarAdminContact,
	g_pCvarEnableHappyHours,
	g_pCvarHappyHours,
	g_pCvarHappyHoursFlags,
	g_pCvarDamage,
	g_pCvarMultiJump,
	g_pCvarArmor,
	g_pCvarHealth,
	g_pCvarGravity,
	g_pEnable_Gravity

/*...............................................*/

public plugin_natives()
{
	register_native("get_vip_flags", "native_get_vip_flags", 1)
	register_native("set_vip_flags", "native_set_vip_flags", 1)
	register_native("is_user_vip", "native_is_user_vip", 1)
}

public plugin_init()
{
	register_plugin("[ZP] Zombie Plague VIP", VERSION, "Raheem & Supremache")
	
	RegisterHam(Ham_TakeDamage, "player", "_PlayerTakeDamage")
	RegisterHam(Ham_Spawn, "player", "_PlayerSpawn", 1)
	register_logevent("logevent_round_end", 2, "1=Round_End")
	register_message(get_user_msgid("ScoreAttrib"),"_ScoreBoard")
	register_event("HLTV", "_HappyHours", "a", "1=0", "2=0")
	
	// Cvars
	g_pCvarConnectMessage = register_cvar("zp_connect_message", "1")
	g_pCvarAdminContact = register_cvar("zp_admin_contact", "Admin Name")
	g_pCvarVIPScoreboard = register_cvar("zp_show_vip_scoreboard", "1")
	g_pCvarEnableHappyHours = register_cvar("zp_enable_happy_hours", "1")
	g_pCvarHappyHours = register_cvar("zp_vip_happy_hours", "9-12")
	g_pCvarHappyHoursFlags = register_cvar("zp_happy_hours_vip_flags", "abcd")
	g_pCvarDamage = register_cvar("zp_vip_multiply_damage", "1.2")
	g_pCvarMultiJump = register_cvar("zp_vip_multijump", "3")
	g_pCvarArmor = register_cvar("zp_vip_armor", "200")
	g_pCvarHealth = register_cvar("zp_vip_health", "350")
	g_pCvarGravity = register_cvar("zp_vip_gravity", "1")
	g_pEnable_Gravity = register_cvar("zp_enable_vip_gravity", "0")


	
	register_cvar("vip_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY)
	set_cvar_string("vip_version", VERSION)
	
	// Commands
	for (new i = 0; i < charsmax(szCommands); i++)
		register_clcmd(szCommands[i], "CmdVIP")

	register_clcmd("say /getvip", "CmdMotd")
	register_clcmd("say_team /getvip", "CmdMotd")
	
	// Get Password Key
	get_cvar_string("amx_password_field", g_szPasswordKey, charsmax(g_szPasswordKey))
	
	// Initialize Arrays
	arrayset(g_bIsUserVIP, false, 32)
	arrayset(g_bSetVIP, false, 32)
	
	// Get max players
	g_iMaxPlayers = get_maxplayers()
}

public plugin_precache()
{
	new szVipModel[64]
	formatex( szVipModel, charsmax( szVipModel ), "models/player/%s/%s.mdl", g_szVipModels, g_szVipModels ) ;
	precache_model( szVipModel ) ;
}

public plugin_cfg()
{
	// Get our configiration file and Execute it
	new ConfigsDir[64];
	get_localinfo("amxx_configsdir", ConfigsDir, charsmax(ConfigsDir));
	formatex(ConfigsDir, charsmax(ConfigsDir), "%s/%s", ConfigsDir, g_szConfigFile);
	
	if (!file_exists(ConfigsDir))
	{
		server_print("Vip system file (%s) doesn't exists!", ConfigsDir);
		return;
	}
	server_cmd("exec ^"%s^"", ConfigsDir);
		
}

public _PlayerCurWeapon(iPlayer)
{
	if(g_bZombie[iPlayer]) return
	
	if( get_vip_flags(iPlayer) & NoClip)
	{
		new iWeapon = read_data(2);
	
		if(!(NO_RECOIL_WEAPONS_BITSUM & (1 << iWeapon)))
		{
			set_pdata_int(get_pdata_cbase(iPlayer, 373), 51, g_iMaxClips[iWeapon], 4);
		}
	}
}
public _PlayerTakeDamage(iVictim, iInflictor, iAttacker, Float:flDamage, bitsDamageType)
{
	if(g_bZombie[iAttacker])
		return HAM_IGNORED
		
	if( get_vip_flags(iVictim) & FALLDAMAGE) {
		if(bitsDamageType & DMG_FALL ) return HAM_SUPERCEDE;
	}
	
	if (!is_user_alive(iVictim) || !is_user_alive(iAttacker)) return HAM_IGNORED
	
	if (!( get_vip_flags(iAttacker) & DAMAGE) || get_pcvar_num(g_pCvarDamage) == 0)
		return HAM_IGNORED
	

	SetHamParamFloat(4, flDamage * get_pcvar_float(g_pCvarDamage))
	
	return HAM_IGNORED
}

public _PlayerSpawn(iPlayer)
{
	if(!is_user_alive(iPlayer)) return HAM_IGNORED;
	if(g_bZombie[iPlayer]) return HAM_IGNORED
	
	static Float:fCurrentTime;
	fCurrentTime = get_gametime();
	if (fCurrentTime - g_fLastChangedModel >=0.35)
	{
		ChangeModel(iPlayer + 250);
		g_fLastChangedModel = fCurrentTime;
	}
	else
	{
		set_task(g_fLastChangedModel + 0.35 - fCurrentTime, "ChangeModel", iPlayer + 250, "", 0, "", 0);
		g_fLastChangedModel = g_fLastChangedModel + 0.35;
	}
	
	new iFlags = get_vip_flags(iPlayer);
		
	if( iFlags & ARMOR) {
		if(pev(iPlayer, pev_armorvalue) < get_pcvar_num(g_pCvarArmor))
		set_pev(iPlayer, pev_armorvalue, float(get_pcvar_num(g_pCvarArmor)))
	}
	
	if( iFlags & HEALTH) {
		
		set_user_health(iPlayer, get_pcvar_num(g_pCvarHealth))
	}
	
	if( iFlags & GRAVITY && get_pcvar_num(g_pEnable_Gravity)) {
		set_pev(iPlayer, pev_gravity, get_pcvar_float(g_pCvarGravity))
	}
	
	return HAM_IGNORED;
}

public ChangeModel(iTask)
{
	new bool:bChange;
	new cModel[24];
	new iPlayer;
	iPlayer = iTask + -250;
	bChange = true;
	get_user_model(iPlayer, cModel, 24);
	if (!g_bZombie[iPlayer])
	{
		if (!g_iPlayerType[iPlayer])
		{
			if( get_vip_flags(iPlayer) & MODEL )
			{
				set_user_info( iPlayer, "model", g_szVipModels ) ;
			}
		}
	}
	if (bChange)
	{
		if (!g_bZombie[iPlayer])
		{
			if (!g_iPlayerType[iPlayer])
			{
				if( get_vip_flags(iPlayer) & MODEL )
				{
					set_user_info( iPlayer, "model", g_szVipModels ) 
				}
			}
		}
	}
	return HAM_IGNORED;
}

public client_PreThink(id)
{
	if(!is_user_alive(id) || g_bZombie[id] || (!( get_vip_flags(id) & MULTIJUMP ))) return PLUGIN_CONTINUE
	
	static nbut, obut, fflags
	
	nbut = get_user_button(id)
	obut = get_user_oldbutton(id)
	fflags = get_entity_flags(id)
	
	if((nbut & IN_JUMP) && !(fflags & FL_ONGROUND) && !(obut & IN_JUMP))
	{
		if(jumpnum[id] < get_pcvar_float(g_pCvarMultiJump))
		{
			dojump[id] = true
			jumpnum[id]++
			return PLUGIN_CONTINUE
		}
	}
	if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
	{
		jumpnum[id] = 0
		return PLUGIN_CONTINUE
	}
	return PLUGIN_CONTINUE
}


public client_PostThink(id)
{
	if(!is_user_alive(id) || g_bZombie[id] || (!( get_vip_flags(id) & MULTIJUMP ))) return PLUGIN_CONTINUE
	
	if( dojump[id] == true)
	{
		new Float:velocity[3]	
		entity_get_vector(id,EV_VEC_velocity,velocity)
		velocity[2] = random_float(265.0,285.0)
		entity_set_vector(id,EV_VEC_velocity,velocity)
		dojump[id] = false
		return PLUGIN_CONTINUE
	}
	return PLUGIN_CONTINUE
}

public client_authorized(id)
{
	// Get password from Setinfo
	new szPassword[65]
	get_user_info(id, g_szPasswordKey, szPassword, charsmax(szPassword))
	
	// Player VIP?
	get_vip_flags(id)
	
	if (g_bIsUserVIP[id] )
	{
		if (equal(szPassword, g_szPassword))
		{
			client_cmd(id, "echo ^"* VIP Password Accepted!^"")
		}
		else
		{
			// VIP and wrong Password? Kick him
			client_cmd(id, "echo ^"* VIP Invalid Password!^"")
			server_cmd("kick #%d ^"You have no entry to the server...^"", get_user_userid(id))
		}
	}
	
}

public client_putinserver(id)
{
	if ( get_vip_flags(id) & VIP_MESSAGES)
	{
		if (get_pcvar_num(g_pCvarConnectMessage) != 0)
		{
			new szName[32]
			get_user_name(id, szName, charsmax(szName))
			ColorChat(0, GREEN, "!tVIP !g%s !thas connected to the server!y.", szName)
		}
	}
}

public CmdMotd(id)
{
	show_motd(id, "vip.txt", "Zombie Plague VIP")
}

public CmdVIP(id)
{
	set_task(0.1, "Print_List")
}

public Print_List()
{
	Print_VIP_List()
}

public Print_VIP_List()
{
	new szVIPName[33][32], szMessage[700], szContact[256]
	
	new iPlayer, i, iVIPCount = 0, iLen = 0;
	
	for (iPlayer = 1; iPlayer <= g_iMaxPlayers; iPlayer++)
	{
		if (!is_user_connected(iPlayer))
			continue
		
		if ( get_vip_flags(iPlayer) & VIP_MESSAGES)
		{
			get_user_name(iPlayer, szVIPName[iVIPCount], charsmax(szVIPName))
			iVIPCount++
		}
	}
	
	iLen = formatex(szMessage, charsmax(szMessage), "^4VIPs ONLINE^1: ")
	
	if (iVIPCount > 0)
	{
		for (i = 0; i <= iVIPCount; i++)
		{
			iLen += formatex(szMessage[iLen], charsmax(szMessage) - iLen, "^3%s^1%s^3", szVIPName[i], (i < (iVIPCount - 1)) ? ", " : "")
		}
	}
	else
	{
		szMessage = "^4No VIPs online^1."
	}
	
	ColorChat(0, NORMAL , szMessage)
	
	get_pcvar_string(g_pCvarAdminContact, szContact, charsmax(szContact))
	
	if (szContact[0])
	{
		ColorChat(0, NORMAL, "^1- ^4Contact Server Admin ^1-- ^3%s", szContact)
	}
}

public logevent_round_end()
{
	for (new i = 0; i < g_iMaxPlayers; i++)
	{
		g_bSetVIP[i] = false
	}
}

public _ScoreBoard()
{
	new id = get_msg_arg_int(1)
	if(is_user_alive(id) &&  get_vip_flags(id) & SCOREBOARD  && get_pcvar_num(g_pCvarVIPScoreboard) != 0)
	{
		set_msg_arg_int(2,get_msg_argtype(2), FLAG_SCOREATTRIB_VIP)
	}

}

public native_get_vip_flags(id)
{
	// Our file exists?
	if (file_exists(g_szLocalFile))
	{
		/*
		*	We can't use new file system here, because if file opened it can not be deleted.
		*	Old system provide the suitable way for doing it simply. That's a reason.
		*/

		// Declare some useful variables
		new iMaxLines, szLineToRead[129], szParse[4][65], szName[32], szSteamID[36], iTextLen
		
		// Get max lines number in the file
		iMaxLines = file_size(g_szLocalFile, 1)
		
		// Get our player name and steamid
		get_user_authid(id, szSteamID, charsmax(szSteamID))
		get_user_name(id, szName, charsmax(szName))
		
		// Loop through the whole file
		for (new iLine = 0; iLine < iMaxLines; iLine++)
		{
			// Read line by line
			read_file(g_szLocalFile, iLine, szLineToRead, charsmax(szLineToRead), iTextLen)
			
			// Remove any space, useful to remove blank lines which only contain spaces
			trim(szLineToRead)
			
			// Check if string empty or starting with ; or // ignore the line
			if (strlen(szLineToRead) == 0 || szLineToRead[0] == ';' || (szLineToRead[0] == '/' && szLineToRead[1] == '/'))
				continue
			
			// Split our line by spaces to 4 parts: name or steam, password, flags, expire date
			parse(szLineToRead, szParse[0], charsmax(szParse[]), szParse[1], charsmax(szParse[]), szParse[2], charsmax(szParse[]), szParse[3], charsmax(szParse[]))
			
			// Remove all "" from our 4 parts
			remove_quotes(szParse[0])
			remove_quotes(szParse[1])
			remove_quotes(szParse[2])
			remove_quotes(szParse[3])
			
			// Check expire date for this steam/name (Steam/Name unique to check with)
			CheckDate(szParse[3], szParse[0])
			
			// Check if user in file is same who we check
			if (equali(szSteamID, szParse[0]) || equali(szName, szParse[0]))
			{
				// Player exists in the file, this means he is VIP
				g_bIsUserVIP[id] = true
				copy(g_szPassword, charsmax(g_szPassword), szParse[1])
				
				// Return his flags
				return read_flags(szParse[2])
			}
		}
	}
	else
	{
		// File not exists, then create it (Here we can use new file system without problems)
		new iFileHandler = fopen(g_szLocalFile, "wt")
		
		fputs(iFileHandler, "; Zombie Escape VIP^n^n")
		fputs(iFileHandler, ";Flags:^n^n")
		fputs(iFileHandler, "; a -- Connect Message and VIP List^n")
		fputs(iFileHandler, "; b -- Scoreboard Attrib^n")
		fputs(iFileHandler, "; c -- Multi-Jump^n")
		fputs(iFileHandler, "; d -- Health++^n")
		fputs(iFileHandler, "; e -- Armor++^n")
		fputs(iFileHandler, "; f -- Gravity++^n")
		fputs(iFileHandler, "; g -- NoClip^n")
		fputs(iFileHandler, "; h -- VIP Damage^n")
		fputs(iFileHandler, "; i -- No Fall Damage^n")
		fputs(iFileHandler, "; m -- VIP Model^n^n")
		fputs(iFileHandler, ";Usage Example:^n^n")
		fputs(iFileHandler, "; ^"Steam/Nick^" ^"Password^" ^"Flags^" ^"ExpireDate^"")

		fclose(iFileHandler)
	}
	
	g_bIsUserVIP[id] = false
	
	if (g_bSetVIP[id] == true)
	{
		return g_iFlags[id]
	}
	else
	{
		return NON_VIP
	}
	return 0;
}

public native_set_vip_flags(id, Flags)
{
	g_bSetVIP[id] = true
	g_iFlags[id] = Flags
	get_vip_flags(id)
}

public native_is_user_vip(id)
{
	if ( get_vip_flags(id) & VIP_Z)
		return false
	
	return true
}

/*
*	Dedicated stock for our plugin, to delete expired lines.
*	You should give it the expire date, and key.
*	Key should be unique like steam or name, so we can in another stock detect this line and delete it.
*/
stock CheckDate(const szEndDate[], const szKey[])
{
	new szCurrentDate[64],
		szFormatedEndDate[64],
		szCurrentDay[32],
		szCurrentMonth[32],
		szCurrentYear[32],
		szEndDay[32],
		szEndMonth[32],
		szEndYear[32]
		
	copy(szFormatedEndDate, charsmax(szFormatedEndDate), szEndDate)
	get_time("%d-%m-%Y", szCurrentDate, charsmax(szCurrentDate))
	
	for (new ch = 0; ch <= charsmax(szFormatedEndDate); ch++)
	{
		if (szFormatedEndDate[ch] == '-')
			szFormatedEndDate[ch] = ' '
	}
	
	for (new ch = 0; ch <= charsmax(szCurrentDate); ch++)
	{
		if (szCurrentDate[ch] == '-')
			szCurrentDate[ch] = ' '
	}

	parse(szCurrentDate, szCurrentDay, charsmax(szCurrentDay), szCurrentMonth, charsmax(szCurrentMonth), szCurrentYear, charsmax(szCurrentYear))
	parse(szFormatedEndDate, szEndDay, charsmax(szEndDay), szEndMonth, charsmax(szEndMonth), szEndYear, charsmax(szEndYear))
	
	if (str_to_num(szFormatedEndDate) == 0)
		return
	
	new iCurrentDay,
		iCurrentMonth,
		iCurrentYear,
		iEndDay,
		iEndMonth,
		iEndYear
	
	iCurrentDay   = str_to_num(szCurrentDay)
	iCurrentMonth = str_to_num(szCurrentMonth)
	iCurrentYear  = str_to_num(szCurrentYear)
	
	iEndDay   = str_to_num(szEndDay)
	iEndMonth = str_to_num(szEndMonth)
	iEndYear  = str_to_num(szEndYear)
	
	// Just a check, maybe useless
	if ((!iCurrentDay && !iCurrentMonth && !iCurrentYear) || (!iEndDay && !iEndMonth && !iEndYear))
		return
	
	/*
	*	Check expire date algorithm idea:
	*	
	*	If current year > Expire year -- This means it's already expired so delete this line.
	*
	*	If Same year then check by month:
	*	If current month > expire month -- Expired delete the line.
	*
	*	If same month then check by day:
	*	If current day > expire date -- Expired detete the line.
	*/
	
	if (iEndYear < iCurrentYear)
	{
		Delete_Line(g_szLocalFile, szKey)
	}
	else if (iEndYear == iCurrentYear)
	{
		if (iEndMonth < iCurrentMonth)
		{
			Delete_Line(g_szLocalFile, szKey)
		}
		else if (iEndMonth == iCurrentMonth)
		{
			if (iEndDay < iCurrentDay)
			{
				Delete_Line(g_szLocalFile, szKey)
			}
		}
	}
}

/*
*	Stock used to delete line in file, based on key.
*	Key is steamid or name.
*	For some purposes we can't use new file system here.
*/
stock Delete_Line(const szFile[], const szKey[])
{
	// Check if file there or not
	if (file_exists(szFile))
	{
		// Get max lines in the file
		new iMaxLines = file_size(szFile, 1)
		
		// Some variables
		new Array:szFileLines, szLineToRead[400], iTextLen, szParse[4][65]
		
		// Create dynamic array to handle all lines in our file (every line will be in element)
		szFileLines = ArrayCreate(400)
		
		// Loop through whole file
		for (new iLine = 0; iLine < iMaxLines; iLine++)
		{
			// Read line by line
			read_file(szFile, iLine, szLineToRead, charsmax(szLineToRead), iTextLen)
			
			// Just split our line so we get the steamid or name and compare with key
			parse(szLineToRead, szParse[0], charsmax(szParse[]), szParse[1], charsmax(szParse[]), szParse[2], charsmax(szParse[]), szParse[3], charsmax(szParse[]))
			
			// Remove any ""
			remove_quotes(szParse[0])
			remove_quotes(szParse[1])
			remove_quotes(szParse[2])
			remove_quotes(szParse[3])
			
			// If steamid or name is same as one we need to delete, then don't copy to our array
			if (equal(szParse[0], szKey))
				continue
			
			// Push all lines to our array except one we need to delete
			ArrayPushString(szFileLines, szLineToRead)
		}
		
		// Delete the file
		delete_file(szFile)
		
		// Recreate the file and print all data to it
		for (new iLine = 0; iLine < ArraySize(szFileLines); iLine++)
		{
			// Get strings in our array
			ArrayGetString(szFileLines, iLine, szLineToRead, charsmax(szLineToRead))
			
			// Write them to our file
			write_file(szFile, szLineToRead)
		}
		
		// Destroy this array and free it's memory
		ArrayDestroy(szFileLines)
	}
}

public _HappyHours()
{
	Happy_Hours()
	
	if (g_bIsHappyHour == true && get_pcvar_num(g_pCvarEnableHappyHours) != 0)
	{
		new szFlags[VIP_MAX_FLAGS]
		new szPlayers[ 32 ], iNum;
		get_players( szPlayers, iNum );
		get_pcvar_string(g_pCvarHappyHoursFlags, szFlags, charsmax(szFlags))
		
		for( new iPlayers, i; i < iNum; i++ )
		{
			iPlayers = szPlayers[ i ];
			set_vip_flags(iPlayers, read_flags(szFlags))
		}
	}
	
}
stock Happy_Hours()
{
	new szTime[3], szHappyHours[32], szHappyHours_Start[32], szHappyHours_End[32]
	get_time("%H", szTime, charsmax(szTime))
	
	get_pcvar_string(g_pCvarHappyHours, szHappyHours, charsmax(szHappyHours))
	
	for (new ch = 0; ch <= charsmax(szHappyHours); ch++)
	{
		if (szHappyHours[ch] == '-')
			szHappyHours[ch] = ' '
	}
	
	parse(szHappyHours, szHappyHours_Start, charsmax(szHappyHours_Start), szHappyHours_End, charsmax(szHappyHours_End))
	
	new iTime, iHappyHourStart, iHappyHourEnd
	
	iTime = str_to_num(szTime)
	iHappyHourStart = str_to_num(szHappyHours_Start)
	iHappyHourEnd = str_to_num(szHappyHours_End)
	
	if(iHappyHourEnd > iTime >= iHappyHourStart)
	{
		g_bIsHappyHour = true
	}
	else
	{
		g_bIsHappyHour = false
	}
}
[Codebox=amxx file=Untitled.amxx][/Codebox]

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#5

Post by Raheem » 3 years ago

[mention]Supremache[/mention] are you using our Zombie Escape Mod?
He who fails to plan is planning to fail

User avatar
Supremache
Member
Member
Egypt
Posts: 9
Joined: 3 years ago
Contact:

#6

Post by Supremache » 3 years ago

Raheem wrote: 3 years ago @Supremache are you using our Zombie Escape Mod?
No!!
No support for other mods?

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#7

Post by Raheem » 3 years ago

Yes, we only support our Zombie Escape Mod.
He who fails to plan is planning to fail

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 2 guests