Page 1 of 6

VIP System

Posted: 19 Feb 2017, 11:36
by Raheem
VIP System

Description:
  • VIP system for our Zombie Escape Mod, With this plugin you can make VIPs. This system now have:
    1. MultiJump
    2. Parachute
    3. Free Hours - Time All players will became VIPs
    4. Connect & Contact Messages
    5. Scoreboard Tag
    6. Multiply Weapons Damage
Cvars:
  • ze_connect_message 1 Show chat notice Message When VIP Connected? 1 = Show | 0 = Don't Show
  • ze_admin_contact "Admin Name" Add your name or any contact method. To disable this change "Admin Name" to ""
  • ze_give_vip_multijump 1 Enable or Disable MultiJump for VIPs? 1 = Enable | 0 = Disable
  • ze_show_vip_scoreboard 1 Show VIP in the Score Board? 1 = Show | 0 = Don't Show
  • ze_give_vip_parachute 1 Enable or Disable Parachute for VIPs? 1 = Enable | 0 = Disable
  • ze_enable_happy_hours 1 Enable or Disable Happy Hours? 1 = Enable | 0 = Disable
  • ze_vip_happy_hours "9-12" Happy hours: Start-End
  • ze_happy_hours_vip_flags "abcde" Flags to give to all players in Happy Hours?
  • ze_vip_multiply_damage 1.2 Multiply VIP damage by this factor. 0 = Disabled

Natives (API):
  • ze_get_vip_flags(id) This will return player flags as a bitflag sum. id is player index.
  • ze_set_vip_flags(id, iFlags) Set player flags. id is the player index and iFlags is flags to give as bitflag sum.
  • ze_is_user_vip(id) Check if user VIP or not. id is the player index.
Commands:
  • say /vip OR say_team /vip Show Online VIPs and Contact Message.
  • say /vips OR say_team /vips Show Online VIPs and Contact Message.
  • say /getvip OR say_team /getvip Show Motd about VIP.

Examples & Instructions:
  • VIPs are set in ze_vips.ini in configs folder. There is flags and every flag give the player ability so default flags is:
    1. a -- Connect Message and VIP List
    2. b -- Multi-Jump
    3. c -- Parachute
    4. d -- Scoreboard Attrib.
    5. e -- VIP Damage
  • Making VIPs Syntax: "Steam/Nick" "Password" "Flags" "ExpireDate"
  • Some Examples:
    1. "STEAM_1:0:1442018137" "550" "abcde" "11-09-2018" - This VIP will get all flags and will be able to use all of them. Also will be removed at the expire date defined.
    2. "Raheem" "EscapersZone" "ab" "0" - This VIP will get only Connect Message and VIP List and Multi-Jump. This VIP will not expire will never automatically removed.
  • Player can set the password normally from setinfo same as normal admin.
  • ze_happy_hours_vip_flags "Flags" Will define when happy hours come what flags to be given for all players?
  • You can change all cvars easily from ze_vip.cfg
  • You need to install MultiJump and Parachute So that VIP system works correctly. Recommended Cvar:
    1. ze_give_all_multijump 0
    2. ze_give_all_parachute 0
  • Don't forget to edit motd file ze_vip.txt and set your information there.
  • Happy hours start and end time is depend on server time and server time depend on the machine which your server hosted on. Say thetime to get your server time inside the game.
  • ze_get_vip_flags(id) Use it same as you use get_user_flags() Find flags in ze_vip.inc you can also add more flags as you need. Flag z mean this is normal player not vip.
  • ze_set_vip_flags(id, iFlags) This native will set flags you give to player at the spawn and these flags will be removed at the end of the round. This not need password you can use in awards plugins and so on. iFlags is the flag in this format: VIP_A, VIP_B .... Some examples:
    1. ze_set_vip_flags(id, VIP_A) This will set to the player Flag a only.
    2. ze_set_vip_flags(id, VIP_A|VIP_B) This will set to player flags a and b.
    3. ze_set_vip_flags(id, VIP_A|VIP_B|VIP_C|VIP_D) This will set to the players all the flags abcd
  • In set vip flags native we can make things easy and you can set player flags like:
    1. ze_set_vip_flags(id, read_flags("a")) This will give player flag a
    2. ze_set_vip_flags(id, read_flags("abc")) This will give the player flags abc the three flags.
  • You can change flags from code and recompile the plugin:
    • Code: Select all

      #define VIP_MESSAGES    VIP_A
      #define MULTIJUMP	VIP_B
      #define PARACHUTE	VIP_C
      #define SCOREBOARD	VIP_D
      #define DAMAGE		VIP_E
      #define NON_VIP		VIP_Z
    Comment #define MULTIJUMP or #define PARACHUTE or both, so in this case you will not need to install these plugins so VIP plugin run correctly.
  • At expire date, the VIP will automatically removed from the ze_vips.ini file. If you set expire date to 0 then it will never expire.
  • Expire date format: day-month-year, Examples: 09-09-2019 or 9-9-2019 both valid.
  • If you need to set happy hours start at 9 and end at 11 then: ze_vip_happy_hours "9-11"
