AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Solved delete (https://forums.alliedmods.net/showthread.php?t=320753)

Shitty 01-09-2020 15:25

Re: [Requist] Vip-Menu
 
Quote:

Originally Posted by Napoleon_be (Post 2679558)
I'll take my time to start this in the weekend, i can't promise to finish this fast but i'll do my best to reduce the time as much as possible. A lot of research has to be done aswell since it's been a while i've code and tested plugins.

thanks in advance :up::up:

Napoleon_be 01-11-2020 07:42

Re: [Requist] Vip-Menu
 
1 Attachment(s)
Creating a new reply to bump the thread and make thread maker aware of updates:

I have created most of the code already, but as i already said, it needs a lot of testing. I've done some testing myself and most of the things should do the job as intented. The only thing that i think will not work properly yet is the "/vips" command. Please give me feedback on this one and tell me what it does. Couldn't test it myself.

Double damage should get tested too. Just give me all your feedback

The only include file you should need is colorchat.inc, which is attached in this reply.

TO DO:
Still need to imply the models.

PHP Code:

/* Plugin generated by AMXX-Studio */

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

#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 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");
    
    
//register_concmd("drop", "WeaponDropped");
    
    
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");
    
}

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 WeaponDropped(id)
{
    new iWeapon = get_user_weapon(id);
    
    new szPlayers[32], iNum;
    get_players(szPlayers, iNum);
    
    if(bHasWeapon[id]) {
        for(new i; i < sizeof(iWeapons); i++)
        {
            if(iWeapon != iWeapons[i])
            {
                bHasWeapon[id] = false
            }
        }
    }
}*/

public WeaponChange(id
{
    new 
iAmmoiClipiWeapon get_user_weapon(idiAmmoiClip);
    
    if(
bHasWeapon[id])
    {
        if(
iWeapon == CSW_DEAGLE)
        {
            
set_pev(idpev_viewmodel2szWeaponModels[3])
        }
        
        if(
iWeapon == iWeapons[0])
        {
            
set_pev(idpev_viewmodel2szWeaponModels[0])
        }
        
        if(
iWeapon == iWeapons[1])
        {
            
set_pev(idpev_viewmodel2szWeaponModels[1])
        }
        
        if(
iWeapon == iWeapons[2])
        {
            
set_pev(idpev_viewmodel2szWeaponModels[2])
        }
    }
}

/*public VipsOnline(id) 
{
    new szPlayers[32], iNum, szName[33];
    get_players(szPlayers, iNum);
    
    for(new i; i < iNum; i++)
    {
        if(get_user_flags(szPlayers[i]) & VIP_LEVEL)
        {
            get_user_name(szPlayers[i], szName, charsmax(szName));
        }
        ColorChat(id, GREEN, "Online Vips: %s |", szName);
    }
}*/

public VipsOnline(id) {
    new 
bool:IsFirst trueszMessage[256], iLenTempID;
    
    for(
TempID 0TempID <= get_maxplayers(); TempID++)
    {
        if( !
is_user_connected(TempID) || !(get_user_flags(id) & VIP_LEVEL) )
        {
            continue;
        }
        
        if( !
IsFirst )
        {
            
szMessage[iLen++] = ' ';
            
szMessage[iLen++] = '|';
            
szMessage[iLen++] = ' ';
        }
        
        
szMessage[iLen++] = '^x04';
        
szMessage[iLen] = EOS;
        
        
iLen += get_user_name(TempIDszMessage[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]: You took: %s"szMenuItems[item]);
    
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}

public 
PostSpawn(id
{
    if(
get_user_flags(id) & VIP_LEVEL)
    {
        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 
iWeapon get_user_weapon(id);
        
            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); 
        }
    }
    return 
HAM_HANDLED;
}
    

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

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



Shitty 01-11-2020 10:12

Re: [Requist] Vip-Menu
 
well, sorry for that but the plugin have many errors..

Errors :
1- /vips not work
2- the /vmenu have to be in CT not T
3- if i was vip and i changed my name to non-vip name the /vmenu still work and this is really problem..
4- if i was non-vip and i changed my name to vip the /vmenu not work and this is problem too.
5- the models (Example v_deadly_awp.mdl ..v_deadly_ak47.mdl ..) not working its just normal models
6- double damage not working
7- the /vmenu only work 1 time in the map idk why (i want it work only 1 time per round not map)

well, sorry for that but i can't use plugin with those errors..

Napoleon_be 01-11-2020 10:20

Re: [Requist] Vip-Menu
 
I adjusted my code above, recompile and try again. Give me a server IP where i can test this shit out and give me the "n" flag.

I told you to give me feedback, but honestly the feedback i get from you isn't the kind of feedback i need. I need detailed feedback, not something like "it doesn't work", that simply just won't do.

Also instead of just installing the plugin and trying it out, you should read what i typed above. Models should still get added and this plugin needs TESTING, TESTING and a lot of more TESTING before it works as intented.

Shitty 01-11-2020 10:22

Re: [Requist] Vip-Menu
 
I fixed the /vmenu for T now it's for CT
But other problems still exist

Napoleon_be 01-11-2020 10:27

Re: [Requist] Vip-Menu
 
Quote:

Originally Posted by Shitty (Post 2679759)
I fixed the /vmenu for T now it's for CT
But other problems still exist

Please read everything i say for god's sake... Give me the server IP you're testing this on and add me on steam.

Shitty 01-11-2020 10:30

Re: [Requist] Vip-Menu
 
1"/vips not work" i mean that when i say /vips nothing happen
2"/vmenu have to be in CT not T" i mean when i am in CT and i say /vmenu game show : vmenu for terrorists..
3"the models (Example v_deadly_awp.mdl ..v_deadly_ak47.mdl ..) not working its just normal models" i mean i said in the requist i need the weapons in /vmenu have custom models that i said "v_deadly_ak47.mdl" "v_deadly_m4a1.mdl" "v_deadly_deagle.mdl" "v_deadly_awp.mdl"
4"the /vmenu only work 1 time in the map idk why (i want it work only 1 time per round not map)" I dont know how to explain this but i will try :
example : i am vip and i just join the server and i said /vmenu and i choosed my weapon and the round end (i win or i lose doesnt matter) and in the next round i am trying to say /vmenu and choose my weapons again. nope the game shows this shit : [Vip-Menu] You can use /vmenu Only 1 time per round."


i hope u understand me now

Napoleon_be 01-11-2020 10:34

Re: [Requist] Vip-Menu
 
I updated my code again, try again and give me some feedback.

1) Models still need to be added, this is NOT DONE YET.
2) /vips needs testing, tell me what it does or just simply give me a server IP so i can test myself.
3) /vmenu should work. I have tested this before and it worked just fine for me.

Shitty 01-11-2020 10:36

Re: [Requist] Vip-Menu
 
Quote:

Originally Posted by Napoleon_be (Post 2679760)
Please read everything i say for god's sake... Give me the server IP you're testing this on and add me on steam.

add me on steam let's talk in it : Click

Napoleon_be 01-12-2020 10:05

Re: [Requist] Vip-Menu
 
Completed version of the VIP plugin. Let me know if future bugs appear and i'll fix them.

PHP Code:

/* Plugin generated by AMXX-Studio */

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

#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 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_putinserver(id
{
    if(
get_user_flags(id) & VIP_LEVEL)
    {
        
bUsedMenu[id] = false;
        
bHasWeapon[id] = false;
    }
}

public 
client_disconnect(id)
{
    if(
get_user_flags(id) & VIP_LEVEL
    {
        
bUsedMenu[id] = false;
        
bHasWeapon[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));
    }




All times are GMT -4. The time now is 18:38.

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