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

[CSGO]Why this plugin will also add arms to humans?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
2389736818
Member
Join Date: Jul 2014
Location: China
Old 10-24-2016 , 08:23   [CSGO]Why this plugin will also add arms to humans?
Reply With Quote #1

zombie


humans


PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <zriot>
#include <cstrike>

public Plugin:myinfo =
{
    
name "ZR Custom CS:GO Arms Modified support ZRiot",
    
author "Franc1sco franug, Modified by 2389736818",
    
description "",
    
version "4.0",
    
url "http://www.zeuszombie.com"
};

new 
Handle:kv;
new 
String:path[PLATFORM_MAX_PATH] = "configs/zriot/zombies.txt";

new 
Handle:trie_zombies;


new 
String:manos[MAXPLAYERS+1][128];

public 
OnPluginStart() 
{
    
trie_zombies CreateTrie();

    
HookEvent("player_spawn"OnSpawn);
    
    
HookEvent("round_start"Restart);
    
    for(new 
1<= MaxClientsi++)
        if(
IsClientInGame(i)) OnClientPutInServer(i);
}

public 
OnClientPutInServer(client)
{
    
Format(manos[client], 128"models/weapons/ct_arms_gign.mdl");
}

public 
OnMapStart()
{
    
PrecacheModel("models/weapons/ct_arms_gign.mdl");
}

public 
Action:OnSpawn(Handle:event, const String:name[], bool:dontBroadcast
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if(
IsPlayerAlive(client) && ZRiot_IsClientZombie(client)) GetEntPropString(clientProp_Send"m_szArmsModel"manos[client], 64);
    
    
Arms(client);
}

Arms(client)
{
    if(!
IsPlayerAlive(client)) return;
    
    
decl String:namet[64],String:model[128], String:currentmodel[128];
    if(!
GetTrieString(trie_zombiesnametmodelsizeof(model))) return;
    
    
GetEntPropString(clientProp_Send"m_szArmsModel"currentmodelsizeof(currentmodel));
    
    if(
strlen(model) > 3
    {
        if(!
StrEqual(currentmodelmodel)) SetEntPropString(clientProp_Send"m_szArmsModel"model);
        
//PrintToChat(client, "used %s with class %i",model, cindex);
    
}
    else
    {
        if(!
StrEqual(currentmodelmanos[client])) SetEntPropString(clientProp_Send"m_szArmsModel"manos[client]);
        
//PrintToChat(client, "used %s with class %i",manos[client], cindex);
    
}
}

public 
Action:Restart(Handle:event, const String:name[], bool:dontBroadcast)
{
    
CreateTimer(0.5Cleaner);
    
CreateTimer(0.75Cleaner);
}

public 
Action:Cleaner(Handle:timer)
{
     for (new 
1MaxClientsi++)
        if(
IsClientInGame(i) && IsPlayerAlive(i))
        {
            
Arms(i);
            if(
GetClientTeam(i) == CS_TEAM_T)
            {
                
CS_SwitchTeam(iCS_TEAM_CT);
            }
            else if(
GetClientTeam(i) == CS_TEAM_CT)
            {
                
CS_SwitchTeam(iCS_TEAM_T);
            }
        }
}

//

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

public 
Action:OnConfigsExecutedPost(Handle:timer)
{
    if (
kv != INVALID_HANDLE)
    {
        
CloseHandle(kv);
    }
    
kv CreateKeyValues("zombies");
    
    
decl String:buffer[PLATFORM_MAX_PATH];
    
BuildPath(Path_SMbuffersizeof(buffer), "%s"path);
    
    if (!
FileToKeyValues(kvbuffer))
    {
        
SetFailState("Class data file \"%s\" not found"buffer);
    }
    
    if (
KvGotoFirstSubKey(kv))
    {
        
ClearTrie(trie_zombies);
        
decl String:name[64],String:model[128];
        
        do
        {
            
KvGetString(kv"name"namesizeof(name));
            
KvGetString(kv"arms_path"modelsizeof(model), " ");
            
            
SetTrieString(trie_zombiesnamemodel);
            
            if(
strlen(model) > && FileExists(model) && !IsModelPrecached(model)) PrecacheModel(model);
            
        } while (
KvGotoNextKey(kv));
    }
    
KvRewind(kv);

I only want to add to the zombie team .
__________________

Last edited by 2389736818; 10-24-2016 at 08:24.
2389736818 is offline
Kolapsicle
Senior Member
Join Date: Oct 2014
Old 10-24-2016 , 08:37   Re: [CSGO]Why this plugin will also add arms to humans?
Reply With Quote #2

"arms" is being called for all clients in the code. You can either add team checks before calling arms, or inside the function.

PHP Code:
if (GetClientTeam(i) == CS_TEAM_T)
{
    
// Custom model

You can take this a step further and add CT checks for default models if necessary.

Last edited by Kolapsicle; 10-24-2016 at 08:38.
Kolapsicle 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 10:02.


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