Changelog:
  • Spoiler!
    Image
    • First Release.
    Image
    • Added contact message and say /vip to show all online VIPs.
    • Added new motd for VIP say /getvip.
    • Added Parachute.
    • Added new two natives
    • Added New flags now used rather than old ones used in users.ini the new file is ze_vip.ini
    • Added new config file for VIP system ze_vip.cfg
    • Added support with name & steamid in VIP system.
    • Added cvar to know servers running our vip system: ze_vip_version
    Image
    • Fixed vips online list.
    • Fixed flags order, this will fix all Happy Hours problems.
    • Added ability to disable parachute/multijump from definations in code, so you will not need to run these plugins so VIP plugin works.
    • Fixed some code problems, updated code style.
    • Edited including method.
    • Some optimization by jack.
    • Added description for functions, check Natives API.
    Image [Current Version]
    • Added option to set expire date to automatically remove VIPs at this date.
    • Added multiple damage by x factor for VIPs on specific flag.
    • Combined happy hours start and end cvars in one cvar.
    • Used new file system function (fopen, fgets ...) whenever it's possible.
    • Fixed some problems in ze_get_vip_flags() native.
    • Updated motd with good style and new things.
    • Added new native to check if user VIP or not ze_is_user_vip().

Downloads:

Re: VIP System

Posted: 24 Feb 2017, 09:21
by Raheem
-Simple update inserted, So if you use this plugin please download the new Version.

Re: VIP System

Posted: 24 Feb 2017, 14:32
by k1llerZm
you can't make new ini for it ? vips.ini

Re: VIP System

Posted: 24 Feb 2017, 15:04
by Raheem
k1llerZm wrote: 7 years ago you can't make new ini for it ? vips.ini
I can make it but i assume that using the default one "users.ini" is more efficient. And can you tell me why you need another vips.ini? if you need it for good reason i'll make it.

Re: VIP System

Posted: 26 Feb 2017, 00:35
by Night Fury
Would you try this? :)
Features:
Motd.
/vips --> Shows online VIPs.
Custom DMG.
Prefix.
  1. #include <zombie_escape>
  2.  
  3. #define VIP ADMIN_LEVEL_H
  4.  
  5. new Pcvars[4]
  6.  
  7. static const COLOR[] = "^x04" //green
  8.  
  9. public plugin_init()
  10. {
  11.     register_plugin("[ZE] VIP Features", "1.0", "JaCk")
  12.     register_clcmd("say /vip", "show_vip_motd")
  13.     register_clcmd("say", "handle_say")
  14.    
  15.     // Cvars
  16.     Pcvars[0] = register_cvar("ze_vip_enable_damage", "1") // 0 = Disable custom Damage || 1 = Enable
  17.     Pcvars[1] = register_cvar("ze_vip_damage", "3")
  18.     Pcvars[2] = register_cvar("ze_vip_contact_info", "Who to contact?") // Remember! Change this
  19.     Pcvars[3] = register_cvar("ze_vip_enable_prefix", "1") // 1 = Enable Prefix || 0 = Disable
  20.    
  21.     //Ham
  22.     RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_Take_DMG", 1)
  23.    
  24.     // Message(s)
  25.     register_message(get_user_msgid("SayText"),"Say_Text")
  26. }
  27.  
  28. public show_vip_motd(id)
  29. {
  30.     show_motd(id, "vip.txt", "VIP Features")
  31. }
  32.  
  33. public Fw_Take_DMG(attacker, Inflictor, victim, Float:Damage, bitsDamageType)
  34. {
  35.     if(!is_user_alive(attacker) || !is_user_alive(victim))
  36.         return HC_SUPERCEDE;
  37.        
  38.     if((get_user_flags(attacker) & VIP) && get_pcvar_num(Pcvars[0]))
  39.     {
  40.         SetHamParamFloat(4, Damage * get_pcvar_float(Pcvars[1]))
  41.     }
  42. }
  43.  
  44. public Say_Text(msgId, msgDest, msgEnt)
  45. {
  46.     new id = get_msg_arg_int(1);
  47.    
  48.     if(is_user_connected(id) && get_user_flags(id) & VIP && get_pcvar_num(Pcvars[3])
  49.     {
  50.         new szTmp[256], szTmp2[256]
  51.         get_msg_arg_string(2, szTmp, charsmax(szTmp))
  52.         new szPrefix[64] = "^x01[ ^x04VIP ^x01]" // Chnage Prefix from here !!!
  53.        
  54.         if(!equal(szTmp, "#Cstrike_Chat_All"))
  55.         {
  56.             add(szTmp2, charsmax(szTmp2), szPrefix)
  57.             add(szTmp2, charsmax(szTmp2), " ")
  58.             add(szTmp2, charsmax(szTmp2), szTmp)
  59.         }
  60.         else
  61.         {
  62.             add(szTmp2, charsmax(szTmp2), szPrefix)
  63.             add(szTmp2, charsmax(szTmp2), "^x03 %s1^x01 :  %s2")
  64.         }
  65.         set_msg_arg_string(2, szTmp2)
  66.     }
  67.     return PLUGIN_CONTINUE;
  68. }
  69.  
  70. public handle_say(id)
  71. {
  72.     new said[192]
  73.     read_args(said, charsmax(said))
  74.     if((containi(said, "who") != -1 && containi(said, "vip") != -1) || contain(said, "/vips") != -1)
  75.     {
  76.         set_task(0.1,"print_adminlist",id)
  77.     }
  78.     return PLUGIN_CONTINUE;
  79. }
  80.  
  81. public print_adminlist(user)
  82. {
  83.     new adminnames[33][32], message[256], contactinfo[256], contact[112], id, count, x, len
  84.     for(id = 1 ; id <= get_maxplayers() ; id++)
  85.     {
  86.         if(is_user_connected(id) && get_user_flags(id) & VIP)
  87.         {
  88.             get_user_name(id, adminnames[count++], charsmax(adminnames))
  89.             len = format(message, charsmax(message), "%s VIPs ONLINE: ", COLOR)
  90.             if(count > 0)
  91.             {
  92.                 for(x = 0 ; x < count ; x++)
  93.                 {
  94.                     len += format(message[len], charsmax(message)-len, "%s%s ", adminnames[x], x < (count-1) ? ", " : "")
  95.                     if(len > 96 )
  96.                     {
  97.                         print_message(user, message)
  98.                         len = format(message, 255, "%s ",COLOR)
  99.                     }
  100.                 }
  101.                 print_message(user, message)
  102.             }
  103.             else
  104.             {
  105.                 len += format(message[len], 255-len, "No VIPs online.")
  106.                 print_message(user, message)
  107.             }
  108.    
  109.             get_pcvar_num(Pcvars[2], contact, charsmax(contact))
  110.             if(contact[0])
  111.             {
  112.                 format(contactinfo, charsmax(contactinfo), "%s Contact Server Admin -- %s", COLOR, contact)
  113.                 print_message(user, contactinfo)
  114.             }
  115.         }
  116.     }
  117. }
  118.  
  119. print_message(id, msg[])
  120. {
  121.     message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, id)
  122.     write_byte(id)
  123.     write_string(msg)
  124.     message_end()
  125. }
