Raised This Month: $51 Target: $400
 12% 

[SNIPPET][CSS]custom viewmodels without flickers and without disabling prediction


Post New Thread Reply   
 
Thread Tools Display Modes
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 11-19-2012 , 12:08   Re: [SNIPPET][CSS]custom viewmodels without flickers and without disabling prediction
Reply With Quote #31

how to block flipping the visible model (to left hand)?
kadet.89 is offline
Send a message via Skype™ to kadet.89
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 03-03-2013 , 14:33   Re: [SNIPPET][CSS]custom viewmodels without flickers and without disabling prediction
Reply With Quote #32

Quote:
Originally Posted by rediem View Post
How do I change the world model?
Custom gun models/skins
__________________
...

Last edited by Oshizu; 03-03-2013 at 14:34.
Oshizu is offline
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 03-03-2013 , 15:35   Re: [SNIPPET][CSS]custom viewmodels without flickers and without disabling prediction
Reply With Quote #33

Quote:
Originally Posted by Oshizu View Post
I'd say that answer's a little bit too late to the person you replied to , but it helps everyone else out.
__________________
Need help? PM me or add me on Steam.
My Steam




Quote:
Originally Posted by Rp.KryptoNite View Post
For some reason his Plugin never worked for me ,
@credits were added
im not stealing any plugins dude its my THING
minimoney1 is offline
SkinSteiz
New Member
Join Date: Mar 2013
Old 03-29-2013 , 17:31   Re: [SNIPPET][CSS]custom viewmodels without flickers and without disabling prediction
Reply With Quote #34

Custom weapon(weapon_deagle) stand in the left hand *fixed-model troubles
sleeves bag!(switching/fire any weapons and you have a + 1 sleeve)
hide custom model sleeve if it non-active

Last edited by SkinSteiz; 03-30-2013 at 02:16.
SkinSteiz is offline
XHeadHunterX
Member
Join Date: Aug 2013
Old 10-16-2013 , 14:03   Re: [SNIPPET][CSS]custom viewmodels without flickers and without disabling prediction
Reply With Quote #35

Does not work with CS:GO, it simply shows no animation.
XHeadHunterX is offline
_pHabb
Senior Member
Join Date: Jul 2013
Location: GetCountry(pHabb);
Old 11-30-2013 , 11:37   Re: [SNIPPET][CSS]custom viewmodels without flickers and without disabling prediction
Reply With Quote #36

Quote:
Originally Posted by blodia View Post
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

#pragma semicolon 1

#define EF_NODRAW 32

new CustomModel1;
new 
CustomModel2;

new 
bool:SpawnCheck[MAXPLAYERS+1];
new 
ClientVM[MAXPLAYERS+1][2];
new 
bool:IsCustom[MAXPLAYERS+1];

public 
OnPluginStart()
{
    
HookEvent("player_death"Event_PlayerDeath);
    
HookEvent("player_spawn"Event_PlayerSpawn);
    
    for (new 
client 1client <= MaxClientsclient++) 
    { 
        if (
IsClientInGame(client)) 
        {
            
SDKHook(clientSDKHook_PostThinkPostOnPostThinkPost);
            
            
//find both of the clients viewmodels
            
ClientVM[client][0] = GetEntPropEnt(clientProp_Send"m_hViewModel");
            
            new 
PVM = -1;
            while ((
PVM FindEntityByClassname(PVM"predicted_viewmodel")) != -1)
            {
                if (
GetEntPropEnt(PVMProp_Send"m_hOwner") == client)
                {
                    if (
GetEntProp(PVMProp_Send"m_nViewModelIndex") == 1)
                    {
                        
ClientVM[client][1] = PVM;
                        break;
                    }
                }
            }
        } 
    }
}

public 
OnMapStart()
{
    
CustomModel1 PrecacheModel("models/Weapons/v_smg_p90.mdl");
    
CustomModel2 PrecacheModel("models/Weapons/v_smg_tmp.mdl");
}

public 
OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_PostThinkPostOnPostThinkPost);
}

