Raised This Month: $276 Target: $400
 69% 

Solved delete


Post New Thread Reply   
 
Thread Tools Display Modes
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-12-2020 , 10:14   Re: [Requist] Vip-Menu
Reply With Quote #21

@Napoleon_be - you should break the loop after a match has been found. There's no need to loop all other remaining weapons.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-12-2020 , 10:28   Re: [Requist] Vip-Menu
Reply With Quote #22

Quote:
Originally Posted by OciXCrom View Post
@Napoleon_be - you should break the loop after a match has been found. There's no need to loop all other remaining weapons.
Should i do this in every loop? I mean can i also use break in the loop where i set double damage? Adjusted my code, let me know if it's alright or that there still should be some adjustments made.
__________________

Last edited by Napoleon_be; 01-12-2020 at 10:31.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-12-2020 , 11:52   Re: [Requist] Vip-Menu
Reply With Quote #23

Added double jump on request of topic author
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>
#include <colorchat>
#include <cstrike>
#include <fakemeta>
#include <engine>

#define PLUGIN "VIP-Menu"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"

#define VIP_LEVEL ADMIN_LEVEL_B

new bool:bUsedMenu[33];
new 
bool:bHasWeapon[33];

new 
bool:bDoJump[33];

new 
iJumpNum[33];

new const 
szMotd[] = "addons/amxmodx/configs/vip.html";

new const 
szMenuItems[][] = 
{
    
"Deadly AK47 + Deadly Deagle",
    
"Deadly M4A1 + Deadly Deagle",
    
"Deadly AWP + Deadly Deagle"
};

new const 
iWeapons[] =
{
    
CSW_AK47,
    
CSW_M4A1,
    
CSW_AWP
};

new const 
szWeapons[][] =
{
    
"weapon_ak47",
    
"weapon_m4a1",
    
"weapon_awp"
};

new const 
szWeaponModels[][] =
{
    
"models/vmenu/v_deadly_ak47.mdl",
    
"models/vmenu/v_deadly_m4a1.mdl",
    
"models/vmenu/v_deadly_awp.mdl",
    
"models/vmenu/v_deadly_deagle.mdl"
};

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_clcmd("say /vips""VipsOnline");
    
register_clcmd("say /vip""VipMotd");
    
register_clcmd("say /vmenu""VipMenu");
    
    
RegisterHam(Ham_Spawn"player""PostSpawn"1);
    
RegisterHam(Ham_TakeDamage"player""PreDoubleDamage");
    
RegisterHam(Ham_Killed"player""PostPlayerKilled"1);
    
    
register_event("HLTV""NewRound""a""1=0""2=0");
    
register_event("CurWeapon""WeaponChange""be""1=1");
    
    
register_message(get_user_msgid("ScoreAttrib"), "MsgScoreAttrib");
    
}

public 
plugin_precache()
{
    for(new 
isizeof(szWeaponModels); i++)
    {
        
precache_model(szWeaponModels[i]);
    }
}

public 
NewRound()
{
    new 
szPlayers[32], iNum;
    
get_players(szPlayersiNum);
    
    for(new 
iiNumi++)
    {
        if(
get_user_flags(szPlayers[i]) & VIP_LEVEL)
        {
            
bUsedMenu[szPlayers[i]] = false;
        }
    }
}

public 
WeaponChange(id
{
    new 
iAmmoiClipiWeapon get_user_weapon(idiAmmoiClip);
    
    if(
bHasWeapon[id])
    {
        for(new 
isizeof(iWeapons); i++)
        {
            if(
iWeapon == iWeapons[i])
            {
                
set_pev(idpev_viewmodel2szWeaponModels[i]);
                break;
            }
        }
        
        if(
iWeapon == CSW_DEAGLE)
        {
            
set_pev(idpev_viewmodel2szWeaponModels[3]);
        }
    }
}

public 
VipsOnline(id) {
    new 
bool:IsFirst true;
    new 
szMessage[256], iLenszPlayers[32], iNum;
    
    
get_players(szPlayersiNum);
    
    for(new 
iiNumi++)
    {
        if(!
is_user_connected(szPlayers[i]) || !(get_user_flags(szPlayers[i]) & VIP_LEVEL))
        {
            continue;
        }
        
        if(!
IsFirst)
        {
            
szMessage[iLen++] = ' ';
            
szMessage[iLen++] = '|';
            
szMessage[iLen++] = ' ';
        }
        
        
szMessage[iLen++] = '^x04';
        
szMessage[iLen] = EOS;
        
        
iLen += get_user_name(szPlayers[i], szMessage[iLen], charsmax(szMessage) - iLen);
        
        
szMessage[iLen++] = '^x01';
        
szMessage[iLen] = EOS;
        
        
IsFirst false;
    }
    
    if(
IsFirst)
    {

        
ColorChat(idGREEN"There are no vips online.");
        return 
PLUGIN_HANDLED;
    }
    else
    {
        
ColorChat(idTEAM_COLOR"Online Vips: %s"szMessage);
        return 
PLUGIN_HANDLED;        
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
VipMotd(id
{
    
show_motd(idszMotd"VIP");
}

public 
VipMenu(id
{
    if(!(
get_user_flags(id) & VIP_LEVEL))
    {
        
ColorChat(idGREEN"[Vip-Menu]^3 Only vips can use this command!");
        return 
PLUGIN_HANDLED;
    }
    
    if(
cs_get_user_team(id) != CS_TEAM_CT)
    {
        
ColorChat(idGREEN"[Vip-Menu]^3 Only CT's can use the Vip-Menu!");
        return 
PLUGIN_HANDLED;
    }
    
    if(
bUsedMenu[id])
    {
        
ColorChat(idGREEN"[Vip-Menu] You can only use this 1 time per round.");
        return 
PLUGIN_HANDLED;
    }
    
    new 
menu menu_create("[Vip-Menu]:""VipMenuHandler");

    for(new 
isizeof(szMenuItems); i++)
    {
        
menu_additem(menuszMenuItems[i]);
    }
    
menu_display(idmenu);
    return 
PLUGIN_HANDLED;
}

public 
VipMenuHandler(idmenuitem)
{
    if(!
is_user_alive(id))
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    
bUsedMenu[id] = true;
    
bHasWeapon[id] = true;
    
    
strip_user_weapons(id);
    
give_item(id"weapon_knife");
    
give_item(idszWeapons[item]);
    
give_item(id"weapon_deagle");
    
cs_set_user_bpammo(idiWeapons[item], 255);
    
cs_set_user_bpammo(idCSW_DEAGLE255);
    
    
set_pev(idpev_viewmodel2szWeaponModels[item]);
    
    
ColorChat(idGREEN"[Vip-Menu]:^3 You took: %s"szMenuItems[item]);
    
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}

public 
PostSpawn(id
{
    if(
get_user_flags(id) & VIP_LEVEL && is_user_alive(id))
    {
        if(
cs_get_user_team(id) == CS_TEAM_CT || cs_get_user_team(id) == CS_TEAM_T)
        {
            
set_user_health(id150);
            
set_user_armor(id150);
        
            new 
iAmmoiClipiWeapon get_user_weapon(idiAmmoiClip);
        
            for(new 
isizeof(iWeapons); i++)
            {
                if(
iWeapon != iWeapons[i])
                {
                    
bHasWeapon[id] = false;
                }
            }
        }
    }
}

public 
PostPlayerKilled(iVictimiAttackeriShouldGib
{
    if(
is_user_connected(iVictim) && bHasWeapon[iVictim])
    {
        
bHasWeapon[iVictim] = false;
    }
}

public 
PreDoubleDamage(idiInflictoriAttackerFloat:iDamageiDamagebits)
{
    if(!
is_user_connected(iAttacker) || iAttacker != iInflictor || !bHasWeapon[iAttacker])
    {
        return 
HAM_IGNORED;
    }
    
    new 
iWeapon get_user_weapon(iAttacker);
    
    for(new 
isizeof(iWeapons); i++)
    {
        if(
iWeapon == iWeapons[i] || iWeapon == CSW_DEAGLE)
        {
            
SetHamParamFloat(4iDamage 2);
            break;
        }
    }
    return 
HAM_HANDLED;
}

public 
client_PreThink(id)
{
    if(
is_user_alive(id) && get_user_flags(id) & VIP_LEVEL)
    {
        new 
iNewButton get_user_button(id);
        new 
iOldButton get_user_oldbutton(id);
        
        if((
iNewButton IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(iOldButton IN_JUMP))
        {
            if(
iJumpNum[id] < 1)
            {
                
bDoJump[id] = true;
                
iJumpNum[id]++;
                return 
PLUGIN_CONTINUE;
            }
        }
        
        if((
iNewButton IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
        {
            
iJumpNum[id] = 0;
            return 
PLUGIN_CONTINUE;
        }
    }
    return 
PLUGIN_CONTINUE;
}

public 
client_PostThink(id)
{
    if(
is_user_alive(id) && get_user_flags(id) & VIP_LEVEL)
    {
        if(
bDoJump[id] == true)
        {
            new 
Float:fVelocity[3];
            
entity_get_vector(idEV_VEC_velocityfVelocity);
            
fVelocity[2] = random_float(265.0285.0);
            
entity_set_vector(idEV_VEC_velocityfVelocity);
            
bDoJump[id] = false;
            return 
PLUGIN_CONTINUE;
        }
    }
    return 
PLUGIN_CONTINUE;
}

public 
client_putinserver(id
{
    if(
get_user_flags(id) & VIP_LEVEL)
    {
        
bUsedMenu[id] = false;
        
bHasWeapon[id] = false;
        
iJumpNum[id] = 0;
        
bDoJump[id]  =false;
    }
}

public 
client_disconnect(id)
{
    if(
get_user_flags(id) & VIP_LEVEL
    {
        
bUsedMenu[id] = false;
        
bHasWeapon[id] = false;
        
iJumpNum[id] = 0;
        
bDoJump[id]  =false;
    }
}

public 
MsgScoreAttrib(const MsgId, const MsgType, const MsgDest)
{
    static 
id;
    
id get_msg_arg_int(1);
    
    if((
get_user_flags(id) & VIP_LEVEL) && !get_msg_arg_int(2))
    {
        
set_msg_arg_int(2ARG_BYTE, (<< 2));
    }

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Shitty
Member
Join Date: Sep 2019
Old 01-12-2020 , 13:07   Re: [Requist] Vip-Menu
Reply With Quote #24

@Napoleon_be Thanks for your help !!
__________________
Quote:
Originally Posted by OciXCrom View Post
WhAt Is WaTeRing aNd TowErInG?!
Shitty is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-12-2020 , 15:02   Re: [Requist] Vip-Menu
Reply With Quote #25

Quote:
Originally Posted by Napoleon_be View Post
Should i do this in every loop? I mean can i also use break in the loop where i set double damage? Adjusted my code, let me know if it's alright or that there still should be some adjustments made.
Yes, if the goal of the loop is to find an element in a list. When the element is found, there's no reason to continue looping.
__________________

Last edited by OciXCrom; 01-12-2020 at 15:03.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 12:02.


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