Jump to content

Modificare plugin vip free


Recommended Posts

Server :RS.RANGFORT.RO

Nick :FLORIN^GOLD
La ce doriţi ajutor? Am un plugin vip free si la un anumit interval de timp imi apare un mesaj 

Quote


    ColorChat(0,"^4*^1 VIP GRATUIT ^4RS.RANGFORT.RO ^1are in fiecare zi event ^4VIP GRATUIT  ^1!");

si nu mai vreau sa apare in chat 

Quote

#include <amxmodx>
#define VIP_FLAG ADMIN_LEVEL_H

new const vip_time[] = {20, 13};

//new g_sync,
new cvar_freevip, g_maxplayers;

new vip_free = 0;


public plugin_init()

{

    register_plugin("Vip Free", "4.0", "cyby");

    

    set_task(60.0, "check_time", _, _, _, "b");

    set_task(120.0, "hud_mess", _, _, _, "b");

    

    cvar_freevip = register_cvar("vip_free", "0");

    

    g_maxplayers = get_maxplayers();

  //  g_sync = CreateHudSyncObj();

    cached_vars();

    set_task(1.0, "check_time");

    register_clcmd("say /timevip", "time_remain");

}

public client_putinserver(id)

{

    if(!vip_free)

        return;

    

    if(!(get_user_flags(id) & VIP_FLAG))

    {

        new flags = get_user_flags(id);

        flags |= VIP_FLAG

        set_user_flags(id, flags);

    }

}

public cached_vars()

    vip_free = get_pcvar_num(cvar_freevip);

public check_time()

{

    new o;

    time(o, _, _);

    

    if(!vip_free)

    {

        if(o >= vip_time[0] || o < vip_time[1])

        {

            vip_free = 1;

            set_pcvar_num(cvar_freevip, 1);

            ColorChat(0, "^4*^1 Eventul^4 - VIP GRATUIT -^1 s-a activat chiar in acest moment.");

        }

    }

    else

    {

        if(o < vip_time[0] && o >= vip_time[1])

        {

            vip_free = 0;

            set_pcvar_num(cvar_freevip, 0);

            ColorChat(0, "^4*^1 Eventul^4 - VIP GRATUIT -^1 s-a dezactivat chiar in acest moment.");

            for(new i = 1; i <= g_maxplayers; i++)

            {

                if(!is_user_connected(i) || get_user_flags(i) & VIP_FLAG)

                    continue;

                    

                remove_user_flags(i);

            }

            server_cmd("amx_reloadadmins");

        }

    }

}

public time_remain(id)

{

    switch(vip_free)

    {

        case 1: ColorChat(id, "^4*^1 Eventul^4 - VIP GRATUIT -^1 se sfarseste in:^4 %s.", time_left_vip());

        case 0: ColorChat(id, "^4*^1 Eventul^4 - VIP GRATUIT -^1 incepe in:^4 %s.", time_left_vip());

    }

    return PLUGIN_CONTINUE;

}

public hud_mess()

{

    if(!vip_free)

        return;

    

   // set_hudmessage(random(256), random(256), random(256), 0.00, 0.17, 0, 1.1, 1.0);

    // ShowSyncHudMsg(0, g_sync, "[PARAZITII]: Event VIP GRATUIT ON.");

    ColorChat(0,"^4*^1 VIP GRATUIT ^4RS.RANGFORT.RO ^1are in fiecare zi event ^4VIP GRATUIT  ^1!");

    // metoda drastica dar n-am cf, sa mearga si la baietii ce au reload admins la 5 secunde sau la cine stie cat.

    new flage;

    for(new i = 1; i <= g_maxplayers; i++)

    {

        if(!is_user_connected(i) || get_user_flags(i) & VIP_FLAG)

            continue;

            

        flage = get_user_flags(i);

        flage |= VIP_FLAG

        set_user_flags(i, flage);

    }

}

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") // Green Color

    replace_all(msg, 190, "!n", "^1") // Default Color

    replace_all(msg, 190, "!t", "^3") // Team Color

    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();

            }

        }

    }

}

stock time_left_vip()

{

    new timp_ramas[16], len = 0;

    new h, m, lh, lm;

    time(h, m, _);

    switch(vip_free)

    {

        case 1:

        {

            new l = vip_time[1];

            if(h > l)

                l += add_time(h) + h;

            lh = l - h;

        }

        case 0: lh = vip_time[0] - h;

    }

    lm = 60 - m;

    if(lm < 60)

        lh--;

    

    if(lh > 0)

        len += formatex(timp_ramas[len], charsmax(timp_ramas) - len, "%d or%s", lh, lh == 1 ? "a" : "e");

        

    if(lm < 60)

        len += formatex(timp_ramas[len], charsmax(timp_ramas) - len, " %d minut%s", lm, lm == 1 ? "" : "e");

        

    return timp_ramas;

}

stock add_time(x)

{

    new j;

    switch(x)

    {

        case 0: j = 24;

        case 1: j = 23;

        case 2: j = 22;

        case 3: j = 21;

        case 4: j = 20;

        case 5: j = 19;

        case 6: j = 18;

        case 7: j = 17; 

        case 8: j = 16;

        case 9: j = 15;

        case 10: j = 14;

        case 11: j = 13;

        case 12: j = 12;

        case 13: j = 11;

        case 14: j = 10;

        case 15: j = 9;

        case 16: j = 8;

        case 17: j = 7;

        case 18: j = 6;

        case 19: j = 5;

        case 20: j = 4;

        case 21: j = 3;

        case 22: j = 2;

        case 23: j = 1;

    }

    if(x < vip_time[1])

        j = 0;

    

    return j;

}

 

Link to post
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.   Restore formatting

  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.

×
×
  • Create New...