NOTE: I didn't test or compile but should work fine. :)

Re: VIP System

Posted: 26 Feb 2017, 13:56
by Raheem
JaCk GamePlay, Nice ideas i'll include it in the next update.

Re: VIP System

Posted: 28 Feb 2017, 11:59
by OxiCorm
Raheem wrote: 7 years ago JaCk GamePlay, Nice ideas i'll include it in the next update.
raheem ze vip system its free for all ?
how can i add it only for admin flag and set happy hours

Re: VIP System

Posted: 28 Feb 2017, 17:47
by Raheem
OxiCorm, Not free for all you can control the Free VIP Hours from Cvars posted above. Also you can turn off happy hours if you need just set this to 0 like: ze_enable_happy_hours 0
So if you disabled this it will be for Players who have the access you give from users.ini

Re: VIP System

Posted: 28 Feb 2017, 18:53
by OxiCorm
Oh ok thanks raheem ithought will be vip cfg or ini but thanks any way

Re: VIP System

Posted: 01 Mar 2017, 20:15
by Raheem
In the new coming versions i'll try make nice new things but this now is just a start.

Re: VIP System

Posted: 15 Mar 2017, 09:28
by johnnysins2000
Try this VIP CODE

I haven't added any damage plugin

but still vip prefix and contact info is added

Code: Select all

#include <zombie_escape>
#include <ze_multijump>

// Defines
#define VIP_ACCESS ADMIN_LEVEL_H

// Variables
new bool:g_bIsHappyHour

// Cvars
new cvar_enable_multijump, cvar_enable_happy_hours, cvar_happy_hour_start, cvar_happy_hour_end, cvar_vip_flag,
cvar_enable_scoreboard_attrib, cvar_vip_connect_notice , maxplayers 

static const COLOR[] = "^x04" //green

public plugin_init()
{
	register_plugin("[ZE] VIP System", "1.0", "Raheem")
	register_message(get_user_msgid("SayText"),"Tekst");  
	register_message(get_user_msgid("SayText"),"Say_Text"); 
	register_clcmd("say /vip", "show_vip_motd")
	register_clcmd("say", "handle_say")
	
	// Hook Chains
	RegisterHookChain(RG_CBasePlayer_Spawn, "Fw_PlayerSpawn_Post", 1)
	
	// Cvars
	cvar_enable_multijump = register_cvar("ze_give_vip_multijump", "1")
	cvar_enable_happy_hours = register_cvar("ze_enable_happy_hours", "1")
	cvar_enable_scoreboard_attrib = register_cvar("ze_enable_scoreboard_attrib", "1")
	cvar_vip_connect_notice = register_cvar("ze_enable_connect_notice", "1")
	cvar_happy_hour_start = register_cvar("ze_happy_hours_start", "00") 
	cvar_happy_hour_end = register_cvar("ze_happy_hours_end", "12")
	cvar_vip_flag = register_cvar("ze_vip_flag", "t")
	
}

public show_vip_motd(id)
{
    show_motd(id, "vip.txt", "VIP Features")
} 

public client_putinserver(id)
{
	if (get_user_flags(id) & VIP_ACCESS && get_pcvar_num(cvar_vip_connect_notice) != 0)
	{
		new szName[32]
		get_user_name(id, szName, charsmax(szName))
		ze_colored_print(0, "!tVIP !g%s !tConnected!y.", szName)
	}
}

public Fw_PlayerSpawn_Post(id)
{
	Happy_Hours()
	
	if (get_pcvar_num(cvar_enable_multijump) != 0 && (get_user_flags(id) & VIP_ACCESS))
	{
		ze_give_user_multijump(id)
	}
	
	if (g_bIsHappyHour == true && get_pcvar_num(cvar_enable_happy_hours) != 0)
	{
		new szFlags[2]
		get_pcvar_string(cvar_vip_flag, szFlags, charsmax(szFlags))
		set_user_flags(id, read_flags(szFlags))
	}
	
	set_task(0.1, "Update_Attribute", id, _, _, "a", 10)
}

public Update_Attribute(id)
{
	if (get_user_flags(id) & VIP_ACCESS && get_pcvar_num(cvar_enable_scoreboard_attrib) != 0)
	{
		message_begin(MSG_ALL, get_user_msgid("ScoreAttrib"))
		write_byte(id)
		write_byte(4)
		message_end()
	}
}

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
	}
}

public Tekst(msgId,msgDest,msgEnt){
	new id = get_msg_arg_int(1);
	
	if(!is_user_connected(id))      return PLUGIN_CONTINUE;
	
	if(get_user_flags(id) & ADMIN_LEVEL_H) 
	{
		new szTmp[256],szTmp2[256];
		get_msg_arg_string(2,szTmp, charsmax( szTmp ) )
		
		new szPrefix[64] = "^x04[VIP]";
		
		if(!equal(szTmp,"#Cstrike_Chat_All")){
			add(szTmp2,charsmax(szTmp2),szPrefix);
			add(szTmp2,charsmax(szTmp2)," ");
			add(szTmp2,charsmax(szTmp2),szTmp);
		}
		else{
			add(szTmp2,charsmax(szTmp2),szPrefix);
			add(szTmp2,charsmax(szTmp2),"^x03 %s1^x01 :  ^x04%s2");
		}
		
		set_msg_arg_string(2,szTmp2);
	}
	return PLUGIN_CONTINUE;
} 

public PrintText(id)
{
 client_print(id, print_chat, "[VIP] write /wantvip and u will see how get VIP and VIP privilegies.")
} 

public handle_say(id) {
	new said[192]
	read_args(said,192)
	if( ( containi(said, "who") != -1 && containi(said, "admin") != -1 ) || contain(said, "/vips") != -1 )
		set_task(0.1,"print_adminlist",id)
	return PLUGIN_CONTINUE
}

public print_adminlist(user) 
{
	new adminnames[33][32]
	new message[256]
	new contactinfo[256], contact[112]
	new id, count, x, len
	
	for(id = 1 ; id <= maxplayers ; id++)
		if(is_user_connected(id))
			if(get_user_flags(id) & ADMIN_LEVEL_H)
				get_user_name(id, adminnames[count++], 31)

	len = format(message, 255, "%s VIP ONLINE: ",COLOR)
	if(count > 0) {
		for(x = 0 ; x < count ; x++) {
			len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count-1) ? ", ":"")
			if(len > 96 ) {
				print_message(user, message)
				len = format(message, 255, "%s ",COLOR)
			}
		}
		print_message(user, message)
	}
	else {
		len += format(message[len], 255-len, "No VIP online.")
		print_message(user, message)
	}
	
	get_cvar_string("amx_contactinfo", contact, 63)
	if(contact[0])  {
		format(contactinfo, 111, "%s Contact Server Admin -- %s", COLOR, contact)
		print_message(user, contactinfo)
	}
}

print_message(id, msg[])
{
    message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, id)
    write_byte(id)
    write_string(msg)
    message_end()
} 

Re: VIP System

Posted: 15 Mar 2017, 12:47
by Raheem
Nice Johnny, I'll update the plugin later.

Re: VIP System

Posted: 15 Mar 2017, 14:57
by johnnysins2000
Here i updated the Code Again with Increase Damage PLugin

Thanks Jack For Helping me fix Loosing indentation

Code: Select all

#include <zombie_escape>
#include <ze_multijump>

// Defines
#define VIP_ACCESS ADMIN_LEVEL_H

// Variables
new bool:g_bIsHappyHour

