This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Fix this weapon models plugin bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JuanitoAlimana
Senior Member
Join Date: Aug 2021
Old 04-28-2022 , 16:56   Fix this weapon models plugin bug
Reply With Quote #1

So, I'm using this weapon model replacement plugin. The problem is that everytime a player has the models on and buys and uses the shield, it causes a bug where you can't see the pistol. Is there a way to solve this?

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Weapon Skins ADMIN_LEVEL_H"
#define VERSION "1.0"
#define AUTHOR "Bafak"

new const v_Model1[] = "models/wmodels/v_m4a1.mdl"
new const v_Model2[] = "models/wmodels/v_ak47.mdl"
new const v_Model3[] = "models/wmodels/v_aug.mdl"
new const v_Model4[] = "models/wmodels/v_awp.mdl"
new const v_Model5[] = "models/wmodels/v_sg552.mdl"
new const v_Model6[] = "models/wmodels/v_deagle.mdl"
new const v_Model7[] = "models/wmodels/v_knife.mdl"

new const p_Model1[] = "models/wmodels/p_ak47.mdl"
new const p_Model2[] = "models/wmodels/p_aug.mdl"
new const p_Model3[] = "models/wmodels/p_awp.mdl"
new const p_Model4[] = "models/wmodels/p_sg552.mdl"
new const p_Model5[] = "models/wmodels/p_deagle.mdl"
new const p_Model6[] = "models/wmodels/p_knife.mdl"

new onoffskinguns33 ]

public 
plugin_precache()
{
    
precache_model(v_Model1)
    
precache_model(v_Model2)
    
precache_model(v_Model3)
    
precache_model(v_Model4)
    
precache_model(v_Model5)
    
precache_model(v_Model6)
    
precache_model(v_Model7)
    
    
precache_model(p_Model1)
    
precache_model(p_Model2)
    
precache_model(p_Model3)
    
precache_model(p_Model4)
    
precache_model(p_Model5)
    
precache_model(p_Model6)
}
public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("CurWeapon" "cur_weapon" "be" "1=1")
    
    
register_clcmd"say /skins""cmd_nastaveni" )
    
register_clcmd"say_team /skins""cmd_nastaveni" )
}
public 
client_putinserver(id)
{
    
onoffskinguns[id] = 0
    set_task
(80.0,"oznamenie",id,"",0,"b")
}
public 
cur_weapon(id)
{
    if(
get_user_flags(id) & ADMIN_LEVEL_H && onoffskinguns[id])
    {
    
        if(
read_data(2) == CSW_M4A1)
        {
            
set_pev(idpev_viewmodel2v_Model1)
        }
        else if(
read_data(2) == CSW_AK47)
        {
            
set_pev(idpev_viewmodel2v_Model2)
            
set_pev(idpev_weaponmodel2p_Model1)
        }
        else if(
read_data(2) == CSW_AUG)
        {
            
set_pev(idpev_viewmodel2v_Model3)
            
set_pev(idpev_weaponmodel2p_Model2)
        }
        else if(
read_data(2) == CSW_AWP)
        {
            
set_pev(idpev_viewmodel2v_Model4)
            
set_pev(idpev_weaponmodel2p_Model3)
        }
        else if(
read_data(2) == CSW_SG552)
        {
            
set_pev(idpev_viewmodel2v_Model5)
            
set_pev(idpev_weaponmodel2p_Model4)
        }
        else if(
read_data(2) == CSW_DEAGLE)
        {
            
set_pev(idpev_viewmodel2v_Model6)
            
set_pev(idpev_weaponmodel2p_Model5)
        }
        else if(
read_data(2) == CSW_KNIFE)
        {
            
set_pev(idpev_viewmodel2v_Model7)
            
set_pev(idpev_weaponmodel2p_Model6)
        }
    }
    return 
PLUGIN_CONTINUE
}
public 
cmd_nastaveni(id)
{
    if( 
get_user_flags(id) & ADMIN_LEVEL_H)
    {
        static 
item[64]
        
        
formatex(itemcharsmax(item), "\rSkins Menu")
        new 
menu menu_create(item"nastaveni_handler")
        
        if(
onoffskinguns[id])
        {
            
formatex(itemcharsmax(item), "\yTurn On")
            
menu_additem(menuitem"1"0)
        }
        else
        {
            
formatex(itemcharsmax(item), "\rTurn Off")
            
menu_additem(menuitem"1"0)
        }
        
menu_addblank(menu0)
        
        
formatex(itemcharsmax(item), "Exit")
        
menu_additem(menuitem"2"0)
        
        
menu_setprop(menuMPROP_EXITMEXIT_NEVER)
        
menu_setprop(menuMPROP_NUMBER_COLOR"\r" )
        
menu_display(idmenu0)
    }
    else
    {
        
ChatColor(id"!gMessage !y: You dont have any acess for this command.")
    }
    return 
PLUGIN_CONTINUE
}
public 
nastaveni_handler(idmenuitem)
{
    new 
data[6], iName[64]
    new 
accesscallback
    menu_item_getinfo
(menuitemaccessdata,5iName63callback)
    
    new 
key str_to_num(data)
    
    switch(
key)
    {
        case 
1:
        {
            if(!(
get_user_flags(id) & ADMIN_LEVEL_H))
            {
                return 
PLUGIN_HANDLED
            
}
            if(
onoffskinguns[id])
            {
                
onoffskinguns[id] = 0
            
}
            else
            {
                
onoffskinguns[id] = 1
            
}
            
cmd_nastaveni(id)
        }
        case 
2:
        {
        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED
}
public 
oznamenie(id)
{
    if( 
get_user_flags(id) & ADMIN_LEVEL_H)
    {
        
ChatColor(id"!gMessage !y: Special skins - !g/skins")
    }
    else
    {
        
ChatColor(id"!gMessage !y: ...Message...")
    }
}
stock ChatColor(const id, const input[], any:...)
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4"// Green Color
    
replace_all(msg190"!y""^1"// Default Color
    
replace_all(msg190"!team""^3"// Team Color
    
replace_all(msg190"!team2""^0"// Team2 Color
    
    
if (idplayers[0] = id; else get_players(playerscount"ch")
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }

JuanitoAlimana is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 04-28-2022 , 20:01   Re: Fix this weapon models plugin bug
Reply With Quote #2

Try this one: https://forums.alliedmods.net/showpo...1&postcount=16
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache is offline
JuanitoAlimana
Senior Member
Join Date: Aug 2021
Old 04-28-2022 , 21:12   Re: Fix this weapon models plugin bug
Reply With Quote #3

Quote:
Originally Posted by Supremache View Post
Nope, still gets bugged when you change from knife to shield. The shields turns invisible and the pistol changes sides. Also, you can't turn off or on the models (some players like to use the default models).

Last edited by JuanitoAlimana; 04-28-2022 at 22:45.
JuanitoAlimana is offline
Reply



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:23.


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