Raised This Month: $128 Target: $400
 32% 

Vip sistem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
decayed66
Junior Member
Join Date: Jul 2014
Old 02-21-2021 , 20:48   Vip sistem
Reply With Quote #1

Hello,

Guys I need some help for one VIP plugin, it,s everything okay it;s work but I want to add a new menu for the happy hour free vip that give ou just m4a1 + nades and ak47 + nades , i've tried evrything but i can't figured out to show the menu when you have the free vip flag "s". Can someone help me?
And also i tried to make it to take vips from vips.ini.i posted the code without my attempts.
PHP Code:
#include amxmodx
#include amxmisc
#include cstrike
#include fun
#include hamsandwich
#include engine
#include fakemeta
#include csx
    #if AMXX_VERSION_NUM < 183
#include colorchat
    #endif

#define p. "VIP Clasic"
#define v. "0.1b"
#define a. ""

#define VIP_FLAG "t"
#define VIP_FREEFLAG "s"

#define SCOREATTRIB_VIP (1 << 2)

new const Floatg_flCoords[][] = 
{
    { 
0.500.40 },
    { 
0.560.44 },
    { 
0.600.50 },
    { 
0.560.56 },
    { 
0.500.60 },
    { 
0.440.56 },
    { 
0.400.50 },
    { 
0.440.44 }
};

new const 
g_szBeginning[] = "Membrii VIP";

new 
g_Cvar[30],
    
g_Round[33] = 0,
    
g_JumpNum[33], bool:g_DoJump[33],
    
g_iPosition[33], g_iSize,
    
g_szMessage[256], SyncHudMessage,
    
g_VipConfig[] = "vipConfig.cfg",
    
g_VipMaps[] = "vipMaps.ini",
    
g_File1[128], g_File2[128], 
    
bool:g_Use[33],
    
bool:g_Menu[33],
    
o;

enum
{
    
Primary 1,
    
Secondary,
    
Knife,
    
Grenades,
    
C4
};

public 
plugin_init()
{
    
register_plugin p., v., a.;

    
register_clcmd "say""sayCommand";
    
register_clcmd "say_team""sayCommand";
    
    
g_Cvar[0] = register_cvar("vip_mode""2");
    
g_Cvar[1] = register_cvar("vip_tag""VIP");
    
g_Cvar[2] = register_cvar("vip_start_hp""100");
    
g_Cvar[3] = register_cvar("vip_start_ap""100");
    
g_Cvar[4] = register_cvar("vip_start_money""1000");
    
g_Cvar[5] = register_cvar("vip_jump""1");
    
g_Cvar[6] = register_cvar("vip_hp_kill""5");
    
g_Cvar[7] = register_cvar("vip_ap_kill""5");
    
g_Cvar[8] = register_cvar("vip_hp_hs""10");    
    
g_Cvar[9] = register_cvar("vip_ap_hs""10");
    
g_Cvar[10] = register_cvar("vip_hp_kill_knife""15");    
    
g_Cvar[11] = register_cvar("vip_ap_kill_knife""15");
    
g_Cvar[12] = register_cvar("vip_hp_hs_knife""20");
    
g_Cvar[13] = register_cvar("vip_ap_hs_knife""20");
    
g_Cvar[14] = register_cvar("vip_bulletdmg""1");
    
g_Cvar[16] = register_cvar("vip_in_out""0");
    
g_Cvar[17] = register_cvar("vip_show_chat""1");
    
g_Cvar[18] = register_cvar("vip_show_hud""0");
    
g_Cvar[19] = register_cvar("vip_maxhp""100");
    
g_Cvar[20] = register_cvar("vip_maxap""100");
    
g_Cvar[21] = register_cvar("vip_parachute""0");
    
g_Cvar[22] = register_cvar("vip_money_kill""400");
    
g_Cvar[23] = register_cvar("vip_money_hs""600");
    
g_Cvar[24] = register_cvar("vip_bulletdmg_mode""1");
    
g_Cvar[25] = register_cvar("vip_tab""1");
    
g_Cvar[26] = register_cvar("vip_defusekit""1");
    
g_Cvar[27] = register_cvar("vip_free""1");
    
g_Cvar[28] = register_cvar("vip_free_start""22");
    
g_Cvar[29] = register_cvar("vip_free_end""10");

    
set_task 300.0"msgInfo"___"b";
    
set_task 1.0"showVipsH"___"b"0;
    
set_task 1.0"GiveVIP" ,_,_,_"b";
    
    
register_message get_user_msgid("ScoreAttrib"), "MessageScoreAttrib";    
    
RegisterHam Ham_Spawn"player""Spawn"1;
    
    
SyncHudMessage CreateHudSyncObj();
    
g_iSize sizeof(g_flCoords);
    
    
register_event "HLTV""newRound""a""1=0""2=0";
    
register_event "ResetHUD""resetModel""b";
}

