Raised This Month: $ Target: $400
 0% 

How to set P_model Sequences?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AGoodGuy
Member
Join Date: Sep 2014
Old 11-28-2014 , 06:17   How to set P_model Sequences?
Reply With Quote #1

Hi every one, i am making sub model for my weapons mod, but i have some mistake with p_model when change to sub model, Sequences of this is not change, so please help my the way to change Sequences of p_model, thank so much.

I try with set_pev(id, pev_sequence, 1) but not happen!


This is my code and model:

PHP Code:
register_event("WeapPickup","checkModel","b","1=19")

public 
checkModel(id)
{
    if ( !
g_has_ak47red[id] || !is_user_alive(id) )
    return 
PLUGIN_CONTINUE;
    
    new 
szWeapID read_data(2)
    
    if ( 
szWeapID == CSW_AK47 && g_has_ak47red[id] == true )
    {
        
set_pev(idpev_viewmodel2ak47red_V_MODEL)
        
        
set_pev(idpev_body1//Change to submodel
        
set_pev(idpev_weaponmodel2ak47red_P_MODEL)

        
//So how to set Sequences of p_model?
    
}
    return 
PLUGIN_HANDLED

Attached Files
File Type: zip p_sub.zip (69.4 KB, 110 views)
__________________
Without Passion Life Is Nothing

Quote:
“If you can't fly then run, if you can't run then walk, if you can't walk then crawl, but whatever you do, you have to keep moving forward.”― Martin Luther King Jr.

Last edited by AGoodGuy; 11-28-2014 at 06:18.
AGoodGuy is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 11-28-2014 , 10:28   Re: How to set P_model Sequences?
Reply With Quote #2

A better way to do this is to make a new entity following player with p_model as model. That way, you can change any value without problems.
BTW, you are changing player's submodel and sequence.;)
RateX is offline
AGoodGuy
Member
Join Date: Sep 2014
Old 11-28-2014 , 11:34   Re: How to set P_model Sequences?
Reply With Quote #3

Quote:
Originally Posted by RateX View Post
A better way to do this is to make a new entity following player with p_model as model. That way, you can change any value without problems.
BTW, you are changing player's submodel and sequence.;)
Yes, but how to change sequence of p_model?, can you help me?
__________________
Without Passion Life Is Nothing

Quote:
“If you can't fly then run, if you can't run then walk, if you can't walk then crawl, but whatever you do, you have to keep moving forward.”― Martin Luther King Jr.
AGoodGuy is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 11-29-2014 , 02:12   Re: How to set P_model Sequences?
Reply With Quote #4

With your way, you can't since there's no proper way to find p_model's entity. So do as I said and everything will be much easier.
RateX is offline
AGoodGuy
Member
Join Date: Sep 2014
Old 11-29-2014 , 02:28   Re: How to set P_model Sequences?
Reply With Quote #5

Yes, easy, but i'm begginer, i don't understand, i have 2 method to change model, and if can, please help me to change sequence. Thanks.

Use ham but not happen
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Weapon change model"
#define VERSION "1.0"
#define AUTHOR "ils"


new ak47red_P_MODEL[64] = "models/p_sub.mdl"

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Item_Deploy"weapon_ak47""HamF_Item_Deploy_Post",1)
}

public 
plugin_precache()
{
    
precache_model(ak47red_P_MODEL)
}

public 
HamF_Item_Deploy_Postentity )
{
    
    const 
m_pPlayer 41;
    
    static 
id
    
    id 
get_pdata_cbase(entitym_pPlayer4)
    

        
    
set_pev(idpev_weaponmodel2ak47red_P_MODEL);
    
set_pev(entitypev_sequence,1)


Use fakemeta but not happen
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Weapon change model"
#define VERSION "1.0"
#define AUTHOR "ils"


new ak47red_P_MODEL[64] = "models/p_sub.mdl"

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("CurWeapon","checkWeapon","be","1=1")
}

public 
plugin_precache()
{
    
precache_model(ak47red_P_MODEL)
}


public 
checkWeapon(id)
{
        
    new 
plrClipplrAmmo
    
new plrWeapId
    
    plrWeapId 
get_user_weapon(idplrClip plrAmmo)
    
    if (
plrWeapId == CSW_AK47)
    {
        
checkModel(id)
    }
    else 
    {
        return 
PLUGIN_CONTINUE
    
}

    return 
PLUGIN_HANDLED
}

public 
checkModel(id)
{
    if ( !
is_user_alive(id) )
    return 
PLUGIN_CONTINUE;
    
    new 
szWeapID read_data(2)
    
    if ( 
szWeapID == CSW_AK47 )
    {
        
        
        new 
iWpn=get_pdata_cbase(id3734//hamsandwich
        
set_pev(iWpnpev_sequence,1)
        
        
set_pev(idpev_weaponmodel2ak47red_P_MODEL)
        
        

        
        
        
    }
    return 
PLUGIN_HANDLED

__________________
Without Passion Life Is Nothing

Quote:
“If you can't fly then run, if you can't run then walk, if you can't walk then crawl, but whatever you do, you have to keep moving forward.”― Martin Luther King Jr.

Last edited by AGoodGuy; 11-29-2014 at 02:31.
AGoodGuy is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 11-29-2014 , 05:52   Re: How to set P_model Sequences?
Reply With Quote #6

Which part of "there's no proper way to find p_model's entity" didn't you understand? What you are doing is getting weapon entity, not p_model entity.
In HamF_Item_Deploy_Post do something like:
PHP Code:
        set_pev(idpev_weaponmodel2""// Hide your p_model
        
if (!pev_valid(g_ent_weaponmodel[id]))
    {
        
g_ent_weaponmodel[id] = engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target")) // Create your p_model entity
        
if (!pev_valid(g_ent_weaponmodel[id])) return;
        
        
set_pev(g_ent_weaponmodel[id], pev_classname"weapon_model")
        
set_pev(g_ent_weaponmodel[id], pev_movetypeMOVETYPE_FOLLOW)
        
set_pev(g_ent_weaponmodel[id], pev_aimentid)
        
set_pev(g_ent_weaponmodel[id], pev_ownerid)
    }
    
engfunc(EngFunc_SetModelg_ent_weaponmodel[id], ak47red_P_MODEL
Then you can set sequence, sub model or whatever you want.

Last edited by RateX; 11-29-2014 at 05:52.
RateX is offline
AGoodGuy
Member
Join Date: Sep 2014
Old 11-29-2014 , 09:04   Re: How to set P_model Sequences?
Reply With Quote #7

Thanks for your support, because i'm beginer so i can't understand what you said, sorry.
__________________
Without Passion Life Is Nothing

Quote:
“If you can't fly then run, if you can't run then walk, if you can't walk then crawl, but whatever you do, you have to keep moving forward.”― Martin Luther King Jr.
AGoodGuy 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 05:38.


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