Approved VIP System

Plug-ins compatibility with Zombie Escape 1.x only!


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

#31

Post by Raheem » 6 years ago

Upload the file you try to compile.
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#32

Post by Spir0x » 6 years ago

how ? you mean the code?

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#33

Post by Spir0x » 6 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 6 years ago, edited 1 time in total.
Reason: Added code tag

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

#34

Post by Raheem » 6 years ago

It compile. Fix your compiler.
  • Image
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#35

Post by Spir0x » 6 years ago

you mean i download latest compiler?

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#36

Post by johnnysins2000 » 6 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: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#37

Post by Spir0x » 6 years ago

Yes :/

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

#38

Post by Raheem » 6 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.
He who fails to plan is planning to fail

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

#39

Post by Raheem » 6 years ago

Trail plugin for VIP for our new VIP system:
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#40

Post by Spir0x » 6 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.

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

#41

Post by Night Fury » 6 years ago

Spir0x wrote: 6 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.
Forget it.
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

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

#42

Post by Raheem » 6 years ago

Here it's:
    1. #include <ze_vip>
    2.  
    3. public plugin_init()
    4. {
    5.     register_plugin("Give M249 for VIP", "1.0", "Raheem")
    6.    
    7.     RegisterHookChain(RG_CBasePlayer_Spawn, "Fw_PlayerSpawn_Post", 1)
    8. }
    9.  
    10. public Fw_PlayerSpawn_Post(id)
    11. {
    12.     if (!is_user_alive(id) || !(ze_get_vip_flags(id) & VIP_A) || ze_is_user_zombie(id))
    13.         return HC_CONTINUE
    14.    
    15.     rg_give_item(id, "weapon_m249", GT_APPEND)
    16.     rg_set_user_bpammo(id, WeaponIdType:get_weaponid("weapon_m249"), 200)
    17.    
    18.     return HC_CONTINUE
    19. }
Last edited by Raheem 6 years ago, edited 1 time in total.
Reason: Check if user zombie or not.
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#43

Post by Spir0x » 6 years ago

[mention]Jack GamePlay[/mention] what's your probleme ?

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#44

Post by Spir0x » 6 years ago

Raheem xD when i'm infected to zombie i have m249 and i can infect humans with gun

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

#45

Post by Raheem » 6 years ago

Spir0x wrote: 6 years ago Raheem xD when i'm infected to zombie i have m249 and i can infect humans with gun
Fixed see the code now.
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#46

Post by Spir0x » 6 years ago

thanks.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#47

Post by Spir0x » 6 years ago

raheem can you put models into this m249 ? and give automatic m249 and deagle.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#48

Post by Spir0x » 6 years ago

Raheem i think in next update you need to put 2x fire nades & 2 frost nades for VIP.

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

#49

Post by Night Fury » 6 years ago

Raheem wrote: 6 years ago
Spir0x wrote: 6 years ago Raheem xD when i'm infected to zombie i have m249 and i can infect humans with gun
Fixed see the code now.
Use "ze_user_humanized" better.
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#50

Post by Spir0x » 6 years ago

Jack what's this ? ••• Offline a year due to studying. ••• xD remove it you cant stay 1hour without opening this forum

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: Bing [Bot] and 0 guests