public 
plugin_cfg()
{    
    new 
File[64];
    
    
get_configsdir Filecharsmax(File);
    
formatex g_File1charsmax(g_File1), "%s/%s"Fileg_VipConfig;
    
formatex g_File2charsmax(g_File2), "%s/%s"Fileg_VipMaps;
    
    if(!
file_exists(g_File1))
    {
        
write_file(g_File1"/////// Vip Configuration File");
        
write_file(g_File1"/////// Vip Configuration File");
        
write_file(g_File1"/////// Vip Configuration File");
        
write_file(g_File1"/////// Vip Configuration File");
        
write_file(g_File1"/////// Vip Configuration File");
        
write_file(g_File1"/////// Vip Configuration File");
        
write_file(g_File1"/////// Vip Configuration File");
        
write_file(g_File1"/////// Vip Configuration File");
        
write_file(g_File1"/////// Vip Configuration File");
        
write_file(g_File1"")/////// Vip Configuration File");
        
write_file(g_File1"")/////// Vip Configuration File");
        
write_file(g_File1"")/////// Vip Configuration File");
        
write_file(g_File1"/////// Vip Configuration File");
        
write_file(g_File1"");
        
write_file(g_File1"//// VIP Mode");
        
write_file(g_File1"// Setati modul de aparitie al meniului");
        
write_file(g_File1"// 0 - dezactivat");
        
write_file(g_File1"// 1 - meniu prin comanda /vmenu");
        
write_file(g_File1"// 2 - meniu din a 3-a runda");
        
write_file(g_File1"// Default: '1'");
        
write_file(g_File1"vip_mode ^"1^"");
        
write_file(g_File1"");
        
write_file(g_File1"//// VIP Tag");
        
write_file(g_File1"// Setati tagul ce va aparea in chat in mesaje");
        
write_file(g_File1"// Default: 'VIP'");
        
write_file(g_File1"vip_tag ^"VIP^"");
        
write_file(g_File1"");
        
write_file(g_File1"//// VIP Start");
        
write_file(g_File1"// Setati viata, armura si banii cu care va incepe vipul fiecare runda");
        
write_file(g_File1"// La bani setati cu cati bani in plus va incepe");
        
write_file(g_File1"// EX: VIP-ul are 800 bani si la spawn i se vor mai adauga inca 1000");
        
write_file(g_File1"// Default: 150, 150, 1000");
        
write_file(g_File1"vip_start_hp ^"150^"");
        
write_file(g_File1"vip_start_ap ^"150^"");
        
write_file(g_File1"vip_start_money ^"1000^"");
        
write_file(g_File1"");
        
write_file(g_File1"//// VIP HP/AP/BANI per kill/hs");
        
write_file(g_File1"// Setati cat hp/ap/bani sa primeasca vip-ul pe fiecare kill/hs facut in functie de cum este facut kill-ul/hs-ul");
        
write_file(g_File1"// Default: 5, 5, 10, 10, 15, 15, 20, 20, 400, 600");
        
write_file(g_File1"vip_hp_kill ^"5^"");
        
write_file(g_File1"vip_ap_kill ^"5^"");
        
write_file(g_File1"vip_hp_hs ^"10^"");
        
write_file(g_File1"vip_ap_hs ^"10^"");
        
write_file(g_File1"vip_hp_kill_knife ^"15^"");
        
write_file(g_File1"vip_ap_kill_knife ^"15^"");
        
write_file(g_File1"vip_hp_hs_knife ^"20^"");
        
write_file(g_File1"vip_ap_hs_knife ^"20^"");
        
write_file(g_File1"vip_money_kill ^"400^"");
        
write_file(g_File1"vip_money_hs ^"600^"");
        
write_file(g_File1"");
        
write_file(g_File1"//// VIP Max HP/AP");
        
write_file(g_File1"// Setati maximul de hp/ap pe care il poate avea vipul");
        
write_file(g_File1"// Default: 200, 200");
        
write_file(g_File1"vip_max_hp ^"200^"");
        
write_file(g_File1"vip_max_ap ^"200^"");
        
write_file(g_File1"");
        
write_file(g_File1"//// VIP Jump");
        
write_file(g_File1"// Setati cat poate sari vipul");
        
write_file(g_File1"// 0 - dezactivat");
        
write_file(g_File1"// 1 - 2x jump");
        
write_file(g_File1"// 2 - 3x jump");
        
write_file(g_File1"// 3 - 4x jump");
        
write_file(g_File1"// ...");
        
write_file(g_File1"// z - yx jump");
        
write_file(g_File1"Default: 1");
        
write_file(g_File1"vip_jump ^"1^"");
        
write_file(g_File1"");
        
write_file(g_File1"//// VIP Parachute");
        
write_file(g_File1"// Setati daca vip-ul va avea sau nu parasuta");
        
write_file(g_File1"// 0 - dezactivat");
        
write_file(g_File1"// 1 - activat");
        
write_file(g_File1"// Default: 1");
        
write_file(g_File1"vip_parachute ^"1^"");
        
write_file(g_File1"");
        
write_file(g_File1"//// VIP Defuse Kit (Only CT)");
        
write_file(g_File1"// 0 - dezactivat");
        
write_file(g_File1"// 1 - activat");
        
write_file(g_File1"// Default: 1");
        
write_file(g_File1"vip_defusekit ^"1^"");
        
write_file(g_File1"");
        
write_file(g_File1"//// VIP Show");
        
write_file(g_File1"// Setati momentele in care vor fi afisati vipii");
        
write_file(g_File1"// 0 - dezactivat");
        
write_file(g_File1"// 1 - activat");
        
write_file(g_File1"// Cand intra/iese de pe server cu mesaj in chat");
        
write_file(g_File1"// Default: 1");
        
write_file(g_File1"vip_in_out ^"1^"");
        
write_file(g_File1"");
        
write_file(g_File1"// Cand tastezi comanda /vips apare in chat");
        
write_file(g_File1"// Default: 1");
        
write_file(g_File1"vip_show_chat ^"1^"");
        
write_file(g_File1"");
        
write_file(g_File1"// Afisare in hud in coltul stang, sus");
        
write_file(g_File1"// Default: 1");
        
write_file(g_File1"vip_show_hud ^"1^"");
        
write_file(g_File1"");
        
write_file(g_File1"// Afisare in TAB (ScoreBoard)");
        
write_file(g_File1"// Default: 1");
        
write_file(g_File1"vip_tab ^"1^"");
        
write_file(g_File1"");
        
write_file(g_File1"//// VIP Bulletdamage + mode");
        
write_file(g_File1"// Setati daca vipul va avea bulletdamage");
        
write_file(g_File1"// 0 - dezactivat");
        
write_file(g_File1"// 1 - activat");
        
write_file(g_File1"// Default: 1");
        
write_file(g_File1"vip_bulletdmg ^"1^"");
        
write_file(g_File1"");
        
write_file(g_File1"// Setati modul de aparitie al bulletdamageului");
        
write_file(g_File1"// vip_bulletdmg trebuie sa fie setat pe 1");
        
write_file(g_File1"// 0 - dezactivat");
        
write_file(g_File1"// 1 - cerc multi color pentru ambele echipe");
        
write_file(g_File1"// 2 - cerc albastru/rosu (CT - albastru / T - rosu)");
        
write_file(g_File1"// 3 - centru multi color pentru ambele echipe");
        
write_file(g_File1"// 4 - centru albastru/rosu (CT - albastru / T - rosu)");
        
write_file(g_File1"// Default: 1");
        
write_file(g_File1"vip_bulletdmg_mode ^"1^"");
        
write_file(g_File1"");
        
write_file(g_File1"//// VIP Model");
        
write_file(g_File1"// Setati daca vip-ul va avea model sau nu");
        
write_file(g_File1"// 0 - dezactivat");
        
write_file(g_File1"// 1 - activat");
        
write_file(g_File1"// Daca doriti sa activati modelul, setati valoarea 1 si schimbati mapa ca sa se descarce modelele");
        
write_file(g_File1"// Daca doriti sa dezactivati modelul, setati valoarea 0 si schimbati mapa ca sa nu se mai descarce modelele");
        
write_file(g_File1"Default: 1");
        
write_file(g_File1"vip_model ^"1^"");
        
write_file(g_File1"");
        
write_file(g_File1"//// VIP Free");
        
write_file(g_File1"// Setati daca va fi vip free sau nu pe server");
        
write_file(g_File1"// 0 - dezactivat");
        
write_file(g_File1"// 1 - activat");
        
write_file(g_File1"vip_free ^"1^"");
        
write_file(g_File1"");
        
write_file(g_File1"// Setati orele intre care va fi vip free");
        
write_file(g_File1"// Ore disponibile");
        
write_file(g_File1"// 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12");
        
write_file(g_File1"// 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 00");
        
write_file(g_File1"// Default: 22, 08");
        
write_file(g_File1"vip_free_start ^"22^"");
        
write_file(g_File1"vip_free_end ^"10^"");
    }
    
    
server_cmd "exec %s"g_File1;
    
    if(!
file_exists(g_File2))
    {
        
write_file(g_File2";--------------- | Lista hartilor pe care meniul vipului este restrictionat | ---------------");
        
write_file(g_File2"");
        
write_file(g_File2";Adaugati mapele una sub alta");
        
write_file(g_File2"");
        
write_file(g_File2"35hp");
        
write_file(g_File2"awp_india");
    }
}