// Cvars
new cvar_enable_multijump, cvar_enable_happy_hours, cvar_happy_hour_start, cvar_happy_hour_end, cvar_vip_flag,
cvar_enable_scoreboard_attrib, cvar_vip_connect_notice , maxplayers, cvar_vip_damage 

static const COLOR[] = "^x04" //green

public plugin_init()
{
	register_plugin("[ZE] VIP System", "1.0", "Raheem")
	register_message(get_user_msgid("SayText"),"Tekst");  
	register_message(get_user_msgid("SayText"),"Say_Text"); 
	RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_Take_DMG", 1); 
	register_clcmd("say /vip", "show_vip_motd")
	register_clcmd("say", "handle_say")
	
	// Hook Chains
	RegisterHookChain(RG_CBasePlayer_Spawn, "Fw_PlayerSpawn_Post", 1)
	
	// Cvars
	cvar_enable_multijump = register_cvar("ze_give_vip_multijump", "1")
	cvar_enable_happy_hours = register_cvar("ze_enable_happy_hours", "1")
	cvar_enable_scoreboard_attrib = register_cvar("ze_enable_scoreboard_attrib", "1")
	cvar_vip_connect_notice = register_cvar("ze_enable_connect_notice", "1")
	cvar_vip_damage = register_cvar("ze_vip_damage", "3") 
	cvar_happy_hour_start = register_cvar("ze_happy_hours_start", "00") 
	cvar_happy_hour_end = register_cvar("ze_happy_hours_end", "12")
	cvar_vip_flag = register_cvar("ze_vip_flag", "t")
	
}

public show_vip_motd(id)
{
    show_motd(id, "vip.txt", "VIP Features")
} 

public client_putinserver(id)
{
	if (get_user_flags(id) & VIP_ACCESS && get_pcvar_num(cvar_vip_connect_notice) != 0)
	{
		new szName[32]
		get_user_name(id, szName, charsmax(szName))
		ze_colored_print(0, "!tVIP !g%s !tConnected!y.", szName)
	}
}

public Fw_Take_DMG(attacker, Inflictor, victim, Float:Damage, bitsDamageType)
{
    if(!is_user_alive(attacker) || !is_user_alive(victim))
        return
       
    if(get_user_flags(attacker) & ADMIN_LEVEL_H) 
    {
    	  SetHamParamFloat(4, Damage * get_pcvar_float(cvar_vip_damage))
     } 
} 

public Fw_PlayerSpawn_Post(id)
{
	Happy_Hours()
	
	if (get_pcvar_num(cvar_enable_multijump) != 0 && (get_user_flags(id) & VIP_ACCESS))
	{
		ze_give_user_multijump(id)
	}
	
	if (g_bIsHappyHour == true && get_pcvar_num(cvar_enable_happy_hours) != 0)
	{
		new szFlags[2]
		get_pcvar_string(cvar_vip_flag, szFlags, charsmax(szFlags))
		set_user_flags(id, read_flags(szFlags))
	}
	
	set_task(0.1, "Update_Attribute", id, _, _, "a", 10)
}

public Update_Attribute(id)
{
	if (get_user_flags(id) & VIP_ACCESS && get_pcvar_num(cvar_enable_scoreboard_attrib) != 0)
	{
		message_begin(MSG_ALL, get_user_msgid("ScoreAttrib"))
		write_byte(id)
		write_byte(4)
		message_end()
	}
}

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
	}
}

public Tekst(msgId,msgDest,msgEnt){
	new id = get_msg_arg_int(1);
	
	if(!is_user_connected(id))      return PLUGIN_CONTINUE;
	
	if(get_user_flags(id) & ADMIN_LEVEL_H) 
	{
		new szTmp[256],szTmp2[256];
		get_msg_arg_string(2,szTmp, charsmax( szTmp ) )
		
		new szPrefix[64] = "^x04[VIP]";
		
		if(!equal(szTmp,"#Cstrike_Chat_All")){
			add(szTmp2,charsmax(szTmp2),szPrefix);
			add(szTmp2,charsmax(szTmp2)," ");
			add(szTmp2,charsmax(szTmp2),szTmp);
		}
		else{
			add(szTmp2,charsmax(szTmp2),szPrefix);
			add(szTmp2,charsmax(szTmp2),"^x03 %s1^x01 :  ^x04%s2");
		}
		
		set_msg_arg_string(2,szTmp2);
	}
	return PLUGIN_CONTINUE;
} 

public PrintText(id)
{
 client_print(id, print_chat, "[VIP] write /wantvip and u will see how get VIP and VIP privilegies.")
} 

public handle_say(id) {
	new said[192]
	read_args(said,192)
	if( ( containi(said, "who") != -1 && containi(said, "admin") != -1 ) || contain(said, "/vips") != -1 )
		set_task(0.1,"print_adminlist",id)
	return PLUGIN_CONTINUE
}

