AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=109)
-   -   [CS:GO ZR] Custom Claws (first person view models) (https://forums.alliedmods.net/showthread.php?t=275593)

Franc1sco 12-03-2015 22:59

[CS:GO ZR] Custom Claws (first person view models)
 
Description:

Set custom claws in CS:GO for zombiereloaded servers.

Screenshot: http://steamcommunity.com/sharedfile.../?id=568084115


Requeriments:

Configuration:

-Upload the .smx file to addons/sourcemod/plugins

-Put all the claws files into addons/sourcemod/configs/zr/downloads.txt
Example:
Code:

// zombie claws
//**************  Claws textures **************//

// Default
materials/models/zombie/normal_f/hand/normal_f_hand.vmt
materials/models/zombie/normal_f/normal_f_hand.vtf
materials/models/zombie/normal_f/normal_f_hand_normal.vtf
models/zombie/normal_f/hand/hand_zombie_normal_f.mdl
models/zombie/normal_f/hand/hand_zombie_normal_f.dx90.vtx
models/zombie/normal_f/hand/hand_zombie_normal_f.vvd

// Fast
materials/models/zombie/normalhost_female/hand/normalhost_f_arm.vmt
materials/models/zombie/normalhost_female/normalhost_f_arm.vtf
materials/models/zombie/normalhost_female/normalhost_f_arm_normal.vtf
models/zombie/normalhost_female/hand/hand_zombie_normalhost_f.mdl
models/zombie/normalhost_female/hand/hand_zombie_normalhost_f.dx90.vtx
models/zombie/normalhost_female/hand/hand_zombie_normalhost_f.vvd

// Tank
materials/models/zombie/normal/hand/zombie_normal_hand.vmt
materials/models/zombie/normal/zombie_normal_hand.vtf
materials/models/zombie/normal/zombie_normal_hand_normal.vtf
models/zombie/normal/hand/hand_zombie_normal_fix.mdl
models/zombie/normal/hand/hand_zombie_normal_fix.dx90.vtx
models/zombie/normal/hand/hand_zombie_normal_fix.vvd

// Psyh
materials/models/zombie/normalhost/hand/zombie_normalhost_hand.vmt
materials/models/zombie/normalhost/zombie_normalhost_hand.vtf
materials/models/zombie/normalhost/zombie_normalhost_hand_normal.vtf
models/zombie/normalhost/hand/hand_zombie_normalhost.mdl
models/zombie/normalhost/hand/hand_zombie_normalhost.dx90.vtx
models/zombie/normalhost/hand/hand_zombie_normalhost.vvd


// the rest

// team win overlays
materials/overlays/zr/zombies_win.vtf
materials/overlays/zr/zombies_win.vmt
materials/overlays/zr/humans_win.vtf
materials/overlays/zr/humans_win.vmt

models/player/others/zombie.mdl
models/player/others/zombie.phy
models/player/others/zombie.vtx
models/player/others/zombie.vvd

materials\models\player\freddykrueger\body.vmt
materials\models\player\freddykrueger\body.vtf
materials\models\player\freddykrueger\body2.vmt
materials\models\player\freddykrueger\body2.vtf
materials\models\player\freddykrueger\body_n.vtf
materials\models\player\freddykrueger\body_s.vtf
materials\models\player\freddykrueger\hat.vmt
materials\models\player\freddykrueger\hat.vtf
materials\models\player\freddykrueger\hat_n.vtf
materials\models\player\freddykrueger\hat_s.vtf

models\player\freddykrueger\freddykrueger.dx90.vtx
models\player\freddykrueger\freddykrueger.mdl
models\player\freddykrueger\freddykrueger.phy
models\player\freddykrueger\freddykrueger.vvd

sound/music/zr/fz_scream1.mp3
sound/music/zr/zombie_die1.mp3
sound/music/zr/zombie_die2.mp3
sound/music/zr/zombie_die3.mp3
sound/music/zr/zombie_pain1.mp3
sound/music/zr/zombie_pain2.mp3
sound/music/zr/zombie_pain3.mp3
sound/music/zr/zombie_pain4.mp3
sound/music/zr/zombie_pain5.mp3
sound/music/zr/zombie_pain6.mp3
sound/music/zr/zombie_voice_idle1.mp3
sound/music/zr/zombie_voice_idle10.mp3
sound/music/zr/zombie_voice_idle11.mp3
sound/music/zr/zombie_voice_idle12.mp3
sound/music/zr/zombie_voice_idle13.mp3
sound/music/zr/zombie_voice_idle14.mp3
sound/music/zr/zombie_voice_idle2.mp3
sound/music/zr/zombie_voice_idle3.mp3
sound/music/zr/zombie_voice_idle4.mp3
sound/music/zr/zombie_voice_idle5.mp3
sound/music/zr/zombie_voice_idle6.mp3
sound/music/zr/zombie_voice_idle7.mp3
sound/music/zr/zombie_voice_idle8.mp3
sound/music/zr/zombie_voice_idle9.mp3
sound/music/zr/zr_ambience.mp3

-In the file addons/sourcemod/configs/zr/playerclasses.txt you need to add a entry called "claws_path" for add a arms model for these class
Example:
Code:

    "zombie_classic2"
    {
        // General
        "enabled"              "yes"
        "team"                  "0"
        "team_default"          "yes"
        "flags"                "0"
        "group"                "VIP"
       
        "name"                  "Freddy krueger"
        "description"          "Admin model"
       
        // Model
        "model_path"            "models/player/freddykrueger/freddykrueger.mdl"
        "claws_path"            "models/zombie/normal_f/hand/hand_zombie_normal_f.mdl" // claws model for this class
        "alpha_initial"        "255"
        "alpha_damaged"        "255"
        "alpha_damage"          "0"
       
        // Hud
        "overlay_path"          ""
        "nvgs"                  "no"
        "fov"                  "90"
       
        // Effects
        "has_napalm"            "no"
        "napalm_time"          "7.0"
       
        // Player behavior
        "immunity_mode"        "none"
        "immunity_amount"      "1"
        "immunity_cooldown"    "60"
        "no_fall_damage"        "yes"
       
        "health"                "6000"
        "health_regen_interval" "1.0"
        "health_regen_amount"  "10"
        "health_infect_gain"    "500"
        "kill_bonus"            "2"
       
        "speed"                "310"
        "knockback"            "4.0"
        "jump_height"          "1.0"
        "jump_distance"        "1.0"
    }

Note: if you dont add a entry called "claws_path" to a class, then this class will use the default model.


Requeriments:

ZombieReloaded


Credits:

Models taken from the zombie plague of gubka
Custom viewmodel snippet - https://forums.alliedmods.net/showthread.php?t=273885


Donations (optional):

If you apreciate my work, you can donate me via paypal or with a trade offer


Download:

Main repository
Direct download
Code changes

Lannister 12-03-2015 23:04

Re: [CS:GO ZR] Custom Claws (first person view models)
 
Muchas gracias !!!

Franc1sco 12-03-2015 23:14

Re: [CS:GO ZR] Custom Claws (first person view models)
 
I made some optimizations, I dont tested it yet. Someone can test if it works well?

bebe9b 12-04-2015 14:47

Re: [CS:GO ZR] Custom Claws (first person view models)
 
Hi,

Pls fix:
L 12/04/2015 - 20:45:00: [SM] Plugin encountered error 4: Invalid parameter or parameter type

L 12/04/2015 - 20:45:00: [SM] Native "PrintToServer" reported: String formatted incorrectly - parameter 3 (total 2)

L 12/04/2015 - 20:45:00: [SM] Displaying call stack trace for plugin "zr_customclaws.smx":

L 12/04/2015 - 20:45:00: [SM] [0] Line 164, zr_customclaws.sp::Loading()

Thx,

Franc1sco 12-04-2015 15:11

Re: [CS:GO ZR] Custom Claws (first person view models)
 
Quote:

Originally Posted by bebe9b (Post 2368793)
Hi,

Pls fix:
L 12/04/2015 - 20:45:00: [SM] Plugin encountered error 4: Invalid parameter or parameter type

L 12/04/2015 - 20:45:00: [SM] Native "PrintToServer" reported: String formatted incorrectly - parameter 3 (total 2)

L 12/04/2015 - 20:45:00: [SM] Displaying call stack trace for plugin "zr_customclaws.smx":

L 12/04/2015 - 20:45:00: [SM] [0] Line 164, zr_customclaws.sp::Loading()

Thx,

ups epic fail :oops:

I fixed it and maybe some other fixes like some animations files missing, please try it


Also I added credits to the first post
Spoiler

sneaK 12-04-2015 15:29

Re: [CS:GO ZR] Custom Claws (first person view models)
 
Hey Francisco, any way to make this usable outside of ZR? Would love to use this in my surf servers :)

Franc1sco 12-04-2015 15:35

Re: [CS:GO ZR] Custom Claws (first person view models)
 
Quote:

Originally Posted by blackhawk74 (Post 2368800)
Hey Francisco, any way to make this usable outside of ZR? Would love to use this in my surf servers :)

Soon I will publish a version usable outside of ZR https://forums.alliedmods.net/showpo...&postcount=197
This plugin is only the first.

valio_skull 12-07-2015 06:40

Re: [CS:GO ZR] Custom Claws (first person view models)
 
Can you make this plugin WITHOUT those ZR includes ? I want just T and CT view models...

PHP Code:

#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <zombiereloaded>
#include <cstrike>
#include <sdkhooks>  

#define DATA "1.0"

public Plugin:myinfo =
{
    
name "ZR Custom CS:GO Claws",
    
author "Franc1sco franug",
    
description "",
    
version DATA,
    
url "http://steamcommunity.com/id/franug"
};

new 
Handle:kv;
new 
Handle:hPlayerClassesString:sClassPath[PLATFORM_MAX_PATH] = "configs/zr/playerclasses.txt";

new 
Handle:trie_classes;

new 
g_PVMid[MAXPLAYERS];

public 
OnPluginStart() 
{
    
trie_classes CreateTrie();
    
    
CreateConVar("sm_customclaws_version"DATA""FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
    
    for(new 
1<= MaxClientsi++)
        if(
IsClientInGame(i)) OnClientPutInServer(i);
}

/*  public Action:OnSpawn(Handle:event, const String:name[], bool:dontBroadcast) 
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    g_PVMid[client] = Weapon_GetViewModelIndex(client, -1); 
} */

public ZR_OnClientInfected(clientattackerbool:motherInfectbool:respawnOverridebool:respawn)
{
    
Arms(client);
}

public 
ZR_OnClientHumanPost(clientbool:respawnbool:protect)
{
    
Arms(client);
}

Arms(client)
{
    
g_PVMid[client] = Weapon_GetViewModelIndex(client, -1);
    new 
cindex ZR_GetActiveClass(client);
    
//PrintToChat(client, "paso1");
    
if(!ZR_IsValidClassIndex(cindex)) return;
    
    
decl String:namet[64],String:model[128];
    
    new 
index;
    
    
ZR_GetClassDisplayName(cindexnametsizeof(namet));
    if(!
GetTrieString(trie_classesnametmodelsizeof(model))) return;
    
//PrintToChat(client, "paso2");
    
if(!GetTrieValue(trie_classesmodelindex)) return;
    
//PrintToChat(client, "paso3");
    
new wpnid GetEntPropEnt(clientProp_Send"m_hActiveWeapon"); 
    if(
wpnid 1) return;
    
SetEntProp(wpnidProp_Send"m_nModelIndex"0); 
    
SetEntProp(g_PVMid[client], Prop_Send"m_nModelIndex"index); 
        
    
//PrintToChat(client, "index es %i", index);
    
int iWorldModel GetEntPropEnt(wpnidProp_Send"m_hWeaponWorldModel"); 
    if(
IsValidEdict(iWorldModel)) SetEntProp(iWorldModelProp_Send"m_nModelIndex"0); 
}

public 
void OnClientPutInServer(int client)

    
SDKHook(clientSDKHook_WeaponSwitchPostOnClientWeaponSwitchPost);  
    if(!
IsFakeClient(client)) SDKHook(clientSDKHook_WeaponEquipPostOnPostWeaponEquip);


public 
Action OnPostWeaponEquip(int clientint weapon)
{
    if(
weapon || !IsValidEdict(weapon) || !IsValidEntity(weapon)) return;
    
    if (
GetEntProp(weaponProp_Send"m_hPrevOwner") > 0)
        return;
        
        
    if(
IsPlayerAlive(client) && ZR_IsClientZombie(client))
    {
        
SetEntProp(weapon,Prop_Send,"m_iItemIDLow",-1);

        
SetEntProp(weapon,Prop_Send,"m_nFallbackPaintKit",-1);
    }
}

public 
void OnClientWeaponSwitchPost(int clientint wpnid

    if(
IsPlayerAlive(client) && ZR_IsClientZombie(client)) Arms(client);


//

public OnAllPluginsLoaded()
{
    if (
hPlayerClasses != INVALID_HANDLE)
    {
        
UnhookConVarChange(hPlayerClassesOnClassPathChange);
        
CloseHandle(hPlayerClasses);
    }
    if ((
hPlayerClasses FindConVar("zr_config_path_playerclasses")) == INVALID_HANDLE)
    {
        
SetFailState("Zombie:Reloaded is not running on this server");
    }
    
HookConVarChange(hPlayerClassesOnClassPathChange);
}

public 
OnClassPathChange(Handle:convar, const String:oldValue[], const String:newValue[])
{
    
strcopy(sClassPathsizeof(sClassPath), newValue);
    
OnConfigsExecuted();
}

public 
OnConfigsExecuted()
{
    
CreateTimer(0.2Loading_TIMER_FLAG_NO_MAPCHANGE);
}

public 
Action:Loading(Handle:timer)
{
    if (
kv != INVALID_HANDLE)
    {
        
CloseHandle(kv);
    }
    
kv CreateKeyValues("classes");
    
    
decl String:buffer[PLATFORM_MAX_PATH];
    
BuildPath(Path_SMbuffersizeof(buffer), "%s"sClassPath);
    
    if (!
FileToKeyValues(kvbuffer))
    {
        
SetFailState("Class data file \"%s\" not found"buffer);
    }
    new 
index;
    if (
KvGotoFirstSubKey(kv))
    {
        
ClearTrie(trie_classes);
        
decl String:name[64],String:model[128];
        
        do
        {
            
KvGetString(kv"name"namesizeof(name));
            
KvGetString(kv"claws_path"modelsizeof(model), " ");
            
            
SetTrieString(trie_classesnamemodel);
            
            if(
strlen(model) > && FileExists(model) && !IsModelPrecached(model)) 
            {
                
index PrecacheModel(model);
                
SetTrieValue(trie_classesmodelindex);
                
PrintToServer("Loaded model %s with index %i"index);
            }
            
        } while (
KvGotoNextKey(kv));
    }
    
KvRewind(kv);
}

// Thanks to gubka for these 2 functions below. 

// Get model index and prevent server from crash 
int Weapon_GetViewModelIndex(int clientint sIndex

    while ((
sIndex FindEntityByClassname2(sIndex"predicted_viewmodel")) != -1
    { 
        
int Owner GetEntPropEnt(sIndexProp_Send"m_hOwner"); 
        
int ClientWeapon GetEntPropEnt(clientProp_Send"m_hActiveWeapon"); 
        
int Weapon GetEntPropEnt(sIndexProp_Send"m_hWeapon"); 
         
        if (
Owner != client
            continue; 
         
        if (
ClientWeapon != Weapon
            continue; 
         
        return 
sIndex
    } 
    return -
1

// Get entity name 
int FindEntityByClassname2(int sStartEntchar[] szClassname

    while (
sStartEnt > -&& !IsValidEntity(sStartEnt)) sStartEnt--; 
    return 
FindEntityByClassname(sStartEntszClassname); 



Lannister 12-07-2015 09:26

Re: [CS:GO ZR] Custom Claws (first person view models)
 
Some players and me are experiencing some crashes while using this plugin, i mean, some players join the server and when they spec someone they get insta game crash, but not all the time, just sometimes, i've deleted all the models and everything to re-download them and still same issue.

I wonder if you guys have the same problem or it is just me!

barvica 12-07-2015 13:37

Re: [CS:GO ZR] Custom Claws (first person view models)
 
does it only work for ZR or can i use on hosities mod ?

edit: nevermind just read it


All times are GMT -4. The time now is 08:30.

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