public 
sayCommand(id)
{
    new 
Said[10];
    
read_args Saidcharsmax(Said);
    
remove_quotes(Said);
    
    if(
equal(Said"/vips")) showVipsC(id);
    else if(
equal(Said"/vip")) vipInfo(id);
    else if(
equal(Said"/vmenu"))
        if(
get_pcvar_num(g_Cvar[0]) == 1)
            if(
g_Menu[id] == true)
                
vipMenu(id);
                

    return 
0;
}

public 
client_putinserver(id)
{
    if(!(
get_user_flags(id) & read_flags(VIP_FLAG)))
        return 
1;
        
    
set_task 2.0"vipIn"id;
    
    
g_JumpNum[id] = 0;
    
g_DoJump[id] = false;
    
g_Round[id] = 0;
    
g_Use[id] = false;
    
g_Menu[id] = true;
    return 
1;
}

    
#if AMXX_VERSION_NUM < 183
public client_disconnect(id)
    
#else
public client_disconnected(id)
    
#endif
{
    if(!(
get_user_flags(id) & read_flags(VIP_FLAG)))
        return 
1;
        
    
set_task 2.0"vipOut"id;
    
    
g_JumpNum[id] = 0;
    
g_DoJump[id] = false;
    
g_Round[id] = 0;
    
g_Use[id] = false;
    
    return 
1;
}

public 
vipInfo(idshow_motd(id"/addons/amxmodx/configs/vipInfo.txt");

public 
msgInfo()
{
    new 
tag[32];
    
get_pcvar_string g_Cvar[1], tagcharsmax(tag);

        
#if AMXX_VERSION_NUM < 183
    
ColorChat 0GREEN"^3[%s] ^1Tastati in chat ^4/vip ^1pentru a vedea beneficiile si pretul vip-ului."tag;
        
#else
    
client_print_color 0print_team_default"^3[%s] ^1Tastați Ón chat ^4/vip ^1pentru a vedea beneficiile și prețul vip-ului."tag;
        
#endif
}

public 
plugin_precache()
{
    
g_Cvar[15] = register_cvar("vip_model""1");
    
    if(
get_pcvar_num(g_Cvar[15]) == 0)
       return 
1;
    
    
precache_model "models/player/vip_tero/vip_tero.mdl";
    
precache_model "models/player/vip_ct/vip_ct.mdl";
    
    return 
1;
}

public 
newRound()
    for(new 
032i++)
        
g_Use[i] = false;

public 
vipMenu(id)
{
    if(!
is_user_alive(id) || !(get_user_flags(id) & read_flags(VIP_FLAG)) || g_Use[id])
        return 
1;
    
    new 
menu;
    switch(
cs_get_user_team(id))
    {
        case 
CS_TEAM_T:
        {
            
menu menu_create("\r[\dMenu\r] \yTerrorists""Ammunition");
            
menu_additem menu"Ak47+Deagle+Set grenade""1";
            
menu_additem menu"M4A1+Deagle+Set grenade""2";
            
menu_additem menu"Awp+Deagle+Set grenade""3";
        }

        case 
CS_TEAM_CT:
        {
            
menu menu_create("\r[\dMenu\r] \yCounter-Terorists""Ammunition");
            
menu_additem menu"M4a1+Deagle+Set grenade""1";
            
menu_additem menu"Ak47+Deagle+Set grenade""2";
            
menu_additem menu"Awp+Deagle+Set grenade""3";
        }
    }
    
menu_display idmenu0;
    return 
1;
}

public 
Ammunition(idmenuitem)
{
    if(
item == MENU_EXIT)
        return 
1;

    new 
accesscallbackdata[6], szName[64], tag[32];
    
menu_item_getinfo(menuitemaccessdatacharsmax(data), szNamecharsmax(szName), callback);
    
get_pcvar_string g_Cvar[1], tagcharsmax(tag);
    new 
key str_to_num(data);
        
    if(
cs_get_user_team(id) == CS_TEAM_T)
    {
        switch(
key)
        {
            case 
1:
            {
                
StripWeapons idPrimary;
                
StripWeapons idSecondary;
                
give_item id"weapon_knife";
                
give_item id"weapon_ak47";
                
give_item id"weapon_deagle";
                
give_item id"weapon_hegrenade";
                
give_item id"weapon_flashbang";
                
give_item id"weapon_smokegrenade";
                
cs_set_user_bpammo idCSW_FLASHBANG2;
                
cs_set_user_bpammo idCSW_AK4790;
                
cs_set_user_bpammo idCSW_DEAGLE35;
                    
#if AMXX_VERSION_NUM < 183
                
ColorChat idGREEN"^3[%s] ^1Ai ales ^4Ak47^1+^4Deagle^1+^4Set grenade^1."tag;
                    
#else
                
client_print_color idprint_team_default"^3[%s] ^1Ai ales ^4Ak47^1+^4Deagle^1+^4Set grenade^1."tag;
                    
#endif
                
g_Use[id] = true;
            }
            
            case 
2:
            {
                
StripWeapons idPrimary;
                
StripWeapons idSecondary;
                
give_item id"weapon_knife";
                
give_item id"weapon_m4a1";
                
give_item id"weapon_deagle";
                
give_item id"weapon_hegrenade";
                
give_item id"weapon_flashbang";
                
give_item id"weapon_smokegrenade";
                
cs_set_user_bpammo idCSW_FLASHBANG2;
                
cs_set_user_bpammo idCSW_M4A190;
                
cs_set_user_bpammo idCSW_DEAGLE35;
                    
#if AMXX_VERSION_NUM < 183
                
ColorChat idGREEN"^3[%s] ^1Ai ales ^4Galil^1+^4Deagle^1+^4Set grenade^1."tag;
                    
#else
                
client_print_color idprint_team_default"^3[%s] ^1Ai ales ^4Galil^1+^4Deagle^1+^4Set grenade^1."tag;
                    
#endif
                
g_Use[id] = true;
            }
            
            case 
3:
            {
                
StripWeapons idPrimary;
                
StripWeapons idSecondary;
                
give_item id"weapon_knife";
                
give_item id"weapon_awp";
                
give_item id"weapon_deagle";
                
give_item id"weapon_hegrenade";
                
give_item id"weapon_flashbang";
                
give_item id"weapon_smokegrenade";
                
cs_set_user_bpammo idCSW_FLASHBANG2;
                
cs_set_user_bpammo idCSW_AWP30;
                
cs_set_user_bpammo idCSW_DEAGLE35;
                    
#if AMXX_VERSION_NUM < 183
                
ColorChat idGREEN"^3[%s] ^1Ai ales ^4Awp^1+^4Deagle^1+^4Set grenade^1."tag;
                    
#else
                
client_print_color idprint_team_default"^3[%s] ^1Ai ales ^4Awp^1+^4Deagle^1+^4Set grenade^1."tag;
                    
#endif
                
g_Use[id] = true;
            }
        }
    }
    
    if(
cs_get_user_team(id) == CS_TEAM_CT)
    {
        switch(
key)
        {
            case 
1:
            {
                
StripWeapons idPrimary;
                
StripWeapons idSecondary;
                
give_item id"weapon_knife";
                
give_item id"weapon_m4a1";
                
give_item id"weapon_deagle";
                
give_item id"weapon_hegrenade";
                
give_item id"weapon_flashbang";
                
give_item id"weapon_smokegrenade";
                
cs_set_user_bpammo idCSW_FLASHBANG2;
                
cs_set_user_bpammo idCSW_M4A190;
                
cs_set_user_bpammo idCSW_DEAGLE35;
                    
#if AMXX_VERSION_NUM < 183
                
ColorChat idGREEN"^3[%s] ^1Ai ales ^4M4a1^1+^4Deagle^1+^4Set grenade^1."tag;
                    
#else
                
client_print_color idprint_team_default"^3[%s] ^1Ai ales ^4M4a1^1+^4Deagle^1+^4Set grenade^1."tag;
                    
#endif
                
g_Use[id] = true;
            }
            
            case 
2:
            {
                
StripWeapons idPrimary;
                
StripWeapons idSecondary;
                
give_item id"weapon_knife";
                
give_item id"weapon_ak47";
                
give_item id"weapon_deagle";
                
give_item id"weapon_hegrenade";
                
give_item id"weapon_flashbang";
                
give_item id"weapon_smokegrenade";
                
cs_set_user_bpammo idCSW_FLASHBANG2;
                
cs_set_user_bpammo idCSW_AK4790;
                
cs_set_user_bpammo idCSW_DEAGLE35;
                    
#if AMXX_VERSION_NUM < 183
                
ColorChat idGREEN"^3[%s] ^1Ai ales ^4Famas^1+^4Deagle^1+^4Set grenade^1."tag;
                    
#else
                
client_print_color idprint_team_default"^3[%s] ^1Ai ales ^4Famas^1+^4Deagle^1+^4Set grenade^1."tag;
                    
#endif
                
g_Use[id] = true;
            }
            
            case 
3:
            {
                
StripWeapons idPrimary;
                
StripWeapons idSecondary;
                
give_item id"weapon_knife";
                
give_item id"weapon_awp";
                
give_item id"weapon_deagle";
                
give_item id"weapon_hegrenade";
                
give_item id"weapon_flashbang";
                
give_item id"weapon_smokegrenade";
                
cs_set_user_bpammo idCSW_FLASHBANG2;
                
cs_set_user_bpammo idCSW_AWP30;
                
cs_set_user_bpammo idCSW_DEAGLE35;
                    
#if AMXX_VERSION_NUM < 183
                
ColorChat idGREEN"^3[%s] ^1Ai ales ^4Awp^1+^4Deagle^1+^4Set grenade^1."tag;
                    
#else
                
client_print_color idprint_team_default"^3[%s] ^1Ai ales ^4Awp^1+^4Deagle^1+^4Set grenade^1."tag;
                    
#endif
                
g_Use[id] = true;
            }      
        }
    }
    
    
menu_destroy(menu);
    return 
1;  
}

public 
Spawn(id)

    if(!
is_user_alive(id) || !(get_user_flags(id) & read_flags(VIP_FLAG)))
        return 
1;
        
    if(
get_pcvar_num(g_Cvar[0]) == 2)
    {
        if(
g_Menu[id] == true)
            if(
g_Round[id] >= 2)
                
vipMenu(id);
        
        
g_Round[id]++;    
    }

    if(
get_pcvar_num(g_Cvar[26]) == 1) if(cs_get_user_team(id) == CS_TEAM_CTgive_item id"item_thighpack";
    
give_item id"item_assaultsuit";
    
set_user_health idget_pcvar_num(g_Cvar[2]);
    
set_user_armor idget_pcvar_num(g_Cvar[3]);
    
cs_set_user_money idclamp(cs_get_user_money(id) + get_pcvar_num(g_Cvar[4]), 016000);    
    
    new 
MapName[32],
        
szLine[128],
        
iLen;
    new 
Size file_size(g_File21)    

    
get_mapname(MapNamesizeof(MapName));
    for(new 
0Size++)
    {
        
read_file(g_File2iszLinecharsmax(szLine), iLen);
        if(
equali(MapNameszLine))
            
g_Menu[id] = false;
    }
    
    return 
1;
}

public 
GiveVIP()
{
    if(
get_pcvar_num(g_Cvar[27]) == 1)
    {
        
time(o__);
        
        if(
>= get_pcvar_num(g_Cvar[28]) && 24 || >= 00 && get_pcvar_num(g_Cvar[29]))
        {
            for(new 
1<= get_maxplayers(); i++)
                if(
is_user_connected(i) || !is_user_bot(i) || !is_user_hltv(i) || !(get_user_flags(i) & read_flags(VIP_FREEFLAG)))
                    
set_user_flags iread_flags(VIP_FREEFLAG)
          
            
set_hudmessage random_num(0255), random_num(0255), random_num(0255), -1.00.0201.01.0;
            
show_hudmessage 0"EVENT VIP FREE %i:00 - %i:00"get_pcvar_num(g_Cvar[28]), get_pcvar_num(g_Cvar[29]);
            
        }
        
        if(
== get_pcvar_num(g_Cvar[29])) server_cmd("amx_reloadadmins");
    }
}

public 
vipIn(id)
{
    if(!(
get_user_flags(id) & read_flags(VIP_FLAG)))
        return 
1;
        
    if(
get_pcvar_num(g_Cvar[16]) == 1)
    {
        new 
tag[32], name[32];

        
get_pcvar_string g_Cvar[1], tagcharsmax(tag); 
        
get_user_name idnamecharsmax(name);

            
#if AMXX_VERSION_NUM < 183
        
ColorChat 0GREEN"^3[%s] ^4%s ^1s-a conectat pe server."tagname;
            
#else
        
client_print_color 0print_team_default"^3[%s] ^4%s ^1s-a conectat pe server."tagname;
            
#endif
    
}
    
    return 
1;
}    

public 
vipOut(id)
{
    if(!(
get_user_flags(id) & read_flags(VIP_FLAG)))
        return 
1;
        
    if(
get_pcvar_num(g_Cvar[16]) == 1)
    {
        new 
tag[32], name[32];

        
get_pcvar_string g_Cvar[1], tagcharsmax(tag); 
        
get_user_name idnamecharsmax(name);
        
            
#if AMXX_VERSION_NUM < 183
        
ColorChat 0GREEN"^3[%s] ^4%s ^1s-a deconectat de pe server."tagname;
            
#else
        
client_print_color 0print_team_default"^3[%s] ^4%s ^1s-a deconectat de pe server."tagname;
            
#endif 
    
}
    
    return 
1;
}

public 
client_PreThink(id)
{
    if(!
is_user_alive(id) || !(get_user_flags(id) & read_flags(VIP_FLAG))) 
        return 
1;
        
    new 
Float:fallspeed 100.0 * -1.0;
    new 
BUTTON get_user_button(id);
    new 
OLDBUTON get_user_oldbutton(id);
    new 
JUMP_VIP get_pcvar_num(g_Cvar[5]);

    if((
BUTTON IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(OLDBUTON IN_JUMP))
    {
        if(
g_JumpNum[id] < JUMP_VIP)
        {
            
g_DoJump[id] = true;
            
g_JumpNum[id]++
        }
    }

    if((
BUTTON IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
        
g_JumpNum[id] = 0;
    
    if(
get_pcvar_num(g_Cvar[21]) == 1)
    {
        if(
BUTTON IN_USE
        {
            new 
Float:velocity[3];
            
entity_get_vector(idEV_VEC_velocityvelocity);
        
            if(
velocity[2] < 0.0
            {
                
entity_set_int idEV_INT_sequence3;
                
entity_set_int idEV_INT_gaitsequence1;
                
entity_set_float idEV_FL_frame1.0;
                
entity_set_float idEV_FL_framerate1.0;

                
velocity[2] = (velocity[2] + 40.0 fallspeed) ? velocity[2] + 40.0 fallspeed;
                
entity_set_vector idEV_VEC_velocityvelocity;
            }
        }
    }
    
    return 
0;
}

public 
client_PostThink(id)
{
    if(!
is_user_alive(id)) 
        return 
1;
        
    if(
g_DoJump[id] == true)
    {
        new 
Floatvelocity[3];
        
entity_get_vector idEV_VEC_velocityvelocity;
        
velocity[2] = random_float(265.0285.0);
        
entity_set_vector idEV_VEC_velocityvelocity;
        
g_DoJump[id] = false;
    }

    return 
0;
}

public 
client_death(killervictimweaponhitplace)
{
    if(!(
get_user_flags(killer) & read_flags(VIP_FLAG))) 
        return 
1;
        
    new 
VIP_MAXHP get_pcvar_num(g_Cvar[19]);
    new 
VIP_HP get_user_health(killer);
    new 
VIP_MAXAP get_pcvar_num(g_Cvar[20]);
    new 
VIP_AP get_user_armor(killer);
    
    if(!(
hitplace == HIT_HEAD) && !(weapon == CSW_KNIFE))
    {
        if(
VIP_HP >= VIP_MAXHPset_user_health killerVIP_MAXHP;
        else 
set_user_health killerVIP_HP get_pcvar_num(g_Cvar[6]);
    
        if(
VIP_AP >= VIP_MAXAPset_user_armor killerVIP_MAXAP;
        else 
set_user_armor killerVIP_AP get_pcvar_num(g_Cvar[7]);
        
        
cs_set_user_money killerclamp(cs_get_user_money(killer) - 300 get_pcvar_num(g_Cvar[22]), 016000);
    }
    
    if(
hitplace == HIT_HEAD && !(weapon == CSW_KNIFE))
    {
        if(
VIP_HP >= VIP_MAXHPset_user_health killerVIP_MAXHP;
        else 
set_user_health killerVIP_HP get_pcvar_num(g_Cvar[8]);
    
        if(
VIP_AP >= VIP_MAXAPset_user_armor killerVIP_MAXAP;
        else 
set_user_armor killerVIP_AP get_pcvar_num(g_Cvar[9]);
        
        
cs_set_user_money killerclamp(cs_get_user_money(killer) - 300 get_pcvar_num(g_Cvar[23]), 016000);
    }
    
    if(
weapon == CSW_KNIFE && !(hitplace == HIT_HEAD))
    {
        if(
VIP_HP >= VIP_MAXHPset_user_health killerVIP_MAXHP;
        else 
set_user_health killerVIP_HP get_pcvar_num(g_Cvar[10]);
    
        if(
VIP_AP >= VIP_MAXAPset_user_armor killerVIP_MAXAP;
        else 
set_user_armor(killerVIP_AP get_pcvar_num(g_Cvar[11]));

        
cs_set_user_money killerclamp(cs_get_user_money(killer) - 300 get_pcvar_num(g_Cvar[22]), 016000);
    }
    
    if(
weapon == CSW_KNIFE && (hitplace == HIT_HEAD))
    {
        if(
VIP_HP >= VIP_MAXHPset_user_health killerVIP_MAXHP;
        else 
set_user_health killerVIP_HP get_pcvar_num(g_Cvar[12]);
    
        if(
VIP_AP >= VIP_MAXAPset_user_armor killerVIP_MAXAP;
        else 
set_user_armor killerVIP_AP get_pcvar_num(g_Cvar[13]);
        
        
cs_set_user_money killerclamp(cs_get_user_money(killer) - 300 get_pcvar_num(g_Cvar[23]), 016000);
    }

    return 
1;
}

public 
client_damage(iAttackeriVictimiDamage)
{
    if(!(
get_user_flags(iAttacker) & read_flags(VIP_FLAG)))
        return 
1;
        
    if(
get_pcvar_num(g_Cvar[14]) == 1)
    {
        if(
get_pcvar_num(g_Cvar[24]) == 1)
        {
            if(++
g_iPosition[iAttacker] == g_iSize)
                
g_iPosition[iAttacker] = 0;

            
set_hudmessage random_num(0255), random_num(0255), random_num(0255), Floatg_flCoords[g_iPosition[iAttacker]][0], Floatg_flCoords[g_iPosition[iAttacker]][1], 00.12.50.020.02, -1;
            
show_hudmessage iAttacker"%i"iDamage;
        }
        
        else if(
get_pcvar_num(g_Cvar[24]) == 2)
        {
            if(++
g_iPosition[iAttacker] == g_iSize)
                
g_iPosition[iAttacker] = 0;
            
            if(
cs_get_user_team(iAttacker) == CS_TEAM_CT)
            {
                
set_hudmessage 42170255Floatg_flCoords[g_iPosition[iAttacker]][0], Floatg_flCoords[g_iPosition[iAttacker]][1], 00.12.50.020.02, -1;
                
show_hudmessage iAttacker"%i"iDamage;
            }
            
            else if(
cs_get_user_team(iAttacker) == CS_TEAM_T)
            {
                
set_hudmessage 20000Floatg_flCoords[g_iPosition[iAttacker]][0], Floatg_flCoords[g_iPosition[iAttacker]][1], 00.12.50.020.02, -1;
                
show_hudmessage iAttacker"%i"iDamage;
            }
        }
        
        else if(
get_pcvar_num(g_Cvar[24]) == 3)
        {
            
set_hudmessage random_num(0255), random_num(0255), random_num(0255), -1.00.500.00.10.10.1;
            
show_hudmessage iAttacker"%i"iDamage;
        }

        else if(
get_pcvar_num(g_Cvar[24]) == 4)
        {
            if(
cs_get_user_team(iAttacker) == CS_TEAM_CT)
            {
                
set_hudmessage 42170255, -1.00.500.00.10.10.1;
                
show_hudmessage iAttacker"%i"iDamage;
            }
            
            else if(
cs_get_user_team(iAttacker) == CS_TEAM_T)
            {
                
set_hudmessage 20000, -1.00.500.00.10.10.1;
                
show_hudmessage iAttacker"%i"iDamage;
            }
        }
    }
    
    return 
1;
}

public 
showVipsC(user)
{
    if(
get_pcvar_num(g_Cvar[17]) == 1)
    {
        new 
tag[32];
        
get_pcvar_string g_Cvar[1], tagcharsmax(tag);
    
        new 
vipNames[33][32];
        new 
message[256];
        new 
idcountxlen;

        for(
id id <= get_maxplayers() ; id++)
            if(
is_user_connected(id))
                if(
get_user_flags(id) & read_flags(VIP_FLAG))
                    
get_user_name idvipNames[count++], charsmax(vipNames[]);
    
        
len format(message255"^3[%s] ^1VIP-ii online sunt:^4 "tag);
        if(
count 0)
        {
            for(
count x++)
            {
                
len += format(message[len], 255-len"%s%s "vipNames[x], < (count-1) ? ", ":"");
                if(
len 96)
                {
                    
print_message(usermessage);
                    
len format(message255" ");
                }
            }
            
            
print_message(usermessage);
        }
        
        else
        {
                
#if AMXX_VERSION_NUM < 183
            
ColorChat idGREEN"^3[%s] ^1Nu sunt ^4VIP^1-i online."tag;
                
#else
            
client_print_color idprint_team_default"^3[%s] ^1Nu sunt ^4VIP^1-i online."tag;
                
#endif
        
}            
    }
    return 
0;  
}

print_message(idmsg[])
{
    
message_begin(MSG_ONEget_user_msgid("SayText"), {0,0,0}, id);
    
write_byte(id);
    
write_string(msg);
    
message_end();
}

public 
showVipsH()
{
    if(
get_pcvar_num(g_Cvar[18]) == 1)
    {
        static 
iPlayers[32];
        static 
iPlayersNum;
    
        
get_players(iPlayersiPlayersNum"ch");
        if(!
iPlayersNum)
            return 
1;
    
        static 
iVipsConnectedszVipsNames[128], szName[32];
        
formatex(szVipsNamessizeof (szVipsNames) -1"");
        
iVipsConnected 0;
    
        static 
idi;
        for(
0iPlayersNumi++)
        {
            
id iPlayers[i];
            if(
get_user_flags(id) & read_flags(VIP_FLAG))
            {
                
get_user_name(idszNamesizeof(szName) -1);
                
                
add(szVipsNamessizeof(szVipsNames) -1szName);
                
add(szVipsNamessizeof(szVipsNames) -1"^n");
                
                
iVipsConnected++;
            }    
        }
    
        
formatex(g_szMessagesizeof(g_szMessage) -1"%s (%i)^n%s"g_szBeginningiVipsConnectedszVipsNames);
        
        
set_hudmessage 25255250.010.1500.01.00.10.1, -1;
        
ShowSyncHudMsg 0SyncHudMessageg_szMessage;
    }
    return 
0;    
}

public 
resetModel(idlevelcid)
{
    if(!
is_user_alive(id) || !(get_user_flags(id) & read_flags(VIP_FLAG)) || get_pcvar_num(g_Cvar[15]) == 0)
       return 
1;    

    new 
CsTeams:userTeam cs_get_user_team(id)
    if(
userTeam == CS_TEAM_T)
        
cs_set_user_model id"vip_tero";
    else if(
userTeam == CS_TEAM_CT)
        
cs_set_user_model id"vip_ct";
    else
        
cs_reset_user_model(id);

    return 
0;
}

public 
MessageScoreAttrib(iMsgIDiDestiReceiver)
{
    if(
get_pcvar_num(g_Cvar[25]) == 1)
    {
        new 
id get_msg_arg_int(1);

        if(
is_user_connected(id) && (get_user_flags(id) & read_flags(VIP_FLAG)))
            
set_msg_arg_int(2ARG_BYTESCOREATTRIB_VIP);
    }
}

stock StripWeapons(idTypeboolbSwitchIfActive true)
{
    new 
iReturn;
   
    if(
is_user_alive(id))
    {
        new 
iEntityiWeapon;
        while((
iWeapon GetWeaponFromSlot(idTypeiEntity)) > 0)
            
iReturn ham_strip_user_weapon(idiWeaponTypebSwitchIfActive);
    }
   
    return 
iReturn;
}

stock GetWeaponFromSlotid iSlot , &iEntity )
{
    if ( !( 
<= iSlot <= ) )
        return 
0;
   
    
iEntity 0;
    const 
m_rgpPlayerItems_Slot0 367;
    const 
m_iId 43;
    const 
XO_WEAPONS 4;
    const 
XO_PLAYER 5;
       
    
iEntity get_pdata_cbaseid m_rgpPlayerItems_Slot0 iSlot XO_PLAYER );
   
    return ( 
iEntity ) ? get_pdata_intiEntity m_iId XO_WEAPONS ) : 0;
}  
 
stock ham_strip_user_weapon(idiCswIdiSlot 0bool:bSwitchIfActive true)
{
    new 
iWeapon
    
if( !iSlot )
    {
        static const 
iWeaponsSlots[] = {
            -
1,
            
2//CSW_P228
            
-1,
            
1//CSW_SCOUT
            
4//CSW_HEGRENADE
            
1//CSW_XM1014
            
5//CSW_C4
            
1//CSW_MAC10
            
1//CSW_AUG
            
4//CSW_SMOKEGRENADE
            
2//CSW_ELITE
            
2//CSW_FIVESEVEN
            
1//CSW_UMP45
            
1//CSW_SG550
            
1//CSW_GALIL
            
1//CSW_FAMAS
            
2//CSW_USP
            
2//CSW_GLOCK18
            
1//CSW_AWP
            
1//CSW_MP5NAVY
            
1//CSW_M249
            
1//CSW_M3
            
1//CSW_M4A1
            
1//CSW_TMP
            
1//CSW_G3SG1
            
4//CSW_FLASHBANG
            
2//CSW_DEAGLE
            
1//CSW_SG552
            
1//CSW_AK47
            
3//CSW_KNIFE
            
//CSW_P90
        
}
        
iSlot iWeaponsSlots[iCswId]
    }
 
    const 
XTRA_OFS_PLAYER 5
    
const m_rgpPlayerItems_Slot0 367
 
    iWeapon 
get_pdata_cbase(idm_rgpPlayerItems_Slot0 iSlotXTRA_OFS_PLAYER)
 
    const 
XTRA_OFS_WEAPON 4
    
const m_pNext 42
    
const m_iId 43
 
    
while( iWeapon )
    {
        if( 
get_pdata_int(iWeaponm_iIdXTRA_OFS_WEAPON) == iCswId )
        {
            break
        }
        
iWeapon get_pdata_cbase(iWeaponm_pNextXTRA_OFS_WEAPON)
    }
 
    if( 
iWeapon )
    {
        const 
m_pActiveItem 373
        
if( bSwitchIfActive && get_pdata_cbase(idm_pActiveItemXTRA_OFS_PLAYER) == iWeapon )
        {
            
ExecuteHamB(Ham_Weapon_RetireWeaponiWeapon)
        }
 
        if( 
ExecuteHamB(Ham_RemovePlayerItemidiWeapon) )
        {
            
user_has_weapon(idiCswId0)
            
ExecuteHamB(Ham_Item_KilliWeapon)
            return 
1
        
}
    }
 
    return 
0


Last edited by decayed66; 02-21-2021 at 20:56.
decayed66 is offline
lexzor
Senior Member
Join Date: Nov 2020
Old 02-22-2021 , 04:20   Re: Vip sistem
Reply With Quote #2

first of all, use a boolean to check if event is on or not then hook player spawn into a function using hamsandwich library. from there you can use that function to show that menu.

here you have a little example:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandiwch>

new bool:event 

public plugin_init() {
    
    
RegisterHam(Ham_Spawn"player""menu_func"1)

}

public 
menu_func(id)
{
    if(
is_user_alive(id) && event// check if player is alive and  event is on
    
{
            
// create menu and show it to player
    
}
}

public 
HappyHourCheck()
{
        
// code to check if happy hour is on or not
        // if happy hour is on:
        
event true
        
// else
        
event false


Last edited by lexzor; 02-22-2021 at 04:22.
lexzor is offline
decayed66
Junior Member
Join Date: Jul 2014
Old 02-22-2021 , 13:31   Re: Vip sistem
Reply With Quote #3

Hi there, I tried but didn't work still don't show the menu when I have free flag or when is happy hour.
decayed66 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:03.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode