AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Dummy Sequence (https://forums.alliedmods.net/showthread.php?t=192899)

darktemplar 08-15-2012 05:06

[HELP] Dummy Sequence
 
Hi everybody ,
Could anyone help me solve a problem ? :D . That is : I return HAM_SUPERCEDE in the HAM_Item_Deploy .And I realize that the player sequence change to dummy sequence (I want to block p_ and v_ model, so, I block the Ham_Item_Deploy) . Are there any solutions for this problem ?
:D

Thank you ,

Arkshine 08-15-2012 05:17

Re: [HELP] Dummy Sequence
 
If you block the deploy sequence of the model, you have to send a new one, with SVC_WEAPONANIM.

darktemplar 08-15-2012 05:30

Re: [HELP] Dummy Sequence
 
I mean the sequence of player, not weapon :)

Arkshine 08-15-2012 05:42

Re: [HELP] Dummy Sequence
 
Ah, yes, sorry. Explain what you want REALLY to do.

darktemplar 08-15-2012 05:54

Re: [HELP] Dummy Sequence
 
Ah, I unprecache p_ and v_ model, and block the Ham_Item_Deploy , because if I dont block, game will kick me out . Because blocking Ham_Item_Deploy , the player model play the dummy sequence. (If I hold a M4A1, it play sequence holding m4A1, but now, it play dummy sequence)

Arkshine 08-15-2012 06:15

Re: [HELP] Dummy Sequence
 
You don't explain clearly, it's just blocking deploy or you replace by another model too ? Explain the purpose. Depending the context on what you [want] to do really, you can do several things.

darktemplar 08-15-2012 06:30

Re: [HELP] Dummy Sequence
 
PHP Code:


/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cswpn_ultilities>
#include <fakemeta>
#include <celltrie>
#include <hamsandwich>
#include <cstrike>
#include <cstrike_pdatas>
#include <g4u_wpn>

#define PLUGIN "Block Default Model"
#define VERSION "1.0"
#define AUTHOR "Nguyen Duy Linh"

stock DEFAULT_WPN_MODEL[][] =
{
    
"REDPLANE-DARKTEMPLAR",
    
"p228.mdl",
    
"DARKTEMPLAR-REDPLANE",
    
"scout.mdl",
    
"hegrenade.mdl",
    
"xm1014.mdl",
    
"c4.mdl",
    
"mac10.mdl",
    
"aug.mdl",
    
"smokegrenade.mdl",
    
"elite.mdl",
    
"fiveseven.mdl",
    
"ump45.mdl",
    
"sg550.mdl",
    
"galil.mdl",
    
"famas.mdl",
    
"usp.mdl",
    
"glock18.mdl",
    
"awp.mdl",
    
"mp5.mdl",
    
"m249.mdl",
    
"m3.mdl",
    
"m4a1.mdl",
    
"tmp.mdl",
    
"g3sg1.mdl",
    
"flashbang.mdl",
    
"deagle.mdl",
    
"sg552.mdl",
    
"ak47.mdl",
    
"knife.mdl" ,
    
"p90.mdl"
}

stock DEFAULT_WPN_DRAW_ANIM[] =
{
    -
1,
    
6,
    -
1,
    
4,
    
3,
    
6,
    
1,
    
2,
    
2,
    
3,
    
15,
    
5,
    
2,
    
4,
    
2,
    
2,
    
14,
    
8,
    
5,
    
2,
    
4,
    
6,
    
12,
    
2,
    
4,
    
3,
    
5,
    
2,
    
2,
    
,
    
2
}

#define PRIMARY_WEAPONS (1<<CSW_SCOUT | 1<<CSW_MAC10 | 1<<CSW_AUG | 1<<CSW_UMP45 | 1<<CSW_SG550 | 1<<CSW_GALIL | 1<<CSW_FAMAS | 1<<CSW_AWP | 1<<CSW_MP5NAVY | 1<<CSW_M249 | 1<<CSW_M4A1 | 1<<CSW_TMP | 1<<CSW_G3SG1 | 1<<CSW_SG552 | 1<<CSW_AK47 | 1<<CSW_P90)
#define SECONDARY_WEAPONS (1<<CSW_DEAGLE | 1<<CSW_USP | 1<< CSW_GLOCK18 | 1<<CSW_P228 | 1<<CSW_ELITE | 1<<CSW_FIVESEVEN)
#define SHOTGUNS (1<<CSW_M3 | 1<<CSW_XM1014)
#define HEGRENADE (1<<CSW_HEGRENADE)
#define SMOKEGRENADE (1<<CSW_SMOKEGRENADE)
#define FLASHBANG (1<<CSW_FLASHBANG)
#define IsRifle(%1)      (PRIMARY_WEAPONS & (1<<%1))
#define IsPistol(%1)        (SECONDARY_WEAPONS & (1<<%1))
#define IsShotgun(%1)        (SHOTGUNS & (1<<%1))
#define IsHegrenade(%1)    (HEGRENADE & (1<<%1))
#define IsSmokegrenade(%1) (SMOKEGRENADE & (1<<%1))
#define IsFlashBang(%1)    (FLASHBANG & (1<<%1))


new Trie:iRegisteredModel

const m_szAnimExtention        =    492
public plugin_precache()
{
    
iRegisteredModel TrieCreate()
    
    for (new 
0sizeof DEFAULT_WPN_MODELi++)
    {
        if (
CSW_P228 || CSW_P90 || == 2)
            continue
            
        new 
szFullModel[128]
        
        
//    Register Player Model
        
formatex(szFullModelsizeof szFullModel 1"models/p_%s"DEFAULT_WPN_MODEL[i])
        
TrieSetCell(iRegisteredModelszFullModel1)
    }
    
    
register_forward(FM_PrecacheModel"fw_PrecacheModelPre")
    
}

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

public 
fw_PrecacheModelPre(szModel[])
{
    if (
TrieKeyExists(iRegisteredModelszModel))
    {
        
forward_return(FMV_CELL0)
        return 
FMRES_SUPERCEDE
    
}
        
    return 
FMRES_IGNORED
}

public 
Event_CurWeapon(id)
{
    new 
iWeaponId read_data(2)
    
    new 
iCanUpdateModel 1
    
    
if (IsPistol(iWeaponId))
    {
        if (
g4u_user_has_pistol(id) > -1)
            
iCanUpdateModel 0
    
}
    else if (
IsShotgun(iWeaponId))
    {
        if (
g4u_user_has_shotgun(id) > -1)
            
iCanUpdateModel 0
    
}
    else if (
IsRifle(iWeaponId))
    {
        if (
g4u_user_has_riffle(id) > -1)
            
iCanUpdateModel 0
    
}
    
    if (
iWeaponId == CSW_HEGRENADE)
    {
        if (
g4u_get_user_hegrenade(id) > -1)
            
iCanUpdateModel 0
    
}
    
    if (
iWeaponId == CSW_SMOKEGRENADE)
    {
        if (
g4u_user_has_smokegrenade(id) > -1)
            
iCanUpdateModel 0
    
}
    
    if (
iWeaponId == CSW_KNIFE)
        
iCanUpdateModel 0
        
    
if (iCanUpdateModel)
    {
        new 
szViewModel[128]
        
formatex(szViewModelsizeof szViewModel 1"models/v_%s"DEFAULT_WPN_MODEL[iWeaponId])
        
set_pev(idpev_viewmodel2szViewModel)
        
    }
}

public 
csred_WpnDeploy_Pre(idiEntiWeaponId)
{
    
    if (!
is_user_connected(id))
        return 
PLUGIN_HANDLED
        
        
    
return PLUGIN_HANDLED
}

