Raised This Month: $ Target: $400
 0% 

Hide Weapons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Newplayer12
Junior Member
Join Date: Dec 2022
Old 12-29-2022 , 07:46   Hide Weapons
Reply With Quote #1

Hello everyone

I need a Plugin to hide weapons ( Make Weapons invisible )
For example: If player says /hide will make his/her weapons invisible and if say /unhide will make his/her weapons visible again
I searched on Internet but couldn't find any
Newplayer12 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 12-29-2022 , 21:09   Re: Hide Weapons
Reply With Quote #2

you can hide the models by setting set_pev(player, pev_viewmodel, 0); and set_pev(player, pev_weaponmodel, 0);
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Newplayer12
Junior Member
Join Date: Dec 2022
Old 12-30-2022 , 13:48   Re: Hide Weapons
Reply With Quote #3

Hey Thanks but it's not working
Here's the code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new his_weapons[33]

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)

register_clcmd( "say /menu", "menuInvisDisplay" );
register_clcmd("say_team /menu", "menuInvisDisplay");

register_menucmd( register_menuid( "" ), ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9 ) , "MenuInvis" );

// Add your code here...
}

public menuInvisDisplay(id ){

static menu[ 512 ];

new len = 0;

//**MENU TITLE**
len += format (menu[len], sizeof menu - len, "\rHide Weapon^n^n")

len += format( menu[len], sizeof menu - len, "\y1. \wWeapons: %s^n", his_weapons[id] ? "\yON" : "\rOFF");

len += format( menu[len], sizeof menu - len, "\y0. \wExit" );

show_menu( id, ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9 ), menu, -1 );

return PLUGIN_HANDLED;
}
public MenuInvis( key, id )
{
switch( key )
{
case 0:
{
hide_weapon(id)
menuInvisDisplay( id );
}
default:
{
show_menu( id, 0, "" );
}
}
}

public hide_weapon(id)
{
switch(his_weapons[id])
{
case 0:
{
his_weapons[id] = 1
set_pev(id, pev_viewmodel, 0);
set_pev(id, pev_weaponmodel, 0);
}
case 1:
{
his_weapons[id] = 0
set_pev(id, pev_viewmodel, 1);
set_pev(id, pev_weaponmodel, 1);
}
}
}
Newplayer12 is offline
shayan123
BANNED
Join Date: Oct 2020
Location: GB
Old 01-13-2023 , 11:44   Re: Hide Weapons
Reply With Quote #4

Quote:
#include <amxmodx>
#include <fakemeta>

new bool:g_bHidden[33];

public plugin_init() {
register_plugin("Hide Weapons", "1.0", "Author");

register_clcmd("say /hide", "cmd_hide");
register_clcmd("say /unhide", "cmd_unhide");
register_forward(FM_SetModel, "fw_setmodel");
}

public cmd_hide(id) {
g_bHidden[id] = true;
client_print(id, print_chat, "Your weapons are now hidden.");
}

public cmd_unhide(id) {
g_bHidden[id] = false;
client_print(id, print_chat, "Your weapons are now visible.");
}

public fw_setmodel(ent, model[]) {
if(pev(ent, pev_owner) && g_bHidden[pev(ent, pev_owner)]) {
set_pev(ent, pev_model, "");
set_pev(ent, pev_rendermode, kRenderTransAlpha);
set_pev(ent, pev_renderamt, 0);
set_pev(ent, pev_renderfx, kRenderFxNone);
}
return FMRES_IGNORED;
}
This plugin uses the register_clcmd() function to register the chat commands "/hide" and "/unhide", which call the "cmd_hide" and "cmd_unhide" functions respectively. These functions set a global variable, g_bHidden, to true or false depending on whether the player wants to hide or unhide their weapons.

The plugin also uses the register_forward() function to register a forward for the FM_SetModel event. This forward is called every time a weapon model is set, and it checks if the player has hidden their weapons. If the player has hidden their weapons, the forward sets the weapon's model to an empty string, and sets the weapon's rendermode, renderamt, and renderfx to values that make the weapon invisible.

Please note that this is an example and you may need to modify the code to suit your needs, also, this plugin will hide the weapons and the player can still use them.

Also, please note that this plugin is not tested and it may not work as expected, you may need to test it and make any necessary adjustments.
shayan123 is offline
Send a message via ICQ to shayan123 Send a message via AIM to shayan123 Send a message via Yahoo to shayan123 Send a message via Skype™ to shayan123
Newplayer12
Junior Member
Join Date: Dec 2022
Old 01-17-2023 , 02:27   Re: Hide Weapons
Reply With Quote #5

Thanks shayan123, i really appreciate your help i will try, yeah i only wanted to hide weapon player should be able to use it
Newplayer12 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 20:04.


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