public print_adminlist(user) 
{
	new adminnames[33][32]
	new message[256]
	new contactinfo[256], contact[112]
	new id, count, x, len
	
	for(id = 1 ; id <= maxplayers ; id++)
		if(is_user_connected(id))
			if(get_user_flags(id) & ADMIN_LEVEL_H)
				get_user_name(id, adminnames[count++], 31)

	len = format(message, 255, "%s VIP ONLINE: ",COLOR)
	if(count > 0) {
		for(x = 0 ; x < count ; x++) {
			len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count-1) ? ", ":"")
			if(len > 96 ) {
				print_message(user, message)
				len = format(message, 255, "%s ",COLOR)
			}
		}
		print_message(user, message)
	}
	else {
		len += format(message[len], 255-len, "No VIP online.")
		print_message(user, message)
	}
	
	get_cvar_string("amx_contactinfo", contact, 63)
	if(contact[0])  {
		format(contactinfo, 111, "%s Contact Server Admin -- %s", COLOR, contact)
		print_message(user, contactinfo)
	}
}

print_message(id, msg[])
{
    message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, id)
    write_byte(id)
    write_string(msg)
    message_end()
} 

Re: VIP System

Posted: 16 Mar 2017, 15:02
by johnnysins2000
Hello Guyz Code is again updated

What features are added ?

1- VIP PREFIX
2- VIP Privileges MOTD
3- VIP Damage increased
4- VIP Online Feature
5- VIP Parachute

Code: Select all

#include <zombie_escape>
#include <ze_multijump>

// Defines
#define VIP_ACCESS ADMIN_LEVEL_H

// Variables

new const parachute_model[] = "models/parachute.mdl" 

new bool:g_bIsHappyHour
new bool:has_parachute[33]
new para_ent[33]
new g_para_3rd_view

new g_parachute_FallSpeed, g_parachute_Detach 

// Cvars
new cvar_enable_multijump, cvar_enable_happy_hours, cvar_happy_hour_start, cvar_happy_hour_end, cvar_vip_flag,
cvar_enable_scoreboard_attrib, cvar_vip_connect_notice , maxplayers, cvar_vip_damage 

static const COLOR[] = "^x04" //green

public plugin_init()
{
	register_plugin("[ZE] VIP System", "1.0", "Raheem")
	register_message(get_user_msgid("SayText"),"Tekst");  
	register_message(get_user_msgid("SayText"),"Say_Text"); 
	RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_Take_DMG", 1); 
	register_clcmd("say /vip", "show_vip_motd")
	register_clcmd("say", "handle_say")
	
	// Hook Chains
	RegisterHookChain(RG_CBasePlayer_Spawn, "Fw_PlayerSpawn_Post", 1)
	
	// Cvars
	cvar_enable_multijump = register_cvar("ze_give_vip_multijump", "1")
	cvar_enable_happy_hours = register_cvar("ze_enable_happy_hours", "1")
	cvar_enable_scoreboard_attrib = register_cvar("ze_enable_scoreboard_attrib", "1")
	cvar_vip_connect_notice = register_cvar("ze_enable_connect_notice", "1")
	cvar_vip_damage = register_cvar("ze_vip_damage", "3") 
	g_para_3rd_view = register_cvar("zp_3rd_person_view", "1")
	g_parachute_FallSpeed = register_cvar("ze_vip_parachute_fallspeed", "45")
	g_parachute_Detach = register_cvar("ze_vip_parachute_detach", "1")
	cvar_happy_hour_start = register_cvar("ze_happy_hours_start", "00") 
	cvar_happy_hour_end = register_cvar("ze_happy_hours_end", "12")
	cvar_vip_flag = register_cvar("ze_vip_flag", "t")
	
}

public show_vip_motd(id)
{
    show_motd(id, "vip.txt", "VIP Features")
} 

public plugin_precache()
	engfunc(EngFunc_PrecacheModel, parachute_model) 

public client_connect(id)
{
	parachute_reset(id)
	has_parachute[id] = false
}

public client_disconnect(id)
{
	parachute_reset(id)
	has_parachute[id] = false
}

public death_event()
{
	new i = read_data(2)
	
	parachute_reset(i)
	has_parachute[i] = false 
	set_view(i, CAMERA_NONE) 
} 

parachute_reset(id) 
{
	if (para_ent[id] > 0) 
	{
		if ( pev_valid(para_ent[id]) ) 
			engfunc(EngFunc_RemoveEntity, para_ent[id])
	}

	has_parachute[id] = false
	para_ent[id] = 0
} 

public newSpawn(id)
{
	parachute_reset(id)
} 

