AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Knife Models [XP System & Skills Support] (https://forums.alliedmods.net/showthread.php?t=293632)

OciXCrom 12-23-2018 08:36

Re: Knife Models [XP System Support]
 
Yes and yes.
What's the point of having a p_ model if nobody else can see it? The p_ model is for other players to see - you can't see it yourself.

C00LSH33P 12-23-2018 17:30

Re: Knife Models [XP System Support]
 
Quote:

Originally Posted by OciXCrom (Post 2630645)
Yes and yes.
What's the point of having a p_ model if nobody else can see it? The p_ model is for other players to see - you can't see it yourself.

Alright thanks.
I thought maybe it's only visual change for individual player that using it for some reason. Like, only the applied player sees the changes but the other players still see default models on their part. :stupid: :oops:

Mr Misw 12-24-2018 10:41

Re: Knife Models
 
Quote:

Originally Posted by OciXCrom (Post 2509804)
It's much work, I don't fell like doing it. I made a transformation of this plugin that you can use for other weapons. Here's the code:

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <formatin>

#define PLUGIN_VERSION "1.4"
#define MAX_SKINS 30

enum _:Info
{
    
Name[32],
    
VModel[128],
    
PModel[128],
    
Flag
}

enum _:Weapon
{
    
Name[16],
    
NameLower[16],
    
weapon_id[20],
    
CSW_ID
}

new 
g_eSkins[MAX_SKINS][Info]
new 
g_eWeapon[Weapon]
new 
g_eSkinsNum
new g_iSkin[33]
new 
g_szDefaultV[32]
new 
g_szDefaultP[32]
new 
g_iSayText

public plugin_init()
{    
    
register_plugin(formatin("%s Models"g_eWeapon[Name]), PLUGIN_VERSION"OciXCrom")
    
register_cvar("CRXWeaponModels"PLUGIN_VERSIONFCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
    
register_event("CurWeapon""OnSelectWeapon""be""1=1"formatin("2=%i"g_eWeapon[CSW_ID]))
    
    
register_clcmd(formatin("say /%s"g_eWeapon[NameLower]), "ShowMenu")
    
register_clcmd(formatin("say_team /%s"g_eWeapon[NameLower]), "ShowMenu")
    
    
g_iSayText get_user_msgid("SayText")
}

public 
plugin_precache()
{
    new 
szWeapon[32]
    
get_plugin(-1szWeaponcharsmax(szWeapon))
    
replace(szWeaponcharsmax(szWeapon), "crx_""")
    
replace(szWeaponcharsmax(szWeapon), "_models.amxx""")
    
    
copy(g_eWeapon[Name], charsmax(g_eWeapon[Name]), szWeapon)
    
strtolower(szWeapon)
    
copy(g_eWeapon[NameLower], charsmax(g_eWeapon[NameLower]), szWeapon)
    
formatex(g_eWeapon[weapon_id], charsmax(g_eWeapon[weapon_id]), "weapon_%s"szWeapon)
    
g_eWeapon[CSW_ID] = get_weaponid(g_eWeapon[weapon_id])
    
    
register_dictionary("WeaponModels.txt")
    
    if(!
g_eWeapon[CSW_ID])
        
set_fail_state(formatin("%L"LANG_SERVER"WM_INVALID_WEAPON"g_eWeapon[weapon_id]))
        
    
formatex(g_szDefaultVcharsmax(g_szDefaultV), "models/v_%s.mdl"g_eWeapon[NameLower])
    
formatex(g_szDefaultPcharsmax(g_szDefaultP), "models/p_%s.mdl"g_eWeapon[NameLower])
        
    
/*log_amx("Name: %s", g_eWeapon[Name])
    log_amx("NameLower: %s", g_eWeapon[NameLower])
    log_amx("weapon_id: %s", g_eWeapon[weapon_id])
    log_amx("CSW_ID: %i", g_eWeapon[CSW_ID])*/
    
    
ReadFile()
}

ReadFile()
{
    new 
szConfigsName[256], szFilename[256]
    
get_configsdir(szConfigsNamecharsmax(szConfigsName))
    
formatex(szFilenamecharsmax(szFilename), "%s/%sModels.ini"szConfigsNameg_eWeapon[Name])
    new 
iFilePointer fopen(szFilename"rt")
    
    if(
iFilePointer)
    {
        new 
szData[300], szFlag[2]
        
        while(!
feof(iFilePointer))
        {
            
fgets(iFilePointerszDatacharsmax(szData))
            
trim(szData)
            
            switch(
szData[0])
            {
                case 
EOS';': continue
                default:
                {
                    
parse(szData,     g_eSkins[g_eSkinsNum][Name], charsmax(g_eSkins[][Name]),    g_eSkins[g_eSkinsNum][VModel], charsmax(g_eSkins[][VModel]),
                    
g_eSkins[g_eSkinsNum][PModel], charsmax(g_eSkins[][PModel]), szFlagcharsmax(szFlag))
                    
                    if(!
is_blank(g_eSkins[g_eSkinsNum][VModel]))
                        
precache_model(g_eSkins[g_eSkinsNum][VModel])
                        
                    if(!
is_blank(g_eSkins[g_eSkinsNum][PModel]))
                        
precache_model(g_eSkins[g_eSkinsNum][PModel])
                        
                    
g_eSkins[g_eSkinsNum][Flag] = is_blank(szFlag) ? ADMIN_ALL read_flags(szFlag)
                        
                    
szFlag[0] = EOS
                    g_eSkinsNum
++
                }
            }
        }
        
        
fclose(iFilePointer)
    }
}

public 
ShowMenu(id)
{
    new 
szTitle[128]
    
formatex(szTitlecharsmax(szTitle), "%L"id"WM_MENU_TITLE"g_eWeapon[Name])
    
    new 
iMenu menu_create(szTitle"MenuHandler")
    
    for(new 
iFlags get_user_flags(id), ig_eSkinsNumi++)
    {
        if(
g_eSkins[i][Flag] == ADMIN_ALL || iFlags g_eSkins[i][Flag])
            
menu_additem(iMenuformatin("%s %s"g_eSkins[i][Name], g_iSkin[id] == formatin("%L"id"WM_MENU_SELECTED") : formatin("")))
        else
            
menu_additem(iMenuformatin("%s %L"g_eSkins[i][Name], id"WM_MENU_VIP_ONLY"), .paccess g_eSkins[i][Flag])
    }
    
    if(
menu_pages(iMenu) > 1)
        
menu_setprop(iMenuMPROP_TITLEformatin("%s%L"szTitleid"WM_MENU_TITLE_PAGE"))
        
    
menu_display(idiMenu)
    return 
PLUGIN_HANDLED
}

public 
MenuHandler(idiMenuiItem)
{
    if(
iItem != MENU_EXIT)
    {
        if(
g_iSkin[id] == iItem)
            
ColorChat(id"%L"id"WM_CHAT_ALREADY")
        else
        {
            
g_iSkin[id] = iItem
            
            
if(is_user_alive(id) && get_user_weapon(id) == g_eWeapon[CSW_ID])
                
OnSelectWeapon(id)
            
            
ColorChat(id"%L"id"WM_CHAT_SELECTED"g_eSkins[iItem][Name])
        }
    }
    
    
menu_destroy(iMenu)
    return 
PLUGIN_HANDLED
}

public 
client_putinserver(id)
    
g_iSkin[id] = 0

public OnSelectWeapon(id)
{
    if(
is_blank(g_eSkins[g_iSkin[id]][VModel]))
        
set_pev(idpev_viewmodel2g_szDefaultV)
    else 
set_pev(idpev_viewmodel2g_eSkins[g_iSkin[id]][VModel])
    
    if(
is_blank(g_eSkins[g_iSkin[id]][PModel]))
        
set_pev(idpev_weaponmodel2g_szDefaultP)
    else 
set_pev(idpev_weaponmodel2g_eSkins[g_iSkin[id]][PModel])
}

bool:is_blank(szString[])
    return 
szString[0] == EOS
    
ColorChat
(const id, const szInput[], any:...)
{
    new 
iPlayers[32], iCount 1
    
static szMessage[191]
    
vformat(szMessagecharsmax(szMessage), szInput3)
    
format(szMessage[0], charsmax(szMessage), "%L %s"id id LANG_PLAYER"WM_CHAT_PREFIX"g_eWeapon[Name], szMessage)
    
    
replace_all(szMessagecharsmax(szMessage), "!g""^4")
    
replace_all(szMessagecharsmax(szMessage), "!n""^1")
    
replace_all(szMessagecharsmax(szMessage), "!t""^3")
    
    if(
id)
        
iPlayers[0] = id
    
else
        
get_players(iPlayersiCount"ch")
    
    for(new 
iiCounti++)
    {
        if(
is_user_connected(iPlayers[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEg_iSayText_iPlayers[i])
            
write_byte(iPlayers[i])
            
write_string(szMessage)
            
message_end()
        }
    }


The plugin needs to be named crx_<WEAPON NAME HERE>_models.amxx. So, if you want models for ak47, you will name the plugin crx_AK47_models.amxx. The command will be /ak47 and the config file configs/AK47Models.ini. Inside it you can add models like this:

PHP Code:

"Cool AK47" "v_model.mdl" "p_model.mdl" "flag" 

Also, the lang file located in data/lang/WeaponModels.txt:

PHP Code:

[en]
WM_CHAT_PREFIX = !g[%s Models]!n
WM_CHAT_ALREADY 
This skin is already selected!
WM_CHAT_SELECTED You have selected the skin !g%s
WM_MENU_TITLE 
= \y< \rChoose your %s model \y>
WM_MENU_TITLE_PAGE = ^n\r-- \yPage:\r
WM_MENU_SELECTED 
= \y~ \rSELECTED \y~
WM_MENU_VIP_ONLY = \y~ \rVIP \y~
WM_INVALID_WEAPON Invalid weapon ^"%s^"

[mk]
WM_CHAT_PREFIX = !g[%s Models]!n
WM_CHAT_ALREADY 
Ovoj skin vekje e izbran!
WM_CHAT_SELECTED Go izbra skinot !g%s
WM_MENU_TITLE 
= \y< \rIzberi model za %\y>
WM_MENU_TITLE_PAGE = ^n\r-- \yStranica:\r
WM_MENU_SELECTED 
= \y~ \rIZBRAN \y~
WM_MENU_VIP_ONLY = \y~ \rVIP \y~
WM_INVALID_WEAPON Nevalidno oruzhje ^"%s^"

[bg]
WM_CHAT_PREFIX = !g[%s Models]!n
WM_CHAT_ALREADY 
Tozi skin veche e izbran!
WM_CHAT_SELECTED Izbra skina !g%s
WM_MENU_TITLE 
= \y< \rIzberi model za %\y>
WM_MENU_TITLE_PAGE = ^n\r-- \yStranica:\r
WM_MENU_SELECTED 
= \y~ \rIZBRAN \y~
WM_MENU_VIP_ONLY = \y~ \rVIP \y~
WM_INVALID_WEAPON Nevalidno orujie ^"%s^" 

If you want another weapon, copy the plugin + the .ini file and change its name, for example crx_M4A1_models.amxx and M4A1Models.ini.

Can You Provide #include <formatin> !! I cant find that include file ..

OciXCrom 12-25-2018 09:12

Re: Knife Models [XP System Support]
 
https://www.amxx-bg.info/inc/

Mr Misw 12-26-2018 01:26

Re: Knife Models [XP System Support]
 
Dude ... That Include contain this
Code:

‹      S]o›0}ƿy‘"šU4M
iS-I;MU…(\K`#0>C I&!aŽ9FœA‚Œ L d#EEœ        &H(jE#dt`!‡/M?Ҵ:•3Yp9_Q SO!Ce™by”\
‘X˜Xˆeܾ˜tK_VXŠJ™<>M /ŽŒ‰–”‰ͥ񼶧}9W#X83˜ΐ0‰uHrs\J^8[~*+iTVy,7CZw='p;3\^-*o *_…@Y uŽux‘y2$c̲qŸ<q—TKiš
R„BrX”K]Z{Bn8ki-Bm-=I‚JTu)2mwd$žk]:P““0*WϿkpMԝ}k";Ÿu“a\ƒX&폥žs‚Hiq,‚g6;k(׿tv‰

And Its Not Working Also

OciXCrom 12-26-2018 06:31

Re: Knife Models [XP System Support]
 
There's some glitch with the site going on. Select 2 or more files at once and download them like that.

Mr Misw 12-27-2018 01:38

Re: Knife Models [XP System Support]
 
Thanks !!

Titus 12-29-2018 23:33

Re: Knife Models [XP System Support]
 
Hi mate sorry if i ask a dump question i used your plugin works perfect but only me can see the skin other players coudlnt .. only if you are on spec you can see other skins i try search everywhere this i found : mp_consistency 0 i used this command too but doesnt seems to work... i use the plugin from your first post. i dunno if is upgraded just today i put it.

OciXCrom 12-30-2018 17:05

Re: Knife Models [XP System Support]
 
Did you put p_ models for your knife skins or just v_?

Titus 12-30-2018 19:57

Re: Knife Models [XP System Support]
 
*resolved


All times are GMT -4. The time now is 07:37.

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