Page 1 of 1

Free V.I.P Time

Posted: 27 Dec 2018, 15:58
by Muhammet20
Hello Guys,
I Want A Free V.I.P Time Plugin
I Want It From 17:00 To 07:00
I Don't Want Any Addon On The Plugin.........Thanks

Re: Free V.I.P Time

Posted: 07 Jan 2019, 04:17
by Night Fury
Do you use zombie escape VIP or another VIP plugin?
What are the natives/code of the VIP plugin you're using?

Re: Free V.I.P Time

Posted: 07 Jan 2019, 14:10
by Muhammet20
Jack GamePlay wrote: 5 years ago Do you use zombie escape VIP or another VIP plugin?
What are the natives/code of the VIP plugin you're using?
i using VIPsystem.sma
here is the include :

Code: Select all

/* Access flags */
#define VIP_FLAG_ALL 0      // Any flag
#define VIP_FLAG_A (1<<0)   // Flag "a"
#define VIP_FLAG_B (1<<1)   // Flag "b"
#define VIP_FLAG_C (1<<2)   // Flag "c"
#define VIP_FLAG_D (1<<3)   // Flag "d"
#define VIP_FLAG_E (1<<4)   // Flag "e"
#define VIP_FLAG_F (1<<5)   // Flag "f"
#define VIP_FLAG_G (1<<6)   // Flag "g"
#define VIP_FLAG_H (1<<7)   // Flag "h"
#define VIP_FLAG_I (1<<8)   // Flag "i"
#define VIP_FLAG_J (1<<9)   // Flag "j"
#define VIP_FLAG_K (1<<10)  // Flag "k"
#define VIP_FLAG_L (1<<11)  // Flag "l"
#define VIP_FLAG_M (1<<12)  // Flag "m"
#define VIP_FLAG_N (1<<13)  // Flag "n"
#define VIP_FLAG_O (1<<14)  // Flag "o"
#define VIP_FLAG_P (1<<15)  // Flag "p"
#define VIP_FLAG_Q (1<<16)  // Flag "q"
#define VIP_FLAG_R (1<<17)  // Flag "r"
#define VIP_FLAG_S (1<<18)  // Flag "s"
#define VIP_FLAG_T (1<<19)  // Flag "t"
#define VIP_FLAG_U (1<<20)  // Flag "u"
#define VIP_FLAG_V (1<<21)  // Flag "v"
#define VIP_FLAG_W (1<<22)  // Flag "w"
#define VIP_FLAG_X (1<<23)  // Flag "x"
#define VIP_FLAG_Y (1<<24)  // Flag "y"
#define VIP_FLAG_Z (1<<25)  // Flag "z"

/* Returns 1 if player is VIP, otherwise 0 */
native VSGetUserVip(id)

/* Returns 1 if player have a flag, otherwise 0 */
native VSGetVipFlag(id, flag)

/* Returns flags the player as sum of bits */
native VSGetVipFlags(id)

/* Register new item
Parameters: 
	name - item name
	flag - access flag
Returns:
	id of item
*/
native VSRegisterItem(name[], flag)

/* Returns 1 if the privilege is enabled, otherwise 0 */
native VSGetItemState(id)

/* Activate the privilege on the menu */
native VSEnableItem(id)

/* Disables the privilege of the menu */
native VSDisableItem(id)

/* Sets the privileges name of the menu */
native VSSetItemName(id, name[])

/* Called when the player has chosen an element */
forward VSItemSelected(id, itemid)

/* Called when a VIP connects */
forward VSVipConnect(id)

/* Called when player opening menu */
forward VSOpeningMenu(id)

here is the normal plugin :

Code: Select all

/* VIPSystem v1.4 */

#include <amxmodx>
#include <hamsandwich>

#define VIP_STEAM 	(1<<0)
#define VIP_IP 		(1<<1)
#define VIP_NAME 	(1<<2)

new const fileName[] = "vips.ini";

new Array:vipAuthArray;
new Array:vipPasswordArray;
new Array:vipAccessArray;
new Array:vipFlagsArray;
new vipsNumber = 0;

new cvarPasswordField;

new forwardVipConnect, result;

new bool:vip[33], vipFlags[33];

new letter[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
new currentDate[9], maxPlayers;
new g_happy_hour
public plugin_init() 
{
	register_plugin("VIPSystem", "1.4", "ZETA [M|E|N]");
	
	register_dictionary("VIPSystem.txt");
	
	cvarPasswordField = register_cvar("vs_password_field", "_pw");
	
	forwardVipConnect = CreateMultiForward("VSVipConnect", ET_CONTINUE, FP_CELL);
	
	get_time("%d.%m.%y", currentDate, charsmax(currentDate));
	maxPlayers = get_maxplayers();
	
	new configsDir[64];
	get_localinfo("amxx_configsdir", configsDir, charsmax(configsDir));
	server_cmd("exec %s/vips.cfg", configsDir);
	
	LoadVipList();
	
	register_concmd("vips_list", "ShowVipsList", ADMIN_ALL, "Show Vips List");
	register_clcmd("addvip", "AddVip", ADMIN_ALL, "Add Vip");
	
	g_happy_hour = register_cvar("zp_vip_happy_hour", "off")
	}
static string[5]
	get_pcvar_string(g_allow_jump, string, charsmax(string))
	g_bit = read_flags(string)
	chache_g_jumps = get_pcvar_num(g_jumps)
	
	static hours[6], hour1s[3], hour2s[3], hour1, hour2, h, m, s
	get_pcvar_string(g_happy_hour, hours, charsmax(hours))
		
	if(equal(hours, "off")) {happy_hour_on = false; return; }
		
	strtok(hours, hour1s, charsmax(hour1s), hour2s, charsmax(hour2s), '-')
	hour1 = str_to_num(hour1s)
	hour2 = str_to_num(hour2s)
		
	time(h, m, s)
	if(hour1 <= h <= hour2) happy_hour_on = true
	else happy_hour_on = false
public plugin_precache()
{
	vipAuthArray = ArrayCreate(44, 1);
	vipPasswordArray = ArrayCreate(32, 1);
	vipFlagsArray = ArrayCreate(1, 1);
	vipAccessArray = ArrayCreate(1, 1);
}

FindFlag(const arr[], const ch)
{
	new size = strlen(arr);
	for (new i = 0; i < size; i++)
	{
		if (arr[i] == ch)
		{
			return true;
		}
	}
	
	return false;
}

ReadAccessFlags(const str[])
{
	new flagsBin = 0;
	for (new i = 0; i < 26; i++)
	{
		if (FindFlag(str, letter[i]))
		{
			flagsBin |= (1<<i);
		}
	}

	return flagsBin;
}

ReadAccountFlags(const str[])
{
	new accBin = 0;
	for (new i = 0; i < 3; i++)
	{
		if (FindFlag(str, letter[i]))
		{
			accBin |= (1<<i);
		}
	}
	
	return accBin;
}

LoadVip(const auth[], const pass[], const acc[], const flags[])
{
	ArrayPushString(vipAuthArray, auth);
	ArrayPushString(vipPasswordArray, pass);
	ArrayPushCell(vipAccessArray, ReadAccessFlags(acc));
	ArrayPushCell(vipFlagsArray, ReadAccountFlags(flags));
}

LoadVipList()
{
	new path[64];
	get_localinfo("amxx_configsdir", path, charsmax(path));
	format(path, charsmax(path), "%s/%s", path, fileName);
	
	new file = fopen(path, "r+");
	
	if (!file)
	{
		log_to_file("VIPSystem.txt", "LoadVipList(): %L", LANG_SERVER, "NO_FILE", path);
		return;
	}
	
	new text[121], auth[44], pass[32], acc[26], flags[3], expiredDate[9], pos;
	while (!feof(file))
	{
		pos = ftell(file);
		fgets(file, text, charsmax(text));
		
		trim(text);
		
		if ((text[0] == ';') || !strlen(text)) 
		{ 
			continue; 
		}
		
		if (parse(text, auth, charsmax(auth), pass, charsmax(pass), acc, charsmax(acc), flags, charsmax(flags), expiredDate, charsmax(expiredDate)) != 5)
		{
			log_to_file("VIPSystem.txt", "LoadVipList(): %L", LANG_SERVER, "INVALID_FORMAT", text);
			continue;
		}
		
		if (equal(currentDate, expiredDate))
		{
			fseek(file, pos, SEEK_SET); 
			fprintf(file, ";%s", text);
			fseek(file, 0, SEEK_CUR);
			continue;
		}
			
		LoadVip(auth, pass, acc, flags);
		++vipsNumber;
	}
		
	fclose(file);
	
	switch (vipsNumber)
	{
		case 0: server_print("[VIPSystem] %L", LANG_SERVER, "NO_VIPS");
		case 1: server_print("[VIPSystem] %L", LANG_SERVER, "LOADED_VIP");
		default: server_print("[VIPSystem] %L", LANG_SERVER, "LOADED_VIPS", vipsNumber);
	}
}

RemoveAccess(const id)
{
	vip[id] = false;
	vipFlags[id] = 0;
}

GetAccess(const id)
{
	new userName[32], passField[32], userPass[32], userAuth[32], userIp[44];
	get_user_info(id, "name", userName, charsmax(userName));
	get_pcvar_string(cvarPasswordField, passField, charsmax(passField));
	get_user_info(id, passField, userPass, charsmax(userPass));
	get_user_authid(id, userAuth, charsmax(userAuth));
	get_user_ip(id, userIp, charsmax(userIp), 1);
	
	RemoveAccess(id);
	
	new auth[44], pass[32], acc, flags;
	for (new i = 0; i < vipsNumber; i++)
	{
		ArrayGetString(vipAuthArray, i, auth, charsmax(auth));
		ArrayGetString(vipPasswordArray, i, pass, charsmax(pass));
		acc = ArrayGetCell(vipAccessArray, i);
		flags = ArrayGetCell(vipFlagsArray, i);
		
		if (((flags & VIP_STEAM) && equal(auth, userAuth)) || ((flags & VIP_IP) && equal(auth, userIp)))
		{
			vip[id] = true;
			vipFlags[id] = acc;
			break;
		}
		else if ((flags & VIP_NAME) && equal(auth, userName))
		{
			if (equal(pass, userPass))
			{
				vip[id] = true;
				vipFlags[id] = acc;
			}
			else
			{
				server_cmd("kick #%d ^"You have no entry to the server...^"", get_user_userid(id));
			}
			
			break;
		}
	}
}

ConnectGetAccess(const id)
{
	GetAccess(id);
	
	if (vip[id])
	{
		ExecuteForward(forwardVipConnect, result, id);
	}
}

// Events

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

public client_disconnect(id)
{
	RemoveAccess(id);
}

public client_infochanged(id)
{
	new newname[32], oldname[32];
	get_user_name(id, oldname, charsmax(oldname));
	get_user_info(id, "name", newname, charsmax(newname));
	
	if (!equal(newname, oldname))
	{
		GetAccess(id);
	}
}

// Natives

public plugin_natives()
{	
	register_native("VSGetUserVip", "NativeGetUserVip", 1);
	register_native("VSGetVipFlag", "NativeGetVipFlag", 1);
	register_native("VSGetVipFlags", "NativeGetVipFlags", 1);
}

public NativeGetUserVip(id)
{
	if (!IsUser(id))
	{
		log_to_file("VIPSystem.txt", "NativeGetUserVip(id): %L", LANG_SERVER, "OUT_OF_RANGE", id);
		return false;
	}
	
	return vip[id];
}

public NativeGetVipFlag(id, flag)
{
	if (!IsUser(id))
	{
		log_to_file("VIPSystem.txt", "NativeGetVipFlag(id, flag): %L", LANG_SERVER, "OUT_OF_RANGE", id);
		return false;
	}
	
	if (!vip[id])
	{
		return false;
	}
	
	if (flag && !(vipFlags[id] & flag))
	{
		return false;
	}
	
	return true;
}

public NativeGetVipFlags(id)
{
	if (!IsUser(id))
	{
		log_to_file("VIPSystem.txt", "NativeGetVipFlags(id): %L", LANG_SERVER, "OUT_OF_RANGE", id);
		return 0;
	}
	
	return vipFlags[id];
}

// Commands

public ShowVipsList(id)
{
	if (id)
	{
		client_print(id, print_console, "Unknown command: vips_list");
		return PLUGIN_HANDLED;
	}
	
	new auth[44], pass[32], accBin, flagsBin, acc[26], flags[3];
	server_print("%L", LANG_SERVER, "VIPS_LIST");
	
	if (!vipsNumber)
	{
		server_print("%L", LANG_SERVER, "NO_VIPS");
		return PLUGIN_HANDLED;
	}
	
	for(new i = 0; i < vipsNumber; i++)
	{
		ArrayGetString(vipAuthArray, i, auth, charsmax(auth));
		ArrayGetString(vipPasswordArray, i, pass, charsmax(pass));
		accBin = ArrayGetCell(vipAccessArray, i);
		flagsBin = ArrayGetCell(vipFlagsArray, i);
		
		format(acc, charsmax(acc), "");
		for (new i = 0, len = 0; i < 26; i++)
		{
			if (accBin & (1<<i))
			{
				strcat(acc, letter[i], ++len);
			}
		}
		
		format(flags, charsmax(flags), "");
		for (new i = 0, len = 0; i < 3; i++)
		{
			if (flagsBin & (1<<i))
			{
				strcat(flags, letter[i], ++len);
			}
		}
		
		server_print("^"%s^" ^"%s^" ^"%s^" ^"%s^"", auth, pass, acc, flags);
	}
	
	return PLUGIN_HANDLED;
}

public AddVip(id)
{
	if (!(get_user_flags(id) & ADMIN_CVAR))
	{
		client_print(id, print_console, "%L", id, "NO_ACC_COM");
		return PLUGIN_HANDLED;
	}
	
	new text[121], auth[44], pass[32], flags[26], acc[3] , vipEndDate[8];
	read_args(text, charsmax(text));

	if (parse(text, auth, charsmax(auth), pass, charsmax(pass), acc, charsmax(acc), flags, charsmax(flags), vipEndDate, charsmax(vipEndDate)) != 5)
	{
		client_print(id, print_console, "%L", LANG_SERVER, "FORMAT_ADD");
		return PLUGIN_HANDLED;
	}
	
	new path[64];
	get_localinfo("amxx_configsdir", path, charsmax(path));
	format(path, charsmax(path), "%s/%s", path, fileName);
	
	new file = fopen(path, "a");
	
	if (file)
	{
		fseek(file, 0, SEEK_END);
		fprintf(file, "^n^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^"", auth, pass, acc, flags, vipEndDate);
		fclose(file);
	}
			
	LoadVip(auth, pass, flags, acc);
	client_print(id, print_console, "[VIPSystem] %L", LANG_SERVER, "VIP_ADDED");
	return PLUGIN_HANDLED;
}

// Other

public IsUser(id)
{
	return (1 <= id <= maxPlayers);
}

public plugin_end()
{
	ArrayDestroy(vipAuthArray);
	ArrayDestroy(vipPasswordArray);
	ArrayDestroy(vipFlagsArray);
	ArrayDestroy(vipAccessArray);
}
to get vip flags
VSGetVipFlag(id, VIP_FLAG_AnyFlag)

but i don't know how i can set an vip at an time

Re: Free V.I.P Time

Posted: 09 Jan 2019, 08:38
by Muhammet20
Jack GamePlay wrote: 5 years ago Do you use zombie escape VIP or another VIP plugin?
What are the natives/code of the VIP plugin you're using?
hey man i gave you the code
please help me

Re: Free V.I.P Time

Posted: 09 Jan 2019, 12:46
by Spir0x
dude on this forum we can help only ze v1.1 // 1.2 & 1.3 old mods or another not supported here.

Re: Free V.I.P Time

Posted: 11 Jan 2019, 07:55
by Muhammet20
Spir0x wrote: 5 years ago dude on this forum we can help only ze v1.1 // 1.2 & 1.3 old mods or another not supported here.
ok np , i will delete this topic