public 
OnEntityCreated(entity, const String:classname[])
{
    if (
StrEqual(classname"predicted_viewmodel"false))
    {
        
SDKHook(entitySDKHook_SpawnOnEntitySpawned);
    }
}

//find both of the clients viewmodels
public OnEntitySpawned(entity)
{
    new 
Owner GetEntPropEnt(entityProp_Send"m_hOwner");
    if ((
Owner 0) && (Owner <= MaxClients))
    {
        if (
GetEntProp(entityProp_Send"m_nViewModelIndex") == 0)
        {
            
ClientVM[Owner][0] = entity;
        }
        else if (
GetEntProp(entityProp_Send"m_nViewModelIndex") == 1)
        {
            
ClientVM[Owner][1] = entity;
        }
    }
}

public 
OnPostThinkPost(client)
{
    static 
OldWeapon[MAXPLAYERS 1];
    static 
OldSequence[MAXPLAYERS 1];
    static 
Float:OldCycle[MAXPLAYERS 1];
    
    
decl String:ClassName[30];
    new 
WeaponIndex;
    
    
//handle spectators
    
if (!IsPlayerAlive(client))
    {
        new 
spec GetEntPropEnt(clientProp_Send"m_hObserverTarget");
        if (
spec != -1)
        {
            
WeaponIndex GetEntPropEnt(specProp_Send"m_hActiveWeapon");
            
GetEdictClassname(WeaponIndexClassNamesizeof(ClassName));
            if (
StrEqual("weapon_ump45"ClassNamefalse))
            {
                
SetEntProp(ClientVM[client][1], Prop_Send"m_nModelIndex"CustomModel1);
            }
            else if (
StrEqual("weapon_mp5navy"ClassNamefalse))
            {
                
SetEntProp(ClientVM[client][1], Prop_Send"m_nModelIndex"CustomModel2);
            }
        }
        
        return;
    }
    
    
WeaponIndex GetEntPropEnt(clientProp_Send"m_hActiveWeapon");
    new 
Sequence GetEntProp(ClientVM[client][0], Prop_Send"m_nSequence");
    new 
Float:Cycle GetEntPropFloat(ClientVM[client][0], Prop_Data"m_flCycle");
    
    if (
WeaponIndex <= 0)
    {
        new 
EntEffects GetEntProp(ClientVM[client][1], Prop_Send"m_fEffects");
        
EntEffects |= EF_NODRAW;
        
SetEntProp(ClientVM[client][1], Prop_Send"m_fEffects"EntEffects);
        
        
IsCustom[client] = false;
            
        
OldWeapon[client] = WeaponIndex;
        
OldSequence[client] = Sequence;
        
OldCycle[client] = Cycle;
        
        return;
    }
    
    
//just stuck the weapon switching in here aswell instead of a separate hook
    
if (WeaponIndex != OldWeapon[client])
    {
        
GetEdictClassname(WeaponIndexClassNamesizeof(ClassName));
        if (
StrEqual("weapon_ump45"ClassNamefalse))
        {
            
//hide viewmodel
            
new EntEffects GetEntProp(ClientVM[client][0], Prop_Send"m_fEffects");
            
EntEffects |= EF_NODRAW;
            
SetEntProp(ClientVM[client][0], Prop_Send"m_fEffects"EntEffects);
            
//unhide unused viewmodel
            
EntEffects GetEntProp(ClientVM[client][1], Prop_Send"m_fEffects");
            
EntEffects &= ~EF_NODRAW;
            
SetEntProp(ClientVM[client][1], Prop_Send"m_fEffects"EntEffects);
            
            
//set model and copy over props from viewmodel to used viewmodel
            
SetEntProp(ClientVM[client][1], Prop_Send"m_nModelIndex"CustomModel1);
            
SetEntPropEnt(ClientVM[client][1], Prop_Send"m_hWeapon"GetEntPropEnt(ClientVM[client][0], Prop_Send"m_hWeapon"));
            
            
SetEntProp(ClientVM[client][1], Prop_Send"m_nSequence"GetEntProp(ClientVM[client][0], Prop_Send"m_nSequence"));
            
SetEntPropFloat(ClientVM[client][1], Prop_Send"m_flPlaybackRate"GetEntPropFloat(ClientVM[client][0], Prop_Send"m_flPlaybackRate"));
            
            
IsCustom[client] = true;
        }
        else if (
StrEqual("weapon_mp5navy"ClassNamefalse))
        {
            new 
EntEffects GetEntProp(ClientVM[client][0], Prop_Send"m_fEffects");
            
EntEffects |= EF_NODRAW;
            
SetEntProp(ClientVM[client][0], Prop_Send"m_fEffects"EntEffects);
            
            
EntEffects GetEntProp(ClientVM[client][1], Prop_Send"m_fEffects");
            
EntEffects &= ~EF_NODRAW;
            
SetEntProp(ClientVM[client][1], Prop_Send"m_fEffects"EntEffects);
            
            
SetEntProp(ClientVM[client][1], Prop_Send"m_nModelIndex"CustomModel2);
            
SetEntPropEnt(ClientVM[client][1], Prop_Send"m_hWeapon"GetEntPropEnt(ClientVM[client][0], Prop_Send"m_hWeapon"));
            
            
SetEntProp(ClientVM[client][1], Prop_Send"m_nSequence"GetEntProp(ClientVM[client][0], Prop_Send"m_nSequence"));
            
SetEntPropFloat(ClientVM[client][1], Prop_Send"m_flPlaybackRate"GetEntPropFloat(ClientVM[client][0], Prop_Send"m_flPlaybackRate"));
            
            
IsCustom[client] = true;
        }
        else
        {
            
//hide unused viewmodel if the current weapon isn't using it
            
new EntEffects GetEntProp(ClientVM[client][1], Prop_Send"m_fEffects");
            
EntEffects |= EF_NODRAW;
            
SetEntProp(ClientVM[client][1], Prop_Send"m_fEffects"EntEffects);
            
            
IsCustom[client] = false;
        }
    }
    else
    {
        if (
IsCustom[client])
        {
            
//copy the animation stuff from the viewmodel to the used one every frame
            
SetEntProp(ClientVM[client][1], Prop_Send"m_nSequence"GetEntProp(ClientVM[client][0], Prop_Send"m_nSequence"));
            
SetEntPropFloat(ClientVM[client][1], Prop_Send"m_flPlaybackRate"GetEntPropFloat(ClientVM[client][0], Prop_Send"m_flPlaybackRate"));
            
            if ((
Cycle OldCycle[client]) && (Sequence == OldSequence[client]))
            {
                
SetEntProp(ClientVM[client][1], Prop_Send"m_nSequence"0);
            }
        }
    }
    
//hide viewmodel a frame after spawning
    
if (SpawnCheck[client])
    {
        
SpawnCheck[client] = false;
        if (
IsCustom[client])
        {
            new 
EntEffects GetEntProp(ClientVM[client][0], Prop_Send"m_fEffects");
            
EntEffects |= EF_NODRAW;
            
SetEntProp(ClientVM[client][0], Prop_Send"m_fEffects"EntEffects);
        }
    }
    
    
OldWeapon[client] = WeaponIndex;
    
OldSequence[client] = Sequence;
    
OldCycle[client] = Cycle;
}
//hide viewmodel on death
public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
UserId GetEventInt(event"userid");
    new 
client GetClientOfUserId(UserId);
    
    new 
EntEffects GetEntProp(ClientVM[client][1], Prop_Send"m_fEffects");
    
EntEffects |= EF_NODRAW;
    
SetEntProp(ClientVM[client][1], Prop_Send"m_fEffects"EntEffects);
}

//when a player repsawns at round start after surviving previous round the viewmodel is unhidden
public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
UserId GetEventInt(event"userid");
    new 
client GetClientOfUserId(UserId);
    
    
//use to delay hiding viewmodel a frame or it won't work
    
SpawnCheck[client] = true;

How to make a V_ and W_ models, sounds with this plugin?
Where can I find models for server side?

Last edited by _pHabb; 11-30-2013 at 11:39.
_pHabb 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 16:40.


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