Raised This Month: $252 Target: $400
 63% 

[CS:GO] -N- Arms Fix [2.0.2 | 2019-11-29]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
NomisCZ
AlliedModders Donor
Join Date: Mar 2014
Location: Czech_Republic
Plugin ID:
5501
Plugin Version:
2.0.2
Plugin Category:
General Purpose
Plugin Game:
Counter-Strike: GO
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Fix arms/gloves in first person
    Old 01-28-2017 , 11:38   [CS:GO] -N- Arms Fix [2.0.2 | 2019-11-29]
    Reply With Quote #1

    [CS:GO] -N- Arms Fix

    Latest version: 2.0.2


    ⚠️Operation Shattered Web (26.11.2019) changes:
    ⚠️Version 2.0.x changes:
    • ArmsFix_OnArmsSafe and ArmsFix_OnModelSafe is now N_ArmsFix_OnClientReady
    • Natives was renamed - see ⚡️ Developer API
    • Library name is now N_ArmsFix, so update name in your OnLibraryAdded/OnLibraryRemoved/OnAllPluginsLoaded/LibraryExists
    • Added N_ArmsFix_ProtectedMaps.txt config

    ≡ Info
    • -N- Arms Fix helps you to fix arms/gloves in your plugin.

    ≡ Installation
    ≡ Configuration
    • sm_arms_fix_autospawn - Enable auto spawn fix (automatically sets default gloves)?
      Default: "1"
    • sm_arms_fix_bots - Enable auto spawn fix for bots (automatically sets default gloves for bots)?
      Default: "1"
    • If you need to protect your custom map gamemodes_server settings, please add your map to addons\sourcemod\plugins\configs\N_ArmsFix_ProtectedMaps.txt
    • If you want to return to the original gamemodes.txt, just disable plugin and update & validate your server.

    ≡ Latest version
    ≡ GIT
    ≡ Plugin example
    ⚡️ Developer API
    Spoiler


    ≡ Change log
    Spoiler


    ≡ Thanks to
    __________________

    Last edited by NomisCZ; 11-30-2019 at 10:54. Reason: New version 2.0.2
    NomisCZ is offline
    superblack4
    Senior Member
    Join Date: Jan 2016
    Location: Vietnam
    Old 01-28-2017 , 12:35   Re: [CS:GO] -N- Arms Fix
    Reply With Quote #2

    Quote:
    Originally Posted by NomisCZ View Post
    ≡ Info:
    → This plugin helps you to fix arms/gloves in first person (only!).

    ≡ Installation:
    → Copy & paste .smx file to addons\sourcemod\plugins\<>

    ≡ Download:
    Here OR see attached files

    ≡ Compatible plugins:If you have problems, please first read FAQ, before you create new post/reply! https://github.com/NomisCZ/Arms-Fix#faq
    → GIT repo: https://github.com/NomisCZ/Arms-Fix
    Please keep up the good work and compatible with Francisco glove plugin so i can put my zombie arms model
    superblack4 is offline
    Franc1sco
    Veteran Member
    Join Date: Oct 2010
    Location: Spain (Madrid)
    Old 01-28-2017 , 12:40   Re: [CS:GO] -N- Arms Fix
    Reply With Quote #3

    Finally! I will add this to my arms public plugins if really works well
    __________________
    Veteran SourceMod Coder -> Activity channel
    Taking some paid jobs and selling some private stuff.
    Contact: Steam, Telegram or discord ( Franc1sco#7876 ).

    You like my work? +Rep in my steam profile comments or donate.


    Last edited by Franc1sco; 01-28-2017 at 12:47.
    Franc1sco is offline
    Send a message via MSN to Franc1sco
    good_live
    AlliedModders Donor
    Join Date: Oct 2013
    Old 01-28-2017 , 13:10   Re: [CS:GO] -N- Arms Fix
    Reply With Quote #4

    How exactly does this work?
    good_live is offline
    NomisCZ
    AlliedModders Donor
    Join Date: Mar 2014
    Location: Czech_Republic
    Old 01-28-2017 , 13:21   Re: [CS:GO] -N- Arms Fix
    Reply With Quote #5

    Quote:
    Originally Posted by good_live View Post
    How exactly does this work?
    -N- Arms Fix:
    Player Spawn -> Force set default model & arms

    Eg. SM Skinchooser 4.2:
    Player Spawn -> Wait 0.5s -> Set player arms/gloves -> Wait 2.0s -> Set player skin
    PHP Code:
    HookEvent("player_spawn"Event_PlayerSpawn);

    public 
    Action Event_PlayerSpawn(Handle event, const char[] namebool dontBroadcast) {
        
        
    int client GetClientOfUserId(GetEventInt(event"userid"));
        
    CreateTimer(0.5Timer_PostSpawnclient);
    }
    public 
    Action Timer_PostSpawn(Handle timerany client) {
        
    // First set player arms!
        
    GiveArms(client);
    // Set player model after 2 seconds
        
    CreateTimer(2.0Timer_Spawnclient);
    }

    public 
    void GiveArms(int client) {

    // Only if player have default arms -> -N- Arms Fix
    if(!isValidClient(client) || !hasDefaultArms(client)) return;
    ...
    }

    public 
    Action Timer_Spawn(Handle timerint client) {
    ...

    __________________

    Last edited by NomisCZ; 01-28-2017 at 13:24.
    NomisCZ is offline
    NomisCZ
    AlliedModders Donor
    Join Date: Mar 2014
    Location: Czech_Republic
    Old 01-28-2017 , 13:37   Re: [CS:GO] -N- Arms Fix
    Reply With Quote #6

    Quote:
    Originally Posted by Franc1sco View Post
    Finally! I will add this to my arms public plugins if really works well
    Just modify these code sections:
    PHP Code:
    // :: ADD THIS ::
    char defaultArms[][] = { "models/weapons/ct_arms.mdl""models/weapons/t_arms.mdl" };
    ...

    public 
    Action PlayerSpawn(Event gEventHook, const char[] gEventNamebool iDontBroadcast) {
    {
        
    int client GetClientOfUserId(gEventHook.GetInt("userid"));
            
    // :: ADD THIS ::
            
    CreateTimer(0.5PlayerSpawn_Armsclient);
    }
    // :: ADD THIS ::
    public Action PlayerSpawn_Arms(Handle timerint client) {
        
        
    GiveArms(client);
    }

    public 
    void GiveArms(int client)
    {
        if (!
    IsPlayerAlive(client))return;
        
        
    int team;
        if(
    GetFeatureStatus(FeatureType_Native"ZR_IsClientZombie") == FeatureStatus_Available)
        {
            if (
    ZR_IsClientZombie(client))team 0;
            else 
    team 1;
        }
        else
            
    team GetClientTeam(client);
            
        if(
    strlen(g_arms[1][team][client]) > && !StrEqual(g_arms[1][team][client], "none"false) && (FileExists(g_arms[1][team][client]) || FileExists(g_arms[1][team][client], true))) 
        {
            
    // :: ADD THIS ::
            
    if (StrEqual(g_arms[1][team][client], defaultArms[0]) || StrEqual(g_arms[1][team][client], defaultArms[1]))
                return;
            
    SetEntPropString(clientProp_Send"m_szArmsModel"g_arms[1][team][client]);
            
    CreateTimer(0.15RemoveItemTimerEntIndexToEntRef(client), TIMER_FLAG_NO_MAPCHANGE);
        }
        
    //PrintToChat(client, "modelo arms de %s de %s", g_arms[0][team][client], g_arms[1][team][client]);

    And configuration.txt:
    PHP Code:
    "CustomModels"
    {
        
    "Default CT Arms"
        
    {
            
    "model" "models/weapons/ct_arms.mdl"
            "team" "CT"
        
    }
        
    "Default T Arms"
        
    {
            
    "model" "models/weapons/t_arms.mdl"
            "team" "TT"
        
    }
    ... 
    Don't add -N- Arms Fix code directly into your plugin, because there are many other plugins with arms/gloves functions. So if everyone implement part of my code into its plugin. It can be problematic.
    __________________

    Last edited by NomisCZ; 01-28-2017 at 13:47.
    NomisCZ is offline
    Franc1sco
    Veteran Member
    Join Date: Oct 2010
    Location: Spain (Madrid)
    Old 01-28-2017 , 13:58   Re: [CS:GO] -N- Arms Fix
    Reply With Quote #7

    Quote:
    Originally Posted by NomisCZ View Post
    Just modify these code sections:
    PHP Code:
    // :: ADD THIS ::
    char defaultArms[][] = { "models/weapons/ct_arms.mdl""models/weapons/t_arms.mdl" };
    ...

    public 
    Action PlayerSpawn(Event gEventHook, const char[] gEventNamebool iDontBroadcast) {
    {
        
    int client GetClientOfUserId(gEventHook.GetInt("userid"));
            
    // :: ADD THIS ::
            
    CreateTimer(0.5PlayerSpawn_Armsclient);
    }
    // :: ADD THIS ::
    public Action PlayerSpawn_Arms(Handle timerint client) {
        
        
    GiveArms(client);
    }

    public 
    void GiveArms(int client)
    {
        if (!
    IsPlayerAlive(client))return;
        
        
    int team;
        if(
    GetFeatureStatus(FeatureType_Native"ZR_IsClientZombie") == FeatureStatus_Available)
        {
            if (
    ZR_IsClientZombie(client))team 0;
            else 
    team 1;
        }
        else
            
    team GetClientTeam(client);
            
        if(
    strlen(g_arms[1][team][client]) > && !StrEqual(g_arms[1][team][client], "none"false) && (FileExists(g_arms[1][team][client]) || FileExists(g_arms[1][team][client], true))) 
        {
            
    // :: ADD THIS ::
            
    if (StrEqual(g_arms[1][team][client], defaultArms[0]) || StrEqual(g_arms[1][team][client], defaultArms[1]))
                return;
            
    SetEntPropString(clientProp_Send"m_szArmsModel"g_arms[1][team][client]);
            
    CreateTimer(0.15RemoveItemTimerEntIndexToEntRef(client), TIMER_FLAG_NO_MAPCHANGE);
        }
        
    //PrintToChat(client, "modelo arms de %s de %s", g_arms[0][team][client], g_arms[1][team][client]);

    And configuration.txt:
    PHP Code:
    "CustomModels"
    {
        
    "Default CT Arms"
        
    {
            
    "model" "models/weapons/ct_arms.mdl"
            "team" "CT"
        
    }
        
    "Default T Arms"
        
    {
            
    "model" "models/weapons/t_arms.mdl"
            "team" "TT"
        
    }
    ... 
    Don't add -N- Arms Fix code directly into your plugin, because there are many other plugins with arms/gloves functions. So if everyone implement part of my code into its plugin. It can be problematic.

    You could add natives to your plugin for a better support in others plugins.
    __________________
    Veteran SourceMod Coder -> Activity channel
    Taking some paid jobs and selling some private stuff.
    Contact: Steam, Telegram or discord ( Franc1sco#7876 ).

    You like my work? +Rep in my steam profile comments or donate.

    Franc1sco is offline
    Send a message via MSN to Franc1sco
    incizzle
    AlliedModders Donor
    Join Date: Oct 2016
    Location: Canada, Toronto
    Old 01-29-2017 , 00:02   Re: [CS:GO] -N- Arms Fix
    Reply With Quote #8

    wow this is really cool and a good idea at that
    incizzle is offline
    headline
    SourceMod Moderator
    Join Date: Mar 2015
    Old 01-29-2017 , 01:08   Re: [CS:GO] -N- Arms Fix
    Reply With Quote #9

    Quote:
    Originally Posted by Franc1sco View Post
    You could add natives to your plugin for a better support in others plugins.
    I'd really like to echo this. Relying on timer delays is horrible, user proper natives/forwards to allow for developers to interact with your plugin in a way which makes sence

    Last edited by headline; 01-29-2017 at 01:18.
    headline is offline
    schwarz
    Senior Member
    Join Date: Nov 2011
    Location: under your bed
    Old 01-29-2017 , 09:54   Re: [CS:GO] -N- Arms Fix
    Reply With Quote #10

    hey

    good worker! but if you can make fix for store Zeph arms?

    (https://forums.alliedmods.net/showthread.php?t=290075)

    thanks
    __________________
    schwarz is offline
    Reply


    Thread Tools
    Display Modes

    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 05:50.


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