Approved VIP System

Gameplay Addons
User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1956
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

Re: VIP System

#31

Post by Raheem » 2 Years Ago

Upload the file you try to compile.
You don't know? Learn and you will know.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 633
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 7 times
Age: 19
Contact:

#32

Post by Spir0x » 2 Years Ago

how ? you mean the code?
I trynna make money, not friends.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 633
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 7 times
Age: 19
Contact:

#33

Post by Spir0x » 2 Years Ago

that is the code:
  • Code: Select all

    #include <ze_vip>
    
    // Variables
    new g_szPasswordKey[65], g_szPassword[65]
    new bool:g_bIsUserVIP[33], bool:g_bSetVIP[33], g_iFlags[33], bool:g_bIsHappyHour
    
    // Const.
    static const COLOR[] = "^x04"
    static const g_szLocalFile[] = "addons/amxmodx/configs/ze_vips.ini"
    
    new const szCommands[][] =
    {
    	"say /vip",
    	"say /vips",
    	"say_team /vip",
    	"say_team /vips"
    }
    
    // Cvars
    new Cvar_Show_VIP_Scoreboard, Cvar_Give_Multijump, Cvar_Connect_Message, Cvar_Admin_Contact,
    Cvar_Give_Parachute, Cvar_Enable_Happy_Hours, Cvar_Happy_Hour_Start, Cvar_Happy_Hour_End,
    Cvar_VIP_Flag
    
    public plugin_natives()
    {
    	register_native("ze_get_vip_flags", "native_ze_get_vip_flags", 1)
    	register_native("ze_set_vip_flags", "native_ze_set_vip_flags", 1)
    }
    
    public plugin_init()
    {
    	register_plugin("[ZE] Zombie Escape VIP", VIP_VERSION, AUTHORS)
    	
    	// Hook Chains
    	RegisterHookChain(RG_CBasePlayer_Spawn, "Fw_PlayerSpawn_Post", 1)
    	
    	// Cvars
    	Cvar_Connect_Message = register_cvar("ze_connect_message", "1")
    	Cvar_Admin_Contact = register_cvar("ze_admin_contact", "Admin Name")
    	Cvar_Give_Multijump = register_cvar("ze_give_vip_multijump", "1")
    	Cvar_Show_VIP_Scoreboard = register_cvar("ze_show_vip_scoreboard", "1")
    	Cvar_Give_Parachute = register_cvar("ze_give_vip_parachute", "1")
    	Cvar_Enable_Happy_Hours = register_cvar("ze_enable_happy_hours", "1")
    	Cvar_Happy_Hour_Start = register_cvar("ze_happy_hours_start", "9")
    	Cvar_Happy_Hour_End = register_cvar("ze_happy_hours_end", "12")
    	Cvar_VIP_Flag = register_cvar("ze_happy_hours_vip_flags", "abcd")
    	
    	register_cvar("ze_vip_version", VIP_VERSION, FCVAR_SERVER|FCVAR_SPONLY)
    	set_cvar_string("ze_vip_version", VIP_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)
    }
    
    public plugin_cfg()
    {
    	// Get our configiration file and Execute it
    	new szCfgDir[64]
    	get_localinfo("amxx_configsdir", szCfgDir, charsmax(szCfgDir))
    	server_cmd("exec %s/ze_vip.cfg", szCfgDir)
    }
    
    public client_authorized(id)
    {
    	// Get password from Setinfo
    	new szPassword[65]
    	get_user_info(id, g_szPasswordKey, szPassword, charsmax(szPassword))
    	
    	// Player VIP?
    	ze_get_vip_flags(id)
    	
    	if (g_bIsUserVIP[id])
    	{
    		if (!equal(szPassword, g_szPassword))
    		{
    			// 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))
    		}
    		else
    		{
    			client_cmd(id, "echo ^"* VIP Password Accepted!^"")
    		}
    	}
    }
    
    public client_putinserver(id)
    {
    	if (ze_get_vip_flags(id) & VIP_A)
    	{
    		if (get_pcvar_num(Cvar_Connect_Message) != 0)
    		{
    			new szName[32]
    			get_user_name(id, szName, charsmax(szName))
    			ze_colored_print(0, "!tVIP !g%s !tConnected!y.", szName)
    		}
    	}
    }
    
    public CmdMotd(id)
    {
    	show_motd(id, "ze_vip.txt", "Zombie Escape VIP")
    }
    
    public CmdVIP(id)
    {
    	set_task(0.1, "Print_VIP_Names", id)
    }
    
    public Print_VIP_Names(id)
    {
    	new szAdminName[33][32], szMessage[256]
    	new szContactInfo[256], szContact[112]
    	new id, iCount, x, iLen
    	
    	for (id = 1 ; id <= get_member_game(m_nMaxPlayers) ; id++)
    	{
    		if (is_user_connected(id) && (ze_get_vip_flags(id) & VIP_A))
    		{
    			get_user_name(id, szAdminName[iCount++], charsmax(szAdminName))
    		}
    
    		iLen = format(szMessage, charsmax(szMessage), "%sVIPs ONLINE: ", COLOR)
    		
    		if (iCount > 0)
    		{
    			for (x = 0 ; x < iCount ; x++)
    			{
    				iLen += format(szMessage[iLen], charsmax(szMessage) - iLen, "%s%s ", szAdminName[x], x < (iCount - 1) ? ", " : "")
    				
    				if (iLen > 96 )
    				{
    					print_message(id, szMessage)
    					iLen = format(szMessage, charsmax(szMessage), "%s ", COLOR)
    				}
    			}
    			
    			print_message(id, szMessage)
    		}
    		else
    		{
    			iLen += format(szMessage[iLen], charsmax(szMessage) - iLen, "No VIPs online.")
    			print_message(id, szMessage)
    		}
    		
    		get_pcvar_string(Cvar_Admin_Contact, szContact, charsmax(szContact))
    		
    		if (szContact[0])
    		{
    			format(szContactInfo, charsmax(szContactInfo), "%s- Contact Server Admin -- %s", COLOR, szContact)
    			print_message(id, szContactInfo)
    		}
    	}
    }
    
    public Fw_PlayerSpawn_Post(id)
    {
    	if (!is_user_alive(id))
    		return
    	
    	Happy_Hours()
    	
    	if (g_bIsHappyHour == true && get_pcvar_num(Cvar_Enable_Happy_Hours) != 0)
    	{
    		new szFlags[VIP_MAX_FLAGS]
    		get_pcvar_string(Cvar_VIP_Flag, szFlags, charsmax(szFlags))
    		ze_set_vip_flags(id, read_flags(szFlags))
    	}
    	
    	// Get password from Setinfo
    	new szPassword[65]
    	get_user_info(id, g_szPasswordKey, szPassword, charsmax(szPassword))
    	
    	ze_get_vip_flags(id)
    	
    	if (g_bIsUserVIP[id])
    	{
    		if (!equal(szPassword, g_szPassword))
    		{
    			// 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))
    		}
    		else
    		{
    			client_cmd(id, "echo ^"* VIP Password Accepted!^"")
    		}
    	}
    	
    	if (ze_get_vip_flags(id) & VIP_B)
    	{
    		if (get_pcvar_num(Cvar_Give_Multijump) != 0)
    		{
    			ze_give_user_multijump(id)
    		}
    	}
    	
    	if (ze_get_vip_flags(id) & VIP_C)
    	{
    		if (get_pcvar_num(Cvar_Give_Parachute) != 0)
    		{
    			ze_give_user_parachute(id)
    		}
    	}
    
    	set_task(0.1, "Update_Attribute", id, _, _, "a", 10)
    }
    
    public ze_roundend(WinTeam)
    {
    	for (new i = 0; i < get_member_game(m_nMaxPlayers); i++)
    	{
    		g_bSetVIP[i] = false
    	}
    }
    
    public Update_Attribute(id)
    {
    	if ((ze_get_vip_flags(id) & VIP_D) && get_pcvar_num(Cvar_Show_VIP_Scoreboard) != 0)
    	{
    		message_begin(MSG_ALL, get_user_msgid("ScoreAttrib"), {0, 0, 0}, id)
    		write_byte(id)
    		write_byte(4)
    		message_end()
    	}
    }
    
    public native_ze_get_vip_flags(id)
    {
    	if (file_exists(g_szLocalFile))
    	{
    		new iMaxLines = file_size(g_szLocalFile, 1)
    		new szLineToRead[129]
    		new szSteamID[35], szName[32]
    		new szParse[3][65]
    		
    		get_user_authid(id, szSteamID, charsmax(szSteamID))
    		get_user_name(id, szName, charsmax(szName))
    		
    		for (new iLineToRead = 0; iLineToRead < iMaxLines; iLineToRead++)
    		{
    			read_file(g_szLocalFile, iLineToRead, szLineToRead, charsmax(szLineToRead))
    			parse(szLineToRead, szParse[0], 64, szParse[1], 64, szParse[2], 64)
    			
    			remove_quotes(szParse[0])
    			remove_quotes(szParse[1])
    			remove_quotes(szParse[2])
    			
    			if (!szParse[0][0] || szParse[0][0] == ';' || (szParse[0][0] == '/' && szParse[0][1] == '/'))
    				continue
    			
    			if ((equali(szSteamID, szParse[0]) && szParse[0][0] == 'S') || equali(szName, szParse[0]))
    			{
    				g_bIsUserVIP[id] = true
    				copy(g_szPassword, charsmax(g_szPassword), szParse[1])
    
    				return read_flags(szParse[2])
    			}
    		}
    	}
    	else
    	{
    		write_file(g_szLocalFile, "; Zombie Escape VIP^n^n;Flags:^n")
    		write_file(g_szLocalFile, "; a -- Connect Message and VIP List")
    		write_file(g_szLocalFile, "; b -- Multi-Jump")
    		write_file(g_szLocalFile, "; c -- Parachute")
    		write_file(g_szLocalFile, "; d -- Scoreboard Attrib.^n^n;Examples:^n")
    		write_file(g_szLocalFile, "; ^"Steam/Nick^" ^"Password^" ^"Flags^"")
    	}
    	
    	g_bIsUserVIP[id] = false
    	
    	if (g_bSetVIP[id] == true)
    	{
    		return g_iFlags[id]
    	}
    	else
    	{
    		return VIP_Z
    	}
    }
    
    public native_ze_set_vip_flags(id, Flags)
    {
    	g_bSetVIP[id] = true
    	g_iFlags[id] = Flags
    	ze_get_vip_flags(id)
    }
    
    stock Happy_Hours()
    {
    	new szTime[3]
    	get_time("%H", szTime, charsmax(szTime))
    
    	if(get_pcvar_num(Cvar_Happy_Hour_End) > str_to_num(szTime) >= get_pcvar_num(Cvar_Happy_Hour_Start))
    	{
            g_bIsHappyHour = true
    	}
    	else
    	{
    		g_bIsHappyHour = false
    	}
    }
    
    stock print_message(id, msg[])
    {
    	message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, id)
    	write_byte(id)
    	write_string(msg)
    	message_end()
    }
    /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
    *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
    */
    
That is the file:
https://www.mediafire.com/?gulahelqt5hbpu2
Last edited by Raheem on 02 Jul 2017, 13:00, edited 1 time in total.
Reason: Added code tag
I trynna make money, not friends.

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1956
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#34

Post by Raheem » 2 Years Ago

It compile. Fix your compiler.
  • Image
You don't know? Learn and you will know.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 633
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 7 times
Age: 19
Contact:

#35

Post by Spir0x » 2 Years Ago

you mean i download latest compiler?
I trynna make money, not friends.

johnnysins2000
Veteran Member
Veteran Member
Pakistan
Posts: 672
Joined: 2 Years Ago
Location: Lahore
Has thanked: 11 times
Been thanked: 10 times
Age: 22
Contact:

#36

Post by johnnysins2000 » 2 Years Ago

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

Error: Number of arguments does not match definition on line 253
Warning: Function "native_ze_get_vip_flags" should return a value on line 292

1 Error.
Could not locate output file E:\My old windows 8 things\amxmodx\AMX Mod X\amxxstudio\ZE_SMA\ze_vip_system.amx (compile failed).


sorry this sma is not compiling raheem :P
Nobody Is That Busy If They Make Time :roll:

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 633
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 7 times
Age: 19
Contact:

#37

Post by Spir0x » 2 Years Ago

Yes :/
I trynna make money, not friends.

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1956
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#38

Post by Raheem » 2 Years Ago

This error and warning will appear if you using 1.8.2 compiler as this compiler is old and can't understand good what i need to say :lol: :lol:
If you using 1.8.3 compiler you will not find error or warning. The file updated, now you can compile with 1.8.2 compiler.
You don't know? Learn and you will know.

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1956
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#39

Post by Raheem » 2 Years Ago

Trail plugin for VIP for our new VIP system:
You don't know? Learn and you will know.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 633
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 7 times
Age: 19
Contact:

#40

Post by Spir0x » 2 Years Ago

Raheem if you can update vip system and i have idea actually not new :V
so u update this and when round starts server give m249 automatically to vip's wish u understand it.
I trynna make money, not friends.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests