Raised This Month: $ Target: $400
 0% 

precache help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
darcadarca
Senior Member
Join Date: Feb 2012
Location: Romania
Old 06-02-2013 , 13:40   precache help
Reply With Quote #1

hi, i have this from khalid knife menu plugin :
Code:
new something[100]
formatex(something, charsmax(something), "models/%s.mdl", MODELS[1][V_MODEL])
copy(g_szModels[1][V_MODEL], charsmax(g_szModels[][]), something)

server_print("Something: %s", something)
precache_model(something)
everithing works fine,but if i want to change [ from models/ to models/player/ ] doesn't work
and this :
Code:
for(new i = 2; i < KNIFES_NUM + 1; i++)
{
	formatex(something, 99, "models/dArc/%s.mdl", MODELS[i][V_MODEL])
	precache_model(something)
	server_print("Something: %s", something)
	copy(g_szModels[i][V_MODEL], charsmax(g_szModels[][]), something)
}
please, i need this to precache players models more simple.. someone help ?
__________________
hqqqqqqqq

Last edited by darcadarca; 06-02-2013 at 13:45.
darcadarca is offline
Send a message via Yahoo to darcadarca
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 06-04-2013 , 06:38   Re: precache help
Reply With Quote #2

Player models don't have a V_model they just a whole model.
__________________
Blizzard_87 is offline
darcadarca
Senior Member
Join Date: Feb 2012
Location: Romania
Old 06-29-2013 , 02:37   Re: precache help
Reply With Quote #3

i know that, i mean to use this method for player models like :
Code:
{ "modelname", "modelnameT" - need T model },
{ "modelnam2", "modelname2T"  - need T model},
{ "modelname3", "" } - here no need for T model
i don't know how to make to read them ..
__________________
hqqqqqqqq
darcadarca is offline
Send a message via Yahoo to darcadarca
xDrugz
Senior Member
Join Date: Jul 2011
Location: return 4;
Old 06-29-2013 , 02:49   Re: precache help
Reply With Quote #4

Quote:
Originally Posted by darcadarca View Post
i know that, i mean to use this method for player models like :
Code:
{ "modelname", "modelnameT" - need T model },
{ "modelnam2", "modelname2T"  - need T model},
{ "modelname3", "" } - here no need for T model
i don't know how to make to read them ..
attach the whole code.
__________________
xDrugz is offline
darcadarca
Senior Member
Join Date: Feb 2012
Location: Romania
Old 06-29-2013 , 02:53   Re: precache help
Reply With Quote #5

here is , but i want just to precache them (normal model and Tmodel for player models).
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Knife menu?!"
#define VERSION "1.0"
#define AUTHOR "Khalid"

#define FLAG ADMIN_KICK

new gMenu, HasKnife[33]
#define KNIFES_NUM 4

new const MODELS[KNIFES_NUM + 1][][] = {
    { "", "", "" },
    { "Normal Knife", "v_knife", "p_knife" },   // Don't change :)
    { "Super Knife", "v_knife_guitar", "p_knife" },
    { "O.O Knife", "v_knife2", "p_knife2" },
    { "Crazy Knife", "v_knife3", "p_knife3" }
}

new g_szModels[KNIFES_NUM + 1][3][100]

enum
{
    NAME,
    V_MODEL,
    P_MODEL
}

public plugin_precache()
{
    new something[100]
    formatex(something, charsmax(something), "models/%s.mdl", MODELS[1][V_MODEL])
    copy(g_szModels[1][V_MODEL], charsmax(g_szModels[][]), something)
    
    server_print("Something: %s", something)
    precache_model(something)
    
    formatex(something, charsmax(something), "models/%s.mdl", MODELS[1][P_MODEL])
    copy(g_szModels[1][P_MODEL], charsmax(g_szModels[][]), something)
    
    server_print("Something: %s", something)
    precache_model(something)
    
    for(new i = 2; i < KNIFES_NUM + 1; i++)
    {
        formatex(something, 99, "models/knife_mod/%s.mdl", MODELS[i][V_MODEL])
        precache_model(something)
        server_print("Something: %s", something)
        copy(g_szModels[i][V_MODEL], charsmax(g_szModels[][]), something)
        
        formatex(something, 99, "models/knife_mod/%s.mdl", MODELS[i][P_MODEL])
        precache_model(something)
        server_print("Something: %s", something)
        copy(g_szModels[i][P_MODEL], charsmax(g_szModels[][]), something)
    }
}

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_clcmd("say /knife", "show_knife_menu", FLAG)
    register_event("CurWeapon", "check_model", "be")
    
    BuildMenu()
}

BuildMenu()
{
    gMenu = menu_create("Choose your knife:", "menu_handler")
    
    new szInfo[3], num = KNIFES_NUM + 1
    for(new i = 1; i < num; i++)
    {
        formatex(szInfo, charsmax(szInfo), "%d", i)
        menu_additem(gMenu, MODELS[i][NAME], szInfo)
    }
}

public show_knife_menu(id, level, cid)
{
    if(!cmd_access(id, level, cid, 2))
        return PLUGIN_HANDLED

    menu_display(id, gMenu)
    return PLUGIN_CONTINUE
}

public menu_handler(id, menu, item)
{
    new szInfo[3], callback, access
    menu_item_getinfo(menu, item, access, szInfo, charsmax(szInfo), .callback = callback)
    
    HasKnife[id] = str_to_num(szInfo)
    server_print("szInfo: %s", szInfo)
    engclient_cmd(id, "weapon_knife")
}  

public check_model(id)
{
    if(!is_user_alive(id) || !HasKnife[id])
        return;
    
    new weapon = read_data(2)
    
    if(HasKnife[id] && weapon == CSW_KNIFE && read_data(1) == 1)
    {
        set_pev(id, pev_viewmodel2,  g_szModels[HasKnife[id]][V_MODEL])
        set_pev(id, pev_weaponmodel2, g_szModels[HasKnife[id]][P_MODEL])
    }
}

public client_connect(id)
    HasKnife[id] = 0
__________________
hqqqqqqqq

Last edited by darcadarca; 06-29-2013 at 02:55. Reason: forgot something
darcadarca is offline
Send a message via Yahoo to darcadarca
Old 07-02-2013, 06:43
darcadarca
This message has been deleted by ConnorMcLeod. Reason: You need to read rules... https://forums.alliedmods.net/misc.php?do=showrules
Old 07-03-2013, 01:29
darcadarca
This message has been deleted by ConnorMcLeod. Reason: You need to read rules... https://forums.alliedmods.net/misc.php?do=showrules
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 05:30.


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