public 
csred_WpnDeploy_Post(idiEntiWeaponId)
{
    if (!
is_user_connected(id))
        return 
PLUGIN_HANDLED
        
    
new iCanUpdateModel 1
    
    
if (IsPistol(iWeaponId))
    {
        if (
g4u_user_has_pistol(id) > -1)
            
iCanUpdateModel 0
    
}
    else if (
IsShotgun(iWeaponId))
    {
        if (
g4u_user_has_shotgun(id) > -1)
            
iCanUpdateModel 0
    
}
    else if (
IsRifle(iWeaponId))
    {
        if (
g4u_user_has_riffle(id) > -1)
            
iCanUpdateModel 0
    
}
    
    if (
iWeaponId == CSW_HEGRENADE)
    {
        if (
g4u_get_user_hegrenade(id) > -1)
            
iCanUpdateModel 0
    
}
    
    if (
iWeaponId == CSW_SMOKEGRENADE)
    {
        if (
g4u_user_has_smokegrenade(id) > -1)
            
iCanUpdateModel 0
    
}
        
    if (
iCanUpdateModel)
    {
        new 
szViewModel[128]
        
formatex(szViewModelsizeof szViewModel 1"models/v_%s"DEFAULT_WPN_MODEL[iWeaponId])
        
set_pev(idpev_viewmodel2szViewModel)
        
        new 
iLastItemId get_pdata_cbase(idm_pLastItem5)
        
        if (
iLastItemId && pev_valid(iLastItemId))
            
set_pev(iLastItemIdpev_effectspev(iLastItemIdpev_effects) | EF_NODRAW)
            
        
set_pdata_cbase(idm_pActiveItemiEnt5)
        
        
set_pdata_float(idm_flNextAttack0.75)
        
set_pdata_float(iEntm_flNextPrimaryAttack0.75)
        
set_pdata_float(iEntm_flNextSecondaryAttack0.75)
        
set_pdata_float(iEntm_flTimeWeaponIdle1.0)
        
        new 
iDecResult ExecuteHamB(Ham_Weapon_UseDecrementiEnt)
        
        if (
iWeaponId == CSW_M4A1)
        {
            if (!
cs_get_weapon_silen(iEnt))
                
play_weapon_anim(iEntDEFAULT_WPN_DRAW_ANIM[iWeaponId], iDecResult0)
            else    
play_weapon_anim(iEntDEFAULT_WPN_DRAW_ANIM[iWeaponId] - 7iDecResult0)
        }
        else if (
iWeaponId == CSW_USP)
        {
            if (!
cs_get_weapon_silen(iEnt))
                
play_weapon_anim(iEntDEFAULT_WPN_DRAW_ANIM[iWeaponId], iDecResult0)
            else    
play_weapon_anim(iEntDEFAULT_WPN_DRAW_ANIM[iWeaponId] - 8iDecResult0)
        }
        else    
UT_PlayWeaponAnim(idDEFAULT_WPN_DRAW_ANIM[iWeaponId])
        
        
ExecuteHamB(Ham_Item_UpdateClientDataiEntid)
    }
    return 
PLUGIN_HANDLED
}

stock play_weapon_anim(iEntiAnimiSkipLocaliBody)
    return 
ExecuteHam(Ham_Weapon_SendWeaponAnimiEntiAnimiSkipLocaliBody

This is my code. And in game , this is :

[IMG]http://img14.**************/img14/7049/dedust20001on.png][/IMG]
[IMG]http://img14.**************/img14/7049/dedust20001on.png[/IMG]

Uploaded with **************

Arkshine 08-15-2012 06:33

Re: [HELP] Dummy Sequence
 
Use bbcode tag for code, please. [Pawn ] or [php ]

lucas_7_94 08-15-2012 06:57

Re: [HELP] Dummy Sequence
 
That's CS? Or CS:GO?

darktemplar 08-15-2012 07:00

Re: [HELP] Dummy Sequence
 
That's my CS Mod, it called CS RED


All times are GMT -4. The time now is 05:46.

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