public fw_PreThink(id)
{
	//parachute.mdl animation information
	//0 - deploy - 84 frames
	//1 - idle - 39 frames
	//2 - detach - 29 frames
	
	if (!is_user_alive(id) || !has_parachute[id] && (get_user_flags(id) & VIP_ACCESS)) 
		return

	new Float:fallspeed = get_pcvar_float(g_parachute_FallSpeed) * -1.0
	new Float:frame

	new button = pev(id, pev_button)
	new oldbutton = pev(id, pev_oldbuttons)
	new flags = pev(id, pev_flags)

	if (para_ent[id] > 0 && (flags & FL_ONGROUND)) 
	{
		set_view(id, CAMERA_NONE)
		
		if (get_pcvar_num(g_parachute_Detach)) 
		{
			if ( pev(para_ent[id],pev_sequence) != 2 ) 
			{
				set_pev(para_ent[id], pev_sequence, 2)
				set_pev(para_ent[id], pev_gaitsequence, 1)
				set_pev(para_ent[id], pev_frame, 0.0)
				set_pev(para_ent[id], pev_fuser1, 0.0)
				set_pev(para_ent[id], pev_animtime, 0.0)
				return
			}
			
			pev(para_ent[id],pev_fuser1, frame)
			frame += 2.0
			set_pev(para_ent[id],pev_fuser1,frame)
			set_pev(para_ent[id],pev_frame,frame)
			
			if ( frame > 254.0 )
			{
				engfunc(EngFunc_RemoveEntity, para_ent[id])
				para_ent[id] = 0
			}
		}
		else 
		{
			engfunc(EngFunc_RemoveEntity, para_ent[id])
			para_ent[id] = 0
		}
		return
	}

	if (button & IN_USE) 
	{
		new Float:velocity[3]
		pev(id, pev_velocity, velocity)
		
		if (get_pcvar_num(g_para_3rd_view) == 1)
		{
			set_view(id, CAMERA_NONE)
		}
		if (get_pcvar_num(g_para_3rd_view) == 2)
		{
			set_view(id, CAMERA_3RDPERSON)
		}
		
		if (velocity[2] < 0.0) 
		{
			if(para_ent[id] <= 0) 
			{
				para_ent[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
				
				if(para_ent[id] > 0) 
				{
					set_pev(para_ent[id],pev_classname,"parachute")
					set_pev(para_ent[id], pev_aiment, id)
					set_pev(para_ent[id], pev_owner, id)
					set_pev(para_ent[id], pev_movetype, MOVETYPE_FOLLOW)
					engfunc(EngFunc_SetModel, para_ent[id], parachute_model)
					set_pev(para_ent[id], pev_sequence, 0)
					set_pev(para_ent[id], pev_gaitsequence, 1)
					set_pev(para_ent[id], pev_frame, 0.0)
					set_pev(para_ent[id], pev_fuser1, 0.0)
				}
			}
			
			if (para_ent[id] > 0) 
			{
				set_pev(id, pev_sequence, 3)
				set_pev(id, pev_gaitsequence, 1)
				set_pev(id, pev_frame, 1.0)
				set_pev(id, pev_framerate, 1.0)
			
				velocity[2] = (velocity[2] + 40.0 < fallspeed) ? velocity[2] + 40.0 : fallspeed
				set_pev(id, pev_velocity, velocity)
				
				if (pev(para_ent[id],pev_sequence) == 0) 
				{
					pev(para_ent[id],pev_fuser1, frame)
					frame += 1.0
					set_pev(para_ent[id],pev_fuser1,frame)
					set_pev(para_ent[id],pev_frame,frame)
					
					if (frame > 100.0) 
					{
						set_pev(para_ent[id], pev_animtime, 0.0)
						set_pev(para_ent[id], pev_framerate, 0.4)
						set_pev(para_ent[id], pev_sequence, 1)
						set_pev(para_ent[id], pev_gaitsequence, 1)
						set_pev(para_ent[id], pev_frame, 0.0)
						set_pev(para_ent[id], pev_fuser1, 0.0)
					}
				}
			}
		}
		
		else if (para_ent[id] > 0) 
		{
			engfunc(EngFunc_RemoveEntity, para_ent[id])
			para_ent[id] = 0
		}
	}
	
	else if ((oldbutton & IN_USE) && para_ent[id] > 0 ) 
	{
		engfunc(EngFunc_RemoveEntity, para_ent[id])
		para_ent[id] = 0
	}
}

public client_putinserver(id)
{
	if (get_user_flags(id) & VIP_ACCESS && get_pcvar_num(cvar_vip_connect_notice) != 0)
	{
		new szName[32]
		get_user_name(id, szName, charsmax(szName))
		ze_colored_print(0, "!tVIP !g%s !tConnected!y.", szName)
	}
}

public Fw_Take_DMG(attacker, Inflictor, victim, Float:Damage, bitsDamageType)
{
    if(!is_user_alive(attacker) || !is_user_alive(victim))
        return
       
    if(get_user_flags(attacker) & ADMIN_LEVEL_H) 
    {
    	  SetHamParamFloat(4, Damage * get_pcvar_float(cvar_vip_damage))
     } 
} 

public Fw_PlayerSpawn_Post(id)
{
	Happy_Hours()
	
	if (get_pcvar_num(cvar_enable_multijump) != 0 && (get_user_flags(id) & VIP_ACCESS))
	{
		ze_give_user_multijump(id)
	}
	
	if (g_bIsHappyHour == true && get_pcvar_num(cvar_enable_happy_hours) != 0)
	{
		new szFlags[2]
		get_pcvar_string(cvar_vip_flag, szFlags, charsmax(szFlags))
		set_user_flags(id, read_flags(szFlags))
	}
	
	set_task(0.1, "Update_Attribute", id, _, _, "a", 10)
}

public Update_Attribute(id)
{
	if (get_user_flags(id) & VIP_ACCESS && get_pcvar_num(cvar_enable_scoreboard_attrib) != 0)
	{
		message_begin(MSG_ALL, get_user_msgid("ScoreAttrib"))
		write_byte(id)
		write_byte(4)
		message_end()
	}
}

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
	}
}

public Tekst(msgId,msgDest,msgEnt){
	new id = get_msg_arg_int(1);
	
	if(!is_user_connected(id))      return PLUGIN_CONTINUE;
	
	if(get_user_flags(id) & ADMIN_LEVEL_H) 
	{
		new szTmp[256],szTmp2[256];
		get_msg_arg_string(2,szTmp, charsmax( szTmp ) )
		
		new szPrefix[64] = "^x04[VIP]";
		
		if(!equal(szTmp,"#Cstrike_Chat_All")){
			add(szTmp2,charsmax(szTmp2),szPrefix);
			add(szTmp2,charsmax(szTmp2)," ");
			add(szTmp2,charsmax(szTmp2),szTmp);
		}
		else{
			add(szTmp2,charsmax(szTmp2),szPrefix);
			add(szTmp2,charsmax(szTmp2),"^x03 %s1^x01 :  ^x04%s2");
		}
		
		set_msg_arg_string(2,szTmp2);
	}
	return PLUGIN_CONTINUE;
} 

public PrintText(id)
{
 client_print(id, print_chat, "[VIP] write /wantvip and u will see how get VIP and VIP privilegies.")
} 

public handle_say(id) {
	new said[192]
	read_args(said,192)
	if( ( containi(said, "who") != -1 && containi(said, "admin") != -1 ) || contain(said, "/vips") != -1 )
		set_task(0.1,"print_adminlist",id)
	return PLUGIN_CONTINUE
}

public print_adminlist(user) 
{
	new adminnames[33][32]
	new message[256]
	new contactinfo[256], contact[112]
	new id, count, x, len
	
	for(id = 1 ; id <= maxplayers ; id++)
		if(is_user_connected(id))
			if(get_user_flags(id) & ADMIN_LEVEL_H)
				get_user_name(id, adminnames[count++], 31)

	len = format(message, 255, "%s VIP ONLINE: ",COLOR)
	if(count > 0) {
		for(x = 0 ; x < count ; x++) {
			len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count-1) ? ", ":"")
			if(len > 96 ) {
				print_message(user, message)
				len = format(message, 255, "%s ",COLOR)
			}
		}
		print_message(user, message)
	}
	else {
		len += format(message[len], 255-len, "No VIP online.")
		print_message(user, message)
	}
	
	get_cvar_string("amx_contactinfo", contact, 63)
	if(contact[0])  {
		format(contactinfo, 111, "%s Contact Server Admin -- %s", COLOR, contact)
		print_message(user, contactinfo)
	}
}

print_message(id, msg[])
{
    message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, id)
    write_byte(id)
    write_string(msg)
    message_end()
} 

Re: VIP System

Posted: 16 Mar 2017, 15:35
by Raheem
Nice but about Parachute i'll try make another optimized version using ReAPI and i'll make native like in Multi-Jump Plugin then we will include in VIP code simply with one line.

Re: VIP System

Posted: 28 Jun 2017, 13:48
by Spir0x
Raheem Do it please :D we need it with parachute

Re: VIP System

Posted: 28 Jun 2017, 20:29
by johnnysins2000
:!:
Spir0x wrote: 6 years ago Raheem Do it please :D we need it with parachute
Lol Already done ... I will add some More features

To it and Then Optimize it if I learn it :v

Re: VIP System

Posted: 28 Jun 2017, 21:21
by Spir0x
i installed it with para and missing parachute model.
Johnny please read this and repond me it's nice ?
http://escapers-zone.xyz/viewtopic.php?f=11&t=1938

Re: VIP System

Posted: 30 Jun 2017, 03:34
by Raheem
Parachute good idea i'll include for VIP to have it. I and jack developed new version 1.1 it will be much better great than this one. I'll continue it's developing when i get time and then will release it.

Model of parachute not missed bro and i told you when i get time i'll add model ok hope you understand.

Re: VIP System

Posted: 30 Jun 2017, 07:53
by johnnysins2000
Raheem wrote: 6 years ago Parachute good idea i'll include for VIP to have it. I and jack developed new version 1.1 it will be much better great than this one. I'll continue it's developing when i get time and then will release it.

Model of parachute not missed bro and i told you when i get time i'll add model ok hope you understand.
What is In this V1.1

Some little ideas for V1.1

Makes Flags Like ZmVIP with the features And Vips.ini

In thus way Other members will also be able to use those special models

So VIP and administrative Flags Will be separated :)