Jump to content
STYLE 1
STYLE 2



[ZHP - CS 1.6] Event VIP FREE [UPDATE - V4.0]


CXM.

Recommended Posts

  • Descriere : Vip  free la un interval de ore .
  • Autor : LOL
  • Versiune :   4.0
  • Cvaruri 
    vip_start - ora la care incepe eventul
    vip_end - ora la care se termina

     

  • Instalare 
  • 1. Fisierul vip_free.sma il puneti in addons/amxmodx/scripting
    2. Fisierul 
    vip_free.amxx il puneti in addons/amxmodx/plugins
    3. Intrati in fisierul 
    addons/amxmodx/configs/plugins.ini si adaugati la urma:
     
    vip_free.amxx
  • Descarcare 
    #include <amxmodx>
    #include <amxmisc>
    
    new start,
    stop,
    minutes,
    h,
    m
    
    new bool: HaveVipBefore[33];
    
    #define FLAGS "t"
    
    public plugin_init()
    {
    	register_plugin("VIP FREE", "4.0", "LOL")
    	
    	start = register_cvar( "vip_start", "20" );
    	stop = register_cvar( "vip_end", "23" )
    	minutes = register_cvar( "vip_minutes", "00" ) // nu modificati
    	
    	set_task( 60.0, "check", _, _, _, "b" );
    	
    }
    
    public client_putinserver(id)
    {
    	check(id)
    }
    public check(id)
    {
    	
    	time( h, m, _ );
    	new flags = read_flags(FLAGS)
    	
    	if(h >= get_pcvar_num( start ) && h < get_pcvar_num( stop ))
    	{        
    		if(!(get_user_flags(id) & flags ))
    		{
    			set_user_flags(id, flags)
    			server_cmd( "amx_reloadadmins" );
    			HaveVipBefore[id] = false;
    			}else{
    			HaveVipBefore[id] = true;
    		}
    		if(h == get_pcvar_num( start ) && m == get_pcvar_num( minutes ))
    		{
    			ColorChat(0, "!g***** !tFREE VIP EVENT STARTED !g*****")
    			log_amx("***** FREE VIP EVENT STARTED *****")
    		}
    		
    		set_hudmessage(random(256), random(256), random(256),0.02, 0.2, 1, _, 59.0, _, _, -1)
    		show_hudmessage(0, "** FREE VIP EVENT ACTIVE **")
    	}
    	else if(h < get_pcvar_num( start ) || h >= get_pcvar_num( stop ))
    	{
    		if (!(HaveVipBefore[id]))
    		{
    			remove_user_flags(id, flags);
    			server_cmd( "amx_reloadadmins" );
    		}
    		if(h == get_pcvar_num( stop ) && m == get_pcvar_num( minutes ))
    		{
    			ColorChat(0, "!g***** !tFREE VIP EVENT ENDED !g*****")
    			log_amx("***** FREE VIP EVENT ENDED *****")
    		}
    	}
    }
    
    stock ColorChat(const id, const input[], any:...) {
    	new count = 1, players[32];
    	static msg[191];
    	vformat(msg, 190, input, 3);
    	
    	replace_all(msg, 190, "!g", "^4");
    	replace_all(msg, 190, "!n", "^1");
    	replace_all(msg, 190, "!t", "^3");
    	
    	if(id) players[0] = id;
    	else get_players(players, count, "ch"); {
    		for(new i = 0; i < count; i++) {
    			if(is_user_connected(players)) {
    				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players);
    				write_byte(players);
    				write_string(msg);
    				message_end();
    			}
    		}
    	}
    }

     

  • Like 1
Link to comment
Share on other sites

  • 11 months later...
  • Administrator

Salut.

Din punctul meu de vedere este scris cu picioarele. Nu respecta nicio regula:

- Nu exista naming convention, numele variabilelor sunt puse din burta, ex: start, stop etc...

- Codul nu este identat, este foarte greu de inteles ce a vrut autorul sa creeze acolo.

- "set_task( 60.0, "check", _, _, _, "b" )"  - acest call nu face nimic, e pusa degeaba deoarece functia check are ca parametru id-ul unui player, iar autorul trimite "_" ceea ce inseamna default value. Functia check este bine apelata doar din fw "client_putinserver"

A fost creat un cvar pentru ceva ce trebuia facut sa nu fie configurabil, mai exact "minutes" - singurul rol al acestui cvar este de a verifica daca este ora la care trebuie sa inceapa/termine eventul. Fiind cvar exista riscul ca un admin sa iti modifice valoarea, iar pluginul nu va mai functiona in parametrii, poate chiar nu va mai functiona deloc.

- Eventul nu va fi activ in cazul in care tu vei pune cvarul de start sub ora 24:00, iar start dupa ora 24:00 - exemplu: daca vrei VIP free intre 9 seara ( 21:00 ) si 10 dimineata, pluginul nu va merge.

- Stock-ul de colorchat este folosit degeaba deoarce in amxmodx 1.8.3 exista client_print_color incorporat

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

About Us

A gaming community that was founded in 2018, but has been through a lot. Thanks to the STAFF and loyal players, it managed to become a community in continuous development. If you want to be part of the ZeroHP family, we expect you to register with your server for Counter Strike 1.6, Global Offensive, TeamSpeak, SA-MP, Minecraft or to become part of the Staff of the current servers in our community.

Important