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

[L4D2] Changing Character ViewModel without using m_survivorCharacter?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DeathChaos25
Senior Member
Join Date: Jan 2014
Location: Puerto Rico
Old 04-03-2015 , 19:53   [L4D2] Changing Character ViewModel without using m_survivorCharacter?
Reply With Quote #1

So, in L4D1 Campaigns, it is possible to use L4D2 survivors thanks to Left4Downtown2 being able to force the L4D2 set, however this does not load the L4D2 survivor arms icons, so I tried to make a plugin to get around this issue, keeping in mind that the actual ViewModel entity of the player is obtained via the Viewmodelindex netprop.

PHP Code:
#include <sourcemod> 
#include <sdktools>

#define PLUGIN_VERSION        "1.0"

static const String:MODEL_NICK_ARMS[] = "models/weapons/arms/v_arms_gambler_new.mdl";
static const 
String:MODEL_ROCHELLE_ARMS[] = "models/weapons/arms/v_arms_producer_new.mdl";
static const 
String:MODEL_COACH_ARMS[] = "models/weapons/arms/v_arms_coach_new.mdl";
static const 
String:MODEL_ELLIS_ARMS[] = "models/weapons/arms/v_arms_mechanic_new.mdl";

public 
Plugin:myinfo 
{
    
name "ViewModelTest"
    
author "DeathChaos"
    
description " "
    
version PLUGIN_VERSION
}

public 
OnPluginStart()
{
    
RegConsoleCmd("sm_v"ViewModelTest);
}

public 
OnMapStart()
{
    
CheckModelPreCache(MODEL_NICK_ARMS);
    
CheckModelPreCache(MODEL_ROCHELLE_ARMS);
    
CheckModelPreCache(MODEL_COACH_ARMS);
    
CheckModelPreCache(MODEL_ELLIS_ARMS);
}
public 
Action:ViewModelTest(clientargs)
{
    if (!
IsSurvivor(client))
    {
        return;
    }
    
    new 
ViewModelIndex GetEntProp(clientProp_Send"m_hViewModel");
    new 
String:model[PLATFORM_MAX_PATH] = "";
    
GetEntPropString(clientProp_Data"m_ModelName"modelsizeof(model));
    new 
String:message[PLATFORM_MAX_PATH] = "";
    
Format(messagesizeof(message), "Your Current Model Index is : %i and your model is %s"ViewModelIndexmodel);
    
PrintToChat(clientmessage);
    
    if (
IsValidEntity(ViewModelIndex))
    {
        
DispatchKeyValue(ViewModelIndex"CharacterViewmodelAddon"MODEL_NICK_ARMS);
    }
}
stock bool:IsSurvivor(client)
{
    if (
client && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2)
    {
        return 
true;
    }
    return 
false;
}
stock CheckModelPreCache(const String:Modelfile[])
{
    if (!
IsModelPrecached(Modelfile))
    {
        
PrecacheModel(Modelfiletrue);
        
PrintToServer("Precaching Model:%s"Modelfile);
    }

However, For some reason, the viewmodel entity is reported as an invalid entity.

Any ideas as to why?
__________________
DeathChaos25 is offline
Edison1318
Senior Member
Join Date: Nov 2015
Location: Peaceful place of the in
Old 08-12-2016 , 14:22   Re: [L4D2] Changing Character ViewModel without using m_survivorCharacter?
Reply With Quote #2

I'm looking for the plugin to change ViewModel, like using character as Nick and the Nick's fp arm change to rochelle,bill,ellis and others characters stuff.
__________________
EdisonGar
Edison1318 is offline
Send a message via Skype™ to Edison1318
